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

Update clean_podcast_url() in _utils.py #7549

Closed
wants to merge 1 commit into from

Conversation

mabdelfattah
Copy link
Contributor

@mabdelfattah mabdelfattah commented Jul 8, 2023

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

Fix for #7430 and #7544
Example URLs:
https://pdst.fm/e/2.gum.fm/chtbl.com/track/chrt.fm/track/34D33/pscrb.fm/rss/p/traffic.megaphone.fm/ITLLC7765286967.mp3?updated=1687282661

https://pdst.fm/e/https://mgln.ai/e/441/www.buzzsprout.com/1121972/13019085-ep-252-the-deep-life-stack.mp3

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 436c63c

Summary

馃悰馃Ч馃帶

Fix and improve podcast URL cleaning in yt_dlp/utils/_utils.py. Use regex to avoid adding extra http:// or https:// to podcast URLs.

clean_podcast_url is the function of doom
It strips away the noise and the gloom
With a regex group it slays the duplicates
No more protocol prefixes to confuse and frustrate

Walkthrough

  • Fix duplicate protocol prefix bug in podcast URLs by capturing and reusing the first prefix in a regex group (link)
  • Remove redundant line of code that was doing the same thing as the previous fix, but less efficiently and without a regex group (link)

@mabdelfattah mabdelfattah deleted the patch-1 branch July 8, 2023 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant