ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.72k stars 9.97k forks source link

youtube-dl -g for twitter videos gives link to m3u8 file #10668

Closed vaibhav1312 closed 8 years ago

vaibhav1312 commented 8 years ago

Please follow the guide below


Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2016.09.15. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.


The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add -v flag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

$ youtube-dl -v -g 'https://twitter.com/YesIamSaffron/status/776475475858173954'
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'-g', u'https://twitter.com/TrollKejri/status/776307587314614272']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.08.10
[debug] Python version 2.7.10 - Darwin-15.4.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 3.0, ffprobe 3.0
[debug] Proxy map: {}
https://video.twimg.com/amplify_video/776444641944010752/pl/640x360/KDt2ddRttDFduxGV.m3u8
<end of log>

If the purpose of this issue is a site support request please provide all kinds of example URLs support for which should be included (replace following example URLs by yours):


Description of your issue, suggested solution and other information

Earlier it used to extract the link to the mp4 file, now it just gives link to m3u8 file.

dstftw commented 8 years ago

It gives you a link to whatever is served by twitter.

vaibhav1312 commented 8 years ago

But the m3u8 format does not play in the media player, and also there is a link to the mp4/video file "https://video.twimg.com/amplify_video/776444641944010752/vid/640x360/CRxt59VOd4NPVnMi.mp4"

So which means it mp4 format can be extracted from twitter, and also m3u8 is not a video format.

Any help would be great. Thanks

dstftw commented 8 years ago

No mp4 for me in browser.

vaibhav1312 commented 8 years ago

If there was a link to mp4 file in html code of tweet, I would have extracted it already. Its just the link can be accessed from api, and there must be some other way to get it.

yan12125 commented 8 years ago

The mp4 link is available with User-Agent: Mozilla/5.0 (Android 4.4; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0.

But the m3u8 format does not play in the media player

Which player are you using? Both VLC and mpv works for me.

vaibhav1312 commented 8 years ago

Can you just post the command with the user agent, which gives the mp4 link.

I tried this command youtube-dl -v -g --user-agent 'Mozilla/5.0 (Android 4.4; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0.' 'https://twitter.com/YesIamSaffron/status/776475475858173954' But its not working.

I want to give user the mp4 link, so that he/she can download the video. Thanks

yan12125 commented 8 years ago

It requires writing new codes.

vaibhav1312 commented 8 years ago

It throws this error

File "/Users/vaibhav/git_projects/downloadenv/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 694, in extract_info ie_result = ie.extract(url) File "/Users/vaibhav/git_projects/downloadenv/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 347, in extract return self._real_extract(url) File "/Users/vaibhav/git_projects/downloadenv/lib/python2.7/site-packages/youtube_dl/extractor/twitter.py", line 294, in _real_extract username = remove_end(self._og_search_title(webpage), ' on Twitter') File "/Users/vaibhav/git_projects/downloadenv/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 762, in _og_search_title return self._og_search_property('title', html, **kargs) File "/Users/vaibhav/git_projects/downloadenv/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 750, in _og_search_property escaped = self._search_regex(og_regexes, html, name, flags=re.DOTALL, **kargs) File "/Users/vaibhav/git_projects/downloadenv/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 650, in _search_regex raise RegexNotFoundError('Unable to extract %s' % _name) RegexNotFoundError: Unable to extract OpenGraph title; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Of if you can point me to the direction of solution, that would be very helpful of you. Thank you

yan12125 commented 8 years ago

Just changing the User-Agent does not work. You need to modify youtube_dl/extractor/twitter.py.

By the way, most media players I know support m3u8 URLs. Or do you want to support something like Windows Media Player?

vaibhav1312 commented 8 years ago

I'm making a downloader for twitter, where user will enter the tweet url & youtube-dl will extract the mp4 link of the video file and give it to the user, so user can download directly from the twitter CDN.

Earlier youtube-dl was able to extract mp4 links, but i think twitter made some changes in its code.