Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
youtube subtitle doesn't work #5049
Comments
|
You'll have to add the import youtube_dl
def getdata(url):
with youtube_dl.YoutubeDL({'outtmpl': '%(id)s%(ext)s', 'writesubtitles': True}) as ydl:
result = ydl.extract_info(url, download=False)
url = result['url']
title = result['title']
thumbnail = result.get('thumbnail')
#print('url: %r, title: %r, thumbnail: %r' % (url, title, thumbnail))
# writecvs(url, title, tags)
print result
print "-------------------------------------"
print result.get('subtitles')
getdata('https://www.youtube.com/watch?v=I4jqq4Tml1s')Youtube subtitles info is only extracted with that option because it requires an additional request, so it will take some more time to complete the extraction. |
|
thanks a lot, sorry |
subtitles item in dict is always as none with python api
My code :
!/usr/bin/env python
-- coding: utf-8 --
import youtube_dl
def getdata(url):
with youtube_dl.YoutubeDL({'outtmpl': '%(id)s%(ext)s'}) as ydl:
result = ydl.extract_info(url, download=False)
url = result['url']
title = result['title']
thumbnail = result.get('thumbnail')
#print('url: %r, title: %r, thumbnail: %r' % (url, title, thumbnail))
# writecvs(url, title, tags)
print result
print "-------------------------------------"
print result.get('subtitles')
getdata('https://www.youtube.com/watch?v=I4jqq4Tml1s')
I have try video with auto-subtitle and real subtitle