I'm trying to gather metadata from a youtube channel using python via youtube data api-v3.
I've managed to get data in json format but the texts like titles, descriptions, comments etc are in Korean language and they are shown as
ex : "title": "\ud55c \uc5ec\ub984\ubc24\uc758 \uafc8",
Is there a way to set encoding for specific feature/keys?
https://developers.google.com/youtube/v3/docs/i18nLanguages/list
The above seems to be the way to solve the problem, but I am new to api and I do not know how to apply it... can anyone give me an example or a link? so I can try myself?
or is there a way to decode back to original language? from the broken language output?
Thank you very much for your time.
I am working on a project for my MSc class and I have users that have declared songs they like in youtube, creating a large data-set. I have found a way to get the video id of a song by searching with you-tube-api, but it seems that the key they provide has an access limit. The code is bellow:
api_key = 'xxxxxxxx'
yt = YouTubeDataAPI(api_key)
searches = yt.search(q=song,
max_results=1)
yt.get_video_metadata_gen(searches[0]['video_id'])
Do you know any alternative way to do it without a limit?
I guess there should be an option to provide keys without limitations for research purposes or to universities, but I am not able to find sth like this.
I have been searching for the same on Youtube API Docs, but couldn't able to find out the same. It'll be very helpful if You guys can help me out, If that's possible.I want to find out is there any way we can find out how many views has a video per day. Like I want to know the most viewed videos today in Music Catergory. So I just want to know the most viewed videos by Genre per day.
This is the latest trending youtube video api call
Chart = select most popular
RegionCode = enter where do you want
GET https://www.googleapis.com/youtube/v3/videos?part=id%2Csnippet%2CcontentDetails&chart=mostPopular®ionCode=IN&key={YOUR_API_KEY}
I have some videos and I want to create closed-Captions(cc) for theme.
Two ways have come to my mind:
use some libraries like autosub to generate subtitles.(i try it!it's very inaccurate way and full of bad translations!)
upload each video to youtube and let it to generate cc for you.(it is a boring process and you have to upload each video one by one!)
I want an appropriate way to do it offline.like autosub.is it exists any Library or Api to use youtube translation mechanism?
Thanks.
I'd like to know how can I simply get the title or other information about a video using Youtube API, in case the only thing I know is the url of the video (so basically the video ID).
What other info can I get about a video? eg: Length, Category, Uploader name, Country of origin, ... ???
Can somebody provide me a usable code snippet and the library to use for this data collecting?
Thanks for the help in advance.
There are plenty of examples and documentation about what you can get using the YouTube API's Python bindings.
Here are Python code samples as provided by YouTube:
https://developers.google.com/youtube/v3/code_samples/python#create_and_manage_youtube_video_caption_tracks
And the code samples can also be downloaded from their GitHub repository:
https://github.com/youtube/api-samples/tree/master/python
Try below code:
payload = {'id': search_result["id"]["videoId"], 'part': 'contentDetails,statistics,snippet', 'key': DEVELOPER_KEY}
l = requests.Session().get('https://www.googleapis.com/youtube/v3/videos', params=payload)
resp_dict = json.loads(l.content)
print "Title: ",resp_dict['items'][0]['snippet']['title']
Try using this API: https://pypi.org/project/python-youtube/
To grab the title, you can do something like this:
from pyyoutube import Api
playlistVideoItems = api.get_playlist_items(playlist_id='PLOU2XLYxmsIKpaV8h0AGE05so0fAwwfTw').items
print(playlistVideoItems[0].snippet.title)
Note that the above is somewhat untested code. I copied the relevant bits and pieces from what I currently have, but I did not test this exact set lines of code. And of course, I'm not actually using that playlist ID for my purposes.
In regards to what other types of information can be gathered, I would recommend reading the documentation or running in a debugger. As of this writing, I am trying to figure out how to obtain the video uploader name, but I don't really need this data although it would be nice to have. I will update this answer if I figure it out.