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
132.32k stars 10.03k forks source link

unable to extract facebook video in private group, user with two-factor auth #4785

Open jakutis opened 9 years ago

jakutis commented 9 years ago
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['https://www.facebook.com/video.php?v=PRIVATE', '--username', u'PRIVATE', '--password', u'PRIVATE', '--twofactor', 'PRIVATE', '--verbose']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.01.25
[debug] Python version 2.7.8 - Linux-3.18.2-2-ARCH-x86_64-with-glibc2.2.5
[debug] exe versions: ffmpeg 2.5.2, ffprobe 2.5.2, rtmpdump 2.4
[debug] Proxy map: {}
[facebook] Downloading login page
[facebook] Logging in
ERROR: Unable to extract h; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "/home/jakutis/.bin/youtube-dl/youtube_dl/YoutubeDL.py", line 613, in extract_info
    ie_result = ie.extract(url)
  File "/home/jakutis/.bin/youtube-dl/youtube_dl/extractor/common.py", line 265, in extract
    self.initialize()
  File "/home/jakutis/.bin/youtube-dl/youtube_dl/extractor/common.py", line 260, in initialize
    self._real_initialize()
  File "/home/jakutis/.bin/youtube-dl/youtube_dl/extractor/facebook.py", line 107, in _real_initialize
    self._login()
  File "/home/jakutis/.bin/youtube-dl/youtube_dl/extractor/facebook.py", line 93, in _login
    r'name="h"\s+(?:\w+="[^"]+"\s+)*?value="([^"]+)"', login_results, 'h'),
  File "/home/jakutis/.bin/youtube-dl/youtube_dl/extractor/common.py", line 522, in _search_regex
    raise RegexNotFoundError('Unable to extract %s' % _name)
RegexNotFoundError: Unable to extract h; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
mcepl commented 9 years ago

Isn't this in fact duplicate of https://github.com/rg3/youtube-dl/issues/1084 ?

jakutis commented 9 years ago

I don't know but maybe not, because my

[debug] Command-line args: ['https://www.facebook.com/video.php?v=PRIVATE', '--username', u'PRIVATE', '--password', u'PRIVATE', '--twofactor', 'PRIVATE', '--verbose']

is different from his

[debug] Command-line args: ['--verbose', 'https://www.facebook.com/photo.php?v=10151799802758653']

Also I end up with

RegexNotFoundError: Unable to extract h; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

And he ends up with

ExtractorError: Cannot parse data; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output.
jaimeMF commented 9 years ago

The facebook extractor doesn't have support for twofactor authentication, it only supports login via username and password (which I guess it doesn't work if you have twofactor-auth enabled).

jakutis commented 9 years ago

Okey, then this should be labeled as a feature request.

git-commit commented 7 years ago

A workaround is using the --cookies option with your facebook cookie

jackfuchs commented 6 years ago

Still not implemented right?

nathany commented 5 years ago

The cookies.txt Chrome extension made it fairly easy.

jakutis commented 5 years ago

Thanks @git-commit and @nathany - just tried this and it is very easy!

keybounce commented 3 years ago

Alright, I came here with a "cannot extract LSD" error on facebook. This is supposed to be a duplicate, but I don't see anything here about LSD.

I am specifying a cookie file, but facebook is still not working.

Full details: [debug] System config: [] [debug] User config: ['-k', '--hls-prefer-native', '--abort-on-unavailable-fragment', '-o', 's%(season_number)02de%(episode_number)02d - %(title)s.%(ext)s', '-f', '\nbest[ext=mp4][height=720]/\nbest[ext=mp4][height>570][height<=720]/\nbest[ext=mp4][height>431][height<=570]/\nbestvideo[ext=mp4][height=480]+bestaudio[ext=m4a]/\nbest[ext=mp4][height>340][height<=431]/\nbestvideo[ext=mp4][height>360][height<=576]+bestaudio/\nbest[height>340][height<=576]/\nbestvideo[height>360][height<=576]+bestaudio/\nbestvideo[height=360]+bestaudio/\nbest[ext=mp4][height>=280][height<=360]/\nbest[height<=576]/\nworst', '--write-sub', '--write-auto-sub', '--sub-lang', 'en,enUS,en-us', '--sub-format', 'ass/srt/best', '--convert-subs', 'ass', '--embed-subs', '--mark-watched', '--download-archive', 'downloaded-videos.txt'] [debug] Custom config: [] [debug] Command-line args: ['-F', 'https://www.facebook.com/chris.mmh/videos/4053598501388206', '--username', 'PRIVATE', '--password', 'PRIVATE', '--cookies', '/Users/michael/tmp/facebook-cookies', '-v'] [debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2021.06.06 [debug] Python version 3.6.12 (CPython) - Darwin-13.4.0-x86_64-i386-64bit [debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1, rtmpdump 2.4 [debug] Proxy map: {} [facebook] Downloading login page ERROR: Unable to extract lsd; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output. Traceback (most recent call last): File "/Users/michael/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 815, in wrapper return func(self, *args, **kwargs) File "/Users/michael/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 836, in __extract_info ie_result = ie.extract(url) File "/Users/michael/bin/youtube-dl/youtube_dl/extractor/common.py", line 533, in extract self.initialize() File "/Users/michael/bin/youtube-dl/youtube_dl/extractor/common.py", line 437, in initialize self._real_initialize() File "/Users/michael/bin/youtube-dl/youtube_dl/extractor/facebook.py", line 378, in _real_initialize self._login() File "/Users/michael/bin/youtube-dl/youtube_dl/extractor/facebook.py", line 326, in _login login_page, 'lsd') File "/Users/michael/bin/youtube-dl/youtube_dl/extractor/common.py", line 1012, in _search_regex raise RegexNotFoundError('Unable to extract %s' % _name) youtube_dl.utils.RegexNotFoundError: Unable to extract lsd; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

I have already told facebook that this is an approved login (annoying that facebook requires me to change my password each time this happens. Yes, I updated the password, and I provided the same cookie file on both calls. And yes, the cookie file looks sane, even if that "checkpoint" cookie is ginormous.)