- Python 2.7
- requests
- lxml
#!/usr/bin/env python
# coding:utf-8
# params:
# key: keywords
# type: the type of result
# maxresults: the maximum number of items that should be returned in the result set
# num: number of you need
# region: region code , default is US
import youtube_api
youtube = youtube_api.YoutubeAPI('Your api key from Google Api Console')
data = youtube.search('vevo', 'channel', 50, 100, 'US')
print data
#!/usr/bin/env python
# coding:utf-8
# params:
# channel id
import youtube_api
youtube = youtube_api.YoutubeAPI('Your api key from Google Api Console')
data = youtube.get_playlistid_by_channelid('UC-9-kyTW8ZkZNDHQJ6FgpwQ')
print data
#!/usr/bin/env python
# coding:utf-8
# params:
# playlist id
import youtube_api
youtube = youtube_api.YoutubeAPI('Your api key from Google Api Console')
data = youtube.get_videoid_by_playlistid('PL976DE11BCA1AF15E')
print data
#!/usr/bin/env python
# coding:utf-8
# params:
# user's channel id
import youtube_api
youtube = youtube_api.YoutubeAPI('Your api key from Google Api Console')
data = youtube.get_useruploadsplaylist_by_userchannelid('UCANLZYMidaCbLQFWXBC95Jg')
print data
#!/usr/bin/env python
# coding:utf-8
# params:
# video id
import youtube_api
youtube = youtube_api.YoutubeAPI
data = youtube.get_channelid_by_videoid('8xg3vE8Ie_E')
print data
#!/usr/bin/env python
# coding:utf-8
# params:
# username
import youtube_api
youtube = youtube_api.YoutubeAPI
data = youtube.get_channelid_by_username('TaylorSwiftVEVO')
print data
#!/usr/bin/env python
# coding:utf-8
# params:
# channel id
import youtube_api
youtube = youtube_api.YoutubeAPI
data = youtube.verify_channel('UCANLZYMidaCbLQFWXBC95Jg')
print data