Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: list index out of range #5

Open
shakeyourbunny opened this issue May 16, 2015 · 3 comments
Open

IndexError: list index out of range #5

shakeyourbunny opened this issue May 16, 2015 · 3 comments

Comments

@shakeyourbunny
Copy link

Starting this script with the environment-set API key yields:

$ python ytsubs.py myyoutubeuser
Traceback (most recent call last):
  File "ytsubs.py", line 119, in <module>
    playlists = get_playlists(get_channel_for_user(username))
  File "ytsubs.py", line 50, in get_channel_for_user
    return data['items'][0]['id']
IndexError: list index out of range

I do provide my correct youtube user, what I'm doing wrong?

python version is 2.7.10rc1

@ali1234
Copy link
Owner

ali1234 commented May 16, 2015

Not sure. Maybe you are subscribed to someone who has no videos?

@imbolc
Copy link

imbolc commented Nov 23, 2015

I have the same problem. I tried different accounts. The answer form server is: {u'items': [], u'kind': u'youtube#channelListResponse', u'etag': u'"..."', u'pageInfo': {u'resultsPerPage': 5, u'totalResults': 0}}

@jldowns
Copy link

jldowns commented Apr 22, 2017

Youtube accounts created recently don't have usernames, they have "user id"s. (Your username is not your email address.) I changed line 46 to

url = baseurl + '/channels?part=id&id='+ user + '&key=' + my_key

and ran the program using

YOUTUBE_SERVER_API_KEY="<your_secret_key>" ./ytsubs.py <channel_id> <output RSS file>

and everything worked. You can find your channel id in Youtube Account Settings > Overview > Name > Advanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants