Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook Pages videos are only downloaded in SD quality, but on FB page HD is available #9720

Closed
9 of 11 tasks
elpresti opened this issue Apr 19, 2024 · 6 comments · Fixed by #9734
Closed
9 of 11 tasks
Labels
patch-available There is patch available that should fix this issue. Someone needs to make a PR with it site-bug Issue with a specific website

Comments

@elpresti
Copy link

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I intentionally remove or skip any mandatory* field

Checklist

Region

Worldwide, it's a public Facebook Page

Provide a description that is worded well enough to be understood

Hello, I'm experiencing an issue since some days ago, while trying to download a video from Facebook. The quality downloaded is 360, but the best available should be 720 (you can verify it from the Facebook Video Player). So I ran the "--print formats_table" in order to verify which quality alternatives is yt-dlp seeing for this video, and then I realize that it is only one SD alternative (which surely is the 360p previously downloaded), and the 720p alternative is not shown on the table.
Example: yt-dlp.exe -vU --print formats_table https://facebook.com/475841587884690/videos/744372871141776

Is this a bug from yt-dlp that will get fixed soon?
Thanks in advance.
Regards

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • If using API, add 'verbose': True to YoutubeDL params instead
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

yt-dlp.exe -vU --print formats_table https://facebook.com/475841587884690/videos/744372871141776

[debug] Command-line config: ['-vU', '--print', 'formats_table', 'https://facebook.com/475841587884690/videos/744372871141776']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.04.18.232703 from yt-dlp/yt-dlp-nightly-builds [c9ce57d9b] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: none
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.02.02, curl_cffi-0.5.10, mutagen-1.47.0, requests-2.31.0, sqlite3-3.35.5, urllib3-2.2.1, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
[debug] Loaded 1810 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.04.18.232703 from yt-dlp/yt-dlp-nightly-builds
yt-dlp is up to date (nightly@2024.04.18.232703 from yt-dlp/yt-dlp-nightly-builds)
[facebook] Extracting URL: https://facebook.com/475841587884690/videos/744372871141776
[facebook] 744372871141776: Downloading webpage
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 744372871141776: Downloading 1 format(s): sd
ID EXT RESOLUTION │ PROTO │ VCODEC  ACODEC
───────────────────────────────────────────
sd mp4 unknown    │ https │ unknown unknown
@elpresti elpresti added site-bug Issue with a specific website triage Untriaged issue labels Apr 19, 2024
@bashonly
Copy link
Member

this seems to fix it:

diff --git a/yt_dlp/extractor/facebook.py b/yt_dlp/extractor/facebook.py
index 834b1df18..b76407a5c 100644
--- a/yt_dlp/extractor/facebook.py
+++ b/yt_dlp/extractor/facebook.py
@@ -560,7 +560,7 @@ def extract_from_jsmods_instances(js_data):
                     js_data, lambda x: x['jsmods']['instances'], list) or [])
 
         def extract_dash_manifest(video, formats):
-            dash_manifest = video.get('dash_manifest')
+            dash_manifest = traverse_obj(video, 'dash_manifest', 'playlist', expected_type=str)
             if dash_manifest:
                 formats.extend(self._parse_mpd_formats(
                     compat_etree_fromstring(urllib.parse.unquote_plus(dash_manifest)),
$ yt-dlp -F https://facebook.com/475841587884690/videos/744372871141776
[facebook] Extracting URL: https://facebook.com/475841587884690/videos/744372871141776
[facebook] 744372871141776: Downloading webpage
[info] Available formats for 744372871141776:
ID                EXT RESOLUTION │   FILESIZE  TBR PROTO │ VCODEC       VBR ACODEC     ABR ASR MORE INFO
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
2890193591132187a m4a audio only │ ~ 10.64MiB  65k https │ audio only       mp4a.40.5  65k 48k DASH audio, m4a_dash
sd                mp4 unknown    │                 https │ unknown          unknown
308764358916363v  mp4 256x144    │ ~ 10.46MiB  64k https │ avc1.4D400C  64k video only         DASH video, mp4_dash
454016937233089v  mp4 426x240    │ ~ 23.25MiB 142k https │ avc1.4D4015 142k video only         DASH video, mp4_dash
7151401058299907v mp4 640x360    │ ~ 40.43MiB 248k https │ avc1.4D401E 248k video only         DASH video, mp4_dash
442595941470298v  mp4 854x480    │ ~ 65.56MiB 402k https │ avc1.4D401F 402k video only         DASH video, mp4_dash
448319621059078v  mp4 1280x720   │ ~111.09MiB 681k https │ avc1.4D4020 681k video only         DASH video, mp4_dash

@bashonly bashonly added patch-available There is patch available that should fix this issue. Someone needs to make a PR with it and removed triage Untriaged issue labels Apr 19, 2024
@elpresti
Copy link
Author

elpresti commented Apr 19, 2024

hello @bashonly , thanks for your fast reply and for your fix, but I'm not very familiar with Python, neither with the yt-dlp workflow. Is there anything I can do to apply your patch or it will be released soon in some specific version of yp-dlp?
Thanks. Regards

@shortringbear
Copy link

shortringbear commented Apr 19, 2024

this seems to fix it:

diff --git a/yt_dlp/extractor/facebook.py b/yt_dlp/extractor/facebook.py
index 834b1df18..b76407a5c 100644
--- a/yt_dlp/extractor/facebook.py
+++ b/yt_dlp/extractor/facebook.py
@@ -560,7 +560,7 @@ def extract_from_jsmods_instances(js_data):
                     js_data, lambda x: x['jsmods']['instances'], list) or [])
 
         def extract_dash_manifest(video, formats):
-            dash_manifest = video.get('dash_manifest')
+            dash_manifest = traverse_obj(video, 'dash_manifest', 'playlist', expected_type=str)
             if dash_manifest:
                 formats.extend(self._parse_mpd_formats(
                     compat_etree_fromstring(urllib.parse.unquote_plus(dash_manifest)),

I'm also very interested in this fix, but I don't understand where I need to insert this code snippet to make it work.

@BahzBeih
Copy link

i have the same problem too.

bashonly added a commit that referenced this issue Apr 20, 2024
@bashonly
Copy link
Member

@elpresti yt-dlp --update-to master

@elpresti
Copy link
Author

Thanks a lot @bashonly , your fix works like a charm in the last version!

aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this issue Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch-available There is patch available that should fix this issue. Someone needs to make a PR with it site-bug Issue with a specific website
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants