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.71k stars 10.07k forks source link

[FaceBook] Can't play/download public videos any more #29490

Open sebma opened 3 years ago

sebma commented 3 years ago

Checklist

Verbose log

$ youtube-dl -v https://www.facebook.com/TBN/videos/joseph-princes-message-of-hope/170732560570149/
[debug] System config: []
[debug] User config: ['--ignore-errors', '--prefer-ffmpeg', '--no-warnings', '--restrict-filenames', '--add-metadata', '--write-auto-sub', '--embed-subs', '--sub-lang=en,fr,es,de', '--format=mp4[height<=480]/mp4/best', '--output=%(title)s__%(format_id)s__%(id)s__%(extractor)s.%(ext)s']
[debug] Custom config: []
[debug] Command-line args: ['-v', 'https://www.facebook.com/TBN/videos/joseph-princes-message-of-hope/170732560570149/']
[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.8.10 (CPython) - Linux-5.4.0-77-generic-x86_64-with-glibc2.29
[debug] exe versions: ffmpeg 4.2.4, ffprobe 4.2.4, rtmpdump 2.4
[debug] Proxy map: {}
[facebook] 170732560570149: Downloading webpage
ERROR: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/youtube_dl/YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/youtube_dl/YoutubeDL.py", line 836, in __extract_info
    ie_result = ie.extract(url)
  File "/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/facebook.py", line 680, in _real_extract
    return self._extract_from_url(real_url, video_id)
  File "/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/facebook.py", line 528, in _extract_from_url
    self.raise_login_required()
  File "/usr/local/lib/python3.8/dist-packages/youtube_dl/extractor/common.py", line 941, in raise_login_required
    raise ExtractorError(
youtube_dl.utils.ExtractorError: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials.

Description

Can't play/download public videos anymore, youtube-dl says ERROR: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials. :

$ mpv --no-config --ytdl-raw-options='abort-on-error=' https://www.facebook.com/TBN/videos/joseph-princes-message-of-hope/170732560570149
[ytdl_hook] ERROR: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials. 
[ytdl_hook] youtube-dl failed: unexpected error ocurred 
Failed to recognize file format.

Exiting... (Errors when loading file)
hongxiongmm commented 3 years ago

I ran into the same problem

8chanAnon commented 3 years ago

The following HTML snippet contains the video link and it works without any encumbrance:

"og:video" content="https://video-yyz1-1.xx.fbcdn.net/v/t42.9040-2/...

Full decode:

https://video-yyz1-1.xx.fbcdn.net/v/t42.9040-2/90939672_678125989394972_8955538103909482496_n.mp4?_nc_cat=105&ccb=1-3&_nc_sid=985c63&efg=eyJybHIiOjQ1NywicmxhIjo1MTIsInZlbmNvZGVfdGFnIjoic3ZlX3NkIn0%3D&_nc_ohc=rP3uBcv0uFAAX8L4Y8n&rl=457&vabr=254&_nc_ht=video-yyz1-1.xx&oh=31571d5d7536cd33e917c90cd9d029d6&oe=60F20556

To view the page source in your browser:

view-source:https://www.facebook.com/TBN/videos/joseph-princes-message-of-hope/170732560570149

sebma commented 3 years ago

@8chanAnon You should try to download more 5 or 6 videos on facebook, that's when the limitation occurs.

Here, I just tried to play with mpv/youtube-dl the same video multiple times, on the last time, the error pops up :

$ mpv --profile=sd https://www.facebook.com/TBN/videos/joseph-princes-message-of-hope/170732560570149
Can't load unknown script: /home/sebastien/.config/mpv/scripts/luadoc.css
[auto_profiles] Applying profile seb-C70D-B-311 
 (+) Video --vid=1 (*) (h264 256x256 29.970fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
File tags:
 Title: 170732550570150
mesa: for the --simplifycfg-sink-common option: may only occur zero or one times!
mesa: for the --global-isel-abort option: may only occur zero or one times!
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
mesa: for the --structurizecfg-skip-uniform-regions option: may only occur zero or one times!
[lavf] Edit lists are not correctly supported (FFmpeg issue).
[lavf] Edit lists are not correctly supported (FFmpeg issue).
Using hardware decoding (vaapi).
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 256x256 vaapi[nv12]
AV: 00:00:00 / 00:00:59 (0%) A-V:  0.000 Cache: 59s/2MB
Saving state.

Exiting... (Quit)
$ mpv --profile=sd https://www.facebook.com/TBN/videos/joseph-princes-message-of-hope/170732560570149
Can't load unknown script: /home/sebastien/.config/mpv/scripts/luadoc.css
[auto_profiles] Applying profile seb-C70D-B-311 
Resuming playback. This behavior can be disabled with --no-resume-playback.
 (+) Video --vid=1 (*) (h264 256x256 29.970fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
File tags:
 Title: 170732550570150
mesa: for the --simplifycfg-sink-common option: may only occur zero or one times!
mesa: for the --global-isel-abort option: may only occur zero or one times!
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
mesa: for the --structurizecfg-skip-uniform-regions option: may only occur zero or one times!
[lavf] Edit lists are not correctly supported (FFmpeg issue).
[lavf] Edit lists are not correctly supported (FFmpeg issue).
Using hardware decoding (vaapi).
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 256x256 vaapi[nv12]
AV: 00:00:01 / 00:00:59 (1%) A-V:  0.000 Cache: 58s/2MB
Saving state.

Exiting... (Quit)
$ mpv --profile=sd https://www.facebook.com/TBN/videos/joseph-princes-message-of-hope/170732560570149
Can't load unknown script: /home/sebastien/.config/mpv/scripts/luadoc.css
[auto_profiles] Applying profile seb-C70D-B-311 
Resuming playback. This behavior can be disabled with --no-resume-playback.
 (+) Video --vid=1 (*) (h264 256x256 29.970fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
File tags:
 Title: 170732550570150
mesa: for the --simplifycfg-sink-common option: may only occur zero or one times!
mesa: for the --global-isel-abort option: may only occur zero or one times!
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
mesa: for the --structurizecfg-skip-uniform-regions option: may only occur zero or one times!
[lavf] Edit lists are not correctly supported (FFmpeg issue).
[lavf] Edit lists are not correctly supported (FFmpeg issue).
Using hardware decoding (vaapi).
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 256x256 vaapi[nv12]
AV: 00:00:02 / 00:00:59 (3%) A-V: -0.004 Cache: 57s/2MB
Saving state.

Exiting... (Quit)
$ mpv --profile=sd https://www.facebook.com/TBN/videos/joseph-princes-message-of-hope/170732560570149
Can't load unknown script: /home/sebastien/.config/mpv/scripts/luadoc.css
[auto_profiles] Applying profile seb-C70D-B-311 
Resuming playback. This behavior can be disabled with --no-resume-playback.
 (+) Video --vid=1 (*) (h264 256x256 29.970fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
File tags:
 Title: 170732550570150
mesa: for the --simplifycfg-sink-common option: may only occur zero or one times!
mesa: for the --global-isel-abort option: may only occur zero or one times!
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
mesa: for the --structurizecfg-skip-uniform-regions option: may only occur zero or one times!
[lavf] Edit lists are not correctly supported (FFmpeg issue).
[lavf] Edit lists are not correctly supported (FFmpeg issue).
Using hardware decoding (vaapi).
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 256x256 vaapi[nv12]
AV: 00:00:02 / 00:00:59 (4%) A-V:  0.000 Cache: 56s/2MB
Saving state.

Exiting... (Quit)
$ mpv --profile=sd https://www.facebook.com/TBN/videos/joseph-princes-message-of-hope/170732560570149
Can't load unknown script: /home/sebastien/.config/mpv/scripts/luadoc.css
[auto_profiles] Applying profile seb-C70D-B-311 
Resuming playback. This behavior can be disabled with --no-resume-playback.
 (+) Video --vid=1 (*) (h264 256x256 29.970fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
File tags:
 Title: 170732550570150
mesa: for the --simplifycfg-sink-common option: may only occur zero or one times!
mesa: for the --global-isel-abort option: may only occur zero or one times!
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
mesa: for the --structurizecfg-skip-uniform-regions option: may only occur zero or one times!
[lavf] Edit lists are not correctly supported (FFmpeg issue).
[lavf] Edit lists are not correctly supported (FFmpeg issue).
Using hardware decoding (vaapi).
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 256x256 vaapi[nv12]
AV: 00:00:03 / 00:00:59 (6%) A-V:  0.000 Cache: 55s/2MB
Saving state.

Exiting... (Quit)
$ mpv --profile=sd https://www.facebook.com/TBN/videos/joseph-princes-message-of-hope/170732560570149
Can't load unknown script: /home/sebastien/.config/mpv/scripts/luadoc.css
[auto_profiles] Applying profile seb-C70D-B-311 
Resuming playback. This behavior can be disabled with --no-resume-playback.
[ytdl_hook] ERROR: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials. 
[ytdl_hook] youtube-dl failed: unexpected error ocurred 
Failed to recognize file format.

Exiting... (Errors when loading file)
tomy137 commented 3 years ago

I'm thinking that I'm facing the same problem. Seems that Facebook is someway detecting the parsing. After facing the error I can't parse any page even with simple request.

Facebook is returning this error message, maybe this will help someone :

request = requests.get(video_url)
soup = BeautifulSoup(request.text, 'html.parser')
print( soup.find(id="content").div.div.get_text(" - ") )
--> You’re Temporarily Blocked - It looks like you were misusing this feature by going too fast. You’ve been temporarily blocked from using it.

Do you have the sale behaviour ?

Don't find any solution at this time.

zellchristensen commented 3 years ago

Same issue here. I was using an older version of youtube-dl initially and it was working fine but then started requiring login. When passing my cookie it started working again but then eventually stopped being able to parse the page entirely, even on pages that previously worked. I updated youtube-dl and still have the same issue. The actual URL plays fine in browser without logging in. I tried passing the same user agent as my browser with no luck.

C:\youtubeDL>youtube-dl https://www.facebook.com/SenatorBobHall/videos/2876472109306619
[facebook] 2876472109306619: Downloading webpage
ERROR: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials.

C:\youtubeDL>youtube-dl https://www.facebook.com/SenatorBobHall/videos/2876472109306619 --cookies fbcookie.txt
[facebook] 2876472109306619: Downloading webpage
[facebook] 2876472109306619: Downloading webpage
ERROR: Cannot parse data; 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.

C:\youtubeDL>youtube-dl -U
youtube-dl is up-to-date (2021.06.06)

C:\youtubeDL>youtube-dl https://www.facebook.com/SenatorBobHall/videos/2876472109306619 --cookies fbcookie.txt --verbose
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['https://www.facebook.com/SenatorBobHall/videos/2876472109306619', '--cookies', 'fbcookie.txt', '--verbose']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.4.4 (CPython) - Windows-7-6.1.7601-SP1
[debug] exe versions: avconv v11.7, avprobe v11.7, ffmpeg 4.3.1, ffprobe 4.3.1, phantomjs 2.1.1
[debug] Proxy map: {}
[facebook] 2876472109306619: Downloading webpage
[facebook] 2876472109306619: Downloading webpage
ERROR: Cannot parse data; 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 "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\YoutubeDL.py", line 815, in wrapper
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\YoutubeDL.py", line 836, in __extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\extractor\common.py", line 534, in extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\extractor\facebook.py", line 680, in _real_extract
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpkqxnwl31\build\youtube_dl\extractor\facebook.py", line 594, in _extract_from_url
youtube_dl.utils.ExtractorError: Cannot parse data; 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 yout
ube-dl with the --verbose flag and include its complete output.

C:\youtubeDL>
baganaakh commented 3 years ago

Facebook is blocking it. After youtube-dl attempt my Facebook got

Login Approval Needed We noticed a login from a browser, device or location you don't usually use. We need to confirm it was you before you can get back on Facebook

wesgarland commented 2 years ago

Same issue here. I may have annoyed facebook by getting my password wrong a few times.

[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--username=PRIVATE', u'--password=PRIVATE', u'https://www.facebook.com/jan.baldwin2/videos/447216143994989', u'--verbose']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Python version 2.7.17 (CPython) - Linux-5.4.0-110-generic-x86_64-with-Ubuntu-18.04-bionic
[debug] exe versions: ffmpeg 3.4.8, ffprobe 3.4.8, phantomjs ., rtmpdump 2.4
[debug] Proxy map: {}
[facebook] Downloading login page
[facebook] Logging in
[facebook] 447216143994989: Downloading webpage
[facebook] 447216143994989: Downloading webpage
ERROR: Cannot parse data; 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 "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 836, in __extract_info
    ie_result = ie.extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/facebook.py", line 680, in _real_extract
    return self._extract_from_url(real_url, video_id)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/facebook.py", line 594, in _extract_from_url
    raise ExtractorError('Cannot parse data')
ExtractorError: Cannot parse data; 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.
hyperlogos commented 1 year ago

same same

$ youtube-dl --verbose --username --password '' https://www.facebook.com/watch/?v=727918515648853 [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: [u'--verbose', u'--username', u'PRIVATE', u'--password', u'PRIVATE', u'https://www.facebook.com/watch/?v=727918515648853'] [debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2021.12.17 [debug] Python version 2.7.18 (CPython) - Linux-5.10.0-21-amd64-x86_64-with-debian-11.1 [debug] exe versions: ffmpeg 4.3.5-0, ffprobe 4.3.5-0, rtmpdump 2.4 [debug] Proxy map: {} [facebook] Downloading login page [facebook] Logging in [facebook] 727918515648853: Downloading webpage ERROR: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials. Traceback (most recent call last): File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 815, in wrapper return func(self, *args, **kwargs) File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 836, in __extract_info ie_result = ie.extract(url) File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 534, in extract ie_result = self._real_extract(url) File "/usr/local/bin/youtube-dl/youtube_dl/extractor/facebook.py", line 680, in _real_extract return self._extract_from_url(real_url, video_id) File "/usr/local/bin/youtube-dl/youtube_dl/extractor/facebook.py", line 528, in _extract_from_url self.raise_login_required() File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 943, in raise_login_required expected=True) ExtractorError: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials.

kartagis commented 1 year ago

Same issue, happens even though I pass --username and --password or --netrc.

youtube-dl --netrc https://www.facebook.com/watch/\?v\=408245896530556\&__cft__\[0\]\=AZVTGxvth5edY7qfFODI30Mmy4y239YXm9p1eV3WDiWKQKPdt5NH5EJvLS08DmqnlIpMNQd0kWWhxfTNsoA8-brmDwV6gDRqGpLP6lp2iEr0z0DmAVzxRq3xT3_-ev1MHMjETm6EgUQPfKUOwGkvhXFsnctSts9cwiKusHHj1aJzHxQyfsIfG4ASLkHrSlDv5JFdcP1dxAD9li-KM3ADb_pOCmjJfLZNbhprq6BxHy7g4w\&__tn__\=%2CO%2CP-y-R -v
[debug] System config: []
[debug] User config: ['-o', '~/Movies/%(title)s.%(ext)s']
[debug] Custom config: []
[debug] Command-line args: ['--netrc', 'https://www.facebook.com/watch/?v=408245896530556&__cft__[0]=AZVTGxvth5edY7qfFODI30Mmy4y239YXm9p1eV3WDiWKQKPdt5NH5EJvLS08DmqnlIpMNQd0kWWhxfTNsoA8-brmDwV6gDRqGpLP6lp2iEr0z0DmAVzxRq3xT3_-ev1MHMjETm6EgUQPfKUOwGkvhXFsnctSts9cwiKusHHj1aJzHxQyfsIfG4ASLkHrSlDv5JFdcP1dxAD9li-KM3ADb_pOCmjJfLZNbhprq6BxHy7g4w&__tn__=%2CO%2CP-y-R', '-v']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Git HEAD: 0c1031f2f
[debug] Python version 3.11.2 (CPython) - macOS-13.1-arm64-arm-64bit
[debug] exe versions: ffmpeg 5.1.2, ffprobe 5.1.2, rtmpdump 2.4
[debug] Proxy map: {}
[facebook] Downloading login page
[facebook] Logging in
[facebook] 408245896530556: Downloading webpage
ERROR: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials.
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.11/site-packages/youtube_dl/YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.11/site-packages/youtube_dl/YoutubeDL.py", line 836, in __extract_info
    ie_result = ie.extract(url)
                ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.11/site-packages/youtube_dl/extractor/common.py", line 534, in extract
    ie_result = self._real_extract(url)
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.11/site-packages/youtube_dl/extractor/facebook.py", line 680, in _real_extract
    return self._extract_from_url(real_url, video_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.11/site-packages/youtube_dl/extractor/facebook.py", line 528, in _extract_from_url
    self.raise_login_required()
  File "/opt/homebrew/Cellar/youtube-dl/2021.12.17/libexec/lib/python3.11/site-packages/youtube_dl/extractor/common.py", line 941, in raise_login_required
    raise ExtractorError(
youtube_dl.utils.ExtractorError: This video is only available for registered users. Use --username and --password or --netrc to provide account credentials.
dirkf commented 1 year ago

Those won't work. Use --cookies ... according to the Manual. The current FB login procedure, as is typical, can't be run from yt-dl.

kartagis commented 1 year ago

Then, why are they still in the —help? Weird, huh?

El El sáb, 18 mar 2023 a las 23:27, dirkf @.***> escribió:

Those won't work. Use --cookies ... according to the Manual.

— Reply to this email directly, view it on GitHub https://github.com/ytdl-org/youtube-dl/issues/29490#issuecomment-1474984376, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMIOXQLVYFMPY7PZT5IXRDW4YLBJANCNFSM476J4CUA . You are receiving this because you commented.Message ID: @.***>

-- Tolga

dirkf commented 1 year ago

It depends on the site. However, it is typical now that login procedures can't easily be invoked by yt-dl, because of 2FA, Captcha, etc, and also because sites change their login pages too quickly for anyone to maintain a login procedure, even if someone manages to code one that works for some site.

Whereas using fresh cookies almost always continues to work.