Skip to content

Latest commit

 

History

History
117 lines (93 loc) · 4.2 KB

README.md

File metadata and controls

117 lines (93 loc) · 4.2 KB

Youtube v3 API module for Python 3.5

Requires :

- Python 3.5.2 - requests 2.12 - Youtube APIKey that can be obtained with your google account in the developer console

Install :

Download the wheel file from the 'dist' folder and launch virtual env in command prompt and enter :
>>pip install c:\path\to\wheel\file\YoutubeV3API-0.1.1-py3-none-any.whl

Quick usage :

from youtube_v3api import youtube

#Retrieves a channel information based on the channelid, returns -> model.Channel object

mychannel = Channel()
mychannel = youtube.get_channel(channelid , APIKey)

'''Retrieves videos information (exclusive video stats for each Video, is faster than with stats) 
based on a channelid returns -> collection of model.Video elements
by default the youtube query response is ordered by viewCount.
OrderBy valid values : viewCount, title, rating, date '''

videoElements = []
videoElements = youtube.get_videos_without_stats(channelid , APIKey , maxResult = 5 , orderBy = 'viewCount')

'''Retrieves videos information (inclusive video stats for each Video, this generates extra queries) 
based on a channelid returns -> collection of model.Video elements
by default the youtube query response is ordered by viewCount. 
OrderBy valid values : viewCount, title, rating, date '''

videoElements = []
videoElements = youtube.get_videos_with_stats(channelid , APIKey ,  maxResult = 5  , orderBy = 'viewCount')

'''retrieves channel info based on keywords 
(keywords format=string, inclusive ex: 'key1|key2|key_n' exclusive ex: ' -key1 -key2'
by default the youtube query response is ordered by viewCount.
OrderBy valid values : viewCount, title, rating, date, videoCount
Maxresult is maximum 50
returns -> collection of model.Channel objects'''

channelElements = []
channelElements = youtube.search_channels_on_keywords(keywords , APIKey, maxResults = 10 , orderBy = 'viewCount')

'''retrieves channel info based on keywords 
(keywords format=string, ex: 'key1|key2|key_n' exclusive ex: ' -key1 -key2'
by default the youtube query response is ordered by viewCount. 
OrderBy valid values : viewCount, title, rating, date
Maxresult is maximum 50
returns -> collection of model.Channel objects'''

videoElements = []
videoElements = youtube.search_videos_on_keywords(keywords , APIKey , maxResults = 10 , orderBy = 'viewCount')

Objects reference

</tr>
Video
channelidThe youtube ID of the channel
idThe youtube ID of the video
pubdateVideo publishing date
titleTitle of the video
descDescription of the video
thumb_defaultThe video default thumbnail image link
thumb_mediumMedium size thumbnail link
thumb_highHigh size thumbnail link
channeltitleThe channel title
statsA dictionary containing the video statistics
Keys { 'views':0 , 'likes':0 , 'dislikes':0 , 'comments':0 }
Channel
idThe youtube channel id
titleChannel name
descChannel description
pubdateCreation date
thumb_defaultThe channel logo
thumb_mediumChannel medium size banner
thumb_highChannel high size banner
statsChannel statistics dictionary
{'views':0,'comments':0,'subs':0,'videos':0}
videosList of model.Video objects