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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ie/twitter:spaces] Fix format protocol #7550

Merged
merged 2 commits into from Jul 15, 2023

Conversation

bashonly
Copy link
Member

@bashonly bashonly commented Jul 8, 2023

Reverts the entry_protocol for _extract_m3u8_formats to m3u8, so as to force ffmpeg as downloader for both live and replay Spaces.

Closes #7536

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

Copilot Summary

馃 Generated by Copilot at 582709d

Summary

馃惁馃帣锔忦煕狅笍

Add support for downloading Twitter Spaces and fix m3u8 extraction. Use ffmpeg to download m3u8 formats from yt_dlp/extractor/twitter.py to avoid missing segments.

ffmpeg needed
to extract m3u8 formats
falling leaves of sound

Walkthrough

  • Add support for downloading Twitter Spaces (link, F0L1648R

@bashonly bashonly added the site-bug Issue with a specific website label Jul 8, 2023
Copy link
Member

@pukkandan pukkandan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest either linking to the issue so we have an example URL

Comment on lines 1563 to 1564
if not is_live:
fmt['container'] = 'm4a_dash'
Copy link
Member

@pukkandan pukkandan Jul 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this anyway, since user can force native with --downloader native. Afair, fixup code will not run when ffmpeg is used

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does still fixup when ffmpeg is used. Should we still add it back though? I have added it for now

Btw here's an example where native+fixup works (I wasn't just imagining it):

$ yt_dlp --cookies-from-browser firefox::twitter --downloader native 'https://twitter.com/i/spaces/1vAxRAVQWONJl'
[Cookies] Extracting cookies from firefox
[Cookies] Extracted 59 cookies from firefox
[twitter:spaces] Extracting URL: https://twitter.com/i/spaces/1vAxRAVQWONJl
[twitter:spaces] 1vAxRAVQWONJl: Downloading GraphQL JSON
[twitter:spaces] 28_1646577130061590528: Downloading legacy API JSON
[twitter:spaces] 28_1646577130061590528: Downloading m3u8 information
[info] 1vAxRAVQWONJl: Downloading 1 format(s): 0
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 829
[download] Destination: 20230413_googlecloud_1vAxRAVQWONJl_Framing_Up_FinOps_-_Billing_Tools.m4a
[download] 100% of   31.58MiB in 00:03:07 at 172.21KiB/s
[FixupM4a] Correcting container of "20230413_googlecloud_1vAxRAVQWONJl_Framing_Up_FinOps_-_Billing_Tools.m4a"
$

Copy link
Member

@pukkandan pukkandan Jul 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does still fixup when ffmpeg is used.

diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index d0be3c964..cc1741b75 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -3418,7 +3418,7 @@ def ffmpeg_fixup(cndn, msg, cls):
                     postprocessed_by_ffmpeg = info_dict.get('requested_formats') or any((
                         isinstance(pp, FFmpegVideoConvertorPP)
                         and resolve_recode_mapping(ext, pp.mapping)[0] not in (ext, None)
-                    ) for pp in self._pps['post_process'])
+                    ) for pp in self._pps['post_process']) or fd == FFmpegFD

                     if not postprocessed_by_ffmpeg:
                         ffmpeg_fixup(ext == 'm4a' and info_dict.get('container') == 'm4a_dash',

This should fix it. I'll push it later.

@bashonly bashonly mentioned this pull request Jul 10, 2023
11 tasks
@bashonly bashonly merged commit 613dbce into yt-dlp:master Jul 15, 2023
13 checks passed
@bashonly bashonly deleted the fix/twitter-spaces-again branch July 15, 2023 22:18
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this pull request Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site-bug Issue with a specific website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[twitter:spaces] Invalid data found when processing input
2 participants