question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Broken]Facebook private (friends only and private groups) error handling response is broken

See original GitHub issue

Checklist

  • I’m reporting a broken site support
  • I’ve verified that I’m running youtube-dlc version 2020.10.26
  • I’ve checked that all provided URLs are alive and playable in a browser
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched the bugtracker for similar issues including closed ones

Verbose log

./testdlc -v -F https://www.facebook.com/100002659934141/videos/3355692847862680/
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-F', u'https://www.facebook.com/100002659934141/videos/3355692847862680/']
[debug] Loading archive file None
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dlc version 2020.10.25
[debug] Python version 2.7.16 (CPython) - Darwin-19.6.0-x86_64-i386-64bit
[debug] exe versions: none
[debug] Proxy map: {}
[facebook] 3355692847862680: Downloading webpage
[facebook] 3355692847862680: Downloading webpage
[facebook] 3355692847862680: 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-dlc -U  to update. Be sure to call youtube-dlc with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "./testdlc/youtube_dlc/YoutubeDL.py", line 830, in extract_info
    ie_result = ie.extract(url)
  File "./testdlc/youtube_dlc/extractor/common.py", line 532, in extract
    ie_result = self._real_extract(url)
  File "./testdlc/youtube_dlc/extractor/facebook.py", line 484, in _real_extract
    video_id, fatal_if_no_video=True)
  File "./testdlc/youtube_dlc/extractor/facebook.py", line 380, 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-dlc -U  to update. Be sure to call youtube-dlc with the --verbose flag and include its complete output.

Description

Private videos used to work fine until lately. I assume the server response from FB changed or something. As a result, ytdlc does not how to handle it and ask for cookies or login, for example.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ssaquacommented, Nov 8, 2020

Hey @someziggyman and FYI @blackjack4494

I was able to resolve this issue by changing one regex. I was considering making a pull request but I don’t really know how this change affects the rest of the extractor and other types of videos on FB.

Here’s a test link, in case needed for private group video: https://www.facebook.com/1051184515/videos/10220691460290341/

Could you test if this change works for your case?

Find this section in extractor/facebook.py#L366 and replace the regex for the fb_dtsg param. Should also supply credentials or use a cookie header of course.

            # Video info not in first request, do a secondary request using
            # tahoe player specific URL
            tahoe_data = self._download_webpage(
                self._VIDEO_PAGE_TAHOE_TEMPLATE % video_id, video_id,
                data=urlencode_postdata({
                    '__a': 1,
                    '__pc': self._search_regex(
                        r'pkg_cohort["\']\s*:\s*["\'](.+?)["\']', webpage,
                        'pkg cohort', default='PHASED:DEFAULT'),
                    '__rev': self._search_regex(
                        r'client_revision["\']\s*:\s*(\d+),', webpage,
                        'client revision', default='3944515'),
                    'fb_dtsg': self._search_regex(
-                       r'"DTSGInitialData"\s*,\s*\[\]\s*,\s*{\s*"token"\s*:\s*"([^"]+)"',
+                       r'"MRequestConfig"\s*,\s*\[\]\s*,\s*{\s*"dtsg"\s*:\s*{\s*"token"\s*:\s*"([^"]+)"',
                        webpage, 'dtsg token', default=''),
                }),
                headers={
                    'Content-Type': 'application/x-www-form-urlencoded',
                })
0reactions
vctlscommented, Nov 20, 2020

Than tried this Workaround ytdl-org/youtube-dl#27062 (comment) “youtube-dl --force-generic-extractor [link] and worked just fine.”

@rgime on what endpoints does that work? What do your URLs look like? Is it something like that? https://www.facebook.com/<user_ID>/videos/<video_ID> Or like this? https://www.facebook.com/groups/<group_IP>/permalink/<post_ID>/

Is it really private? Does it ask for authentication at all? What version are you using?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Report That Something Isn't Working on Facebook.
This process is for reporting something on Facebook that isn't working correctly, like a broken feature or a payment issue. You can also...
Read more >
11 Common Facebook Problems and Errors (And How to Fix ...
1. Mute Excessive Posters on Facebook · 2. Keep Important Friends First · 3. Opt Out of Targeted Ads on Facebook · 4....
Read more >
Facebook to penalize rule-breaking Groups' members by ...
Specifically, Facebook says it will begin to demote all Groups content from members who have broken Facebook's Community Standards anywhere ...
Read more >
Why Facebook LInks for Groups Don't Work for Use Sessions
[This thread is closed.] ... posting to Groups the Facebook links do not work and the error message “This ... Viewing 2 replies...
Read more >
Everything You Need to Know About Secret Facebook Groups ...
A Secret Facebook group is a private group which is not accessible to ... Joining a secret / hidden Facebook group is by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found