diff options
author | Remita Amine <remitamine@gmail.com> | 2021-01-04 00:51:55 +0100 |
---|---|---|
committer | Remita Amine <remitamine@gmail.com> | 2021-01-04 01:14:25 +0100 |
commit | e88c9ef62a4a26cc77370b741a4244d298c7d45a (patch) | |
tree | 1a51cee08f0515853f9c5661a8098f89d5a43668 /youtube_dl/utils.py | |
parent | 0889eb33e0d40d567be5b2f8431952a5517276fc (diff) |
[utils] add a function to clean podcast URLs
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index d5fb6fd24..8e4d144c9 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -5706,3 +5706,20 @@ def random_birthday(year_field, month_field, day_field): month_field: str(random_date.month), day_field: str(random_date.day), } + + +def clean_podcast_url(url): + return re.sub(r'''(?x) + (?: + (?: + chtbl\.com/track| + media\.blubrry\.com| # https://create.blubrry.com/resources/podcast-media-download-statistics/getting-started/ + play\.podtrac\.com + )/[^/]+| + (?:dts|www)\.podtrac\.com/(?:pts/)?redirect\.[0-9a-z]{3,4}| # http://analytics.podtrac.com/how-to-measure + flex\.acast\.com| + pd(?: + cn\.co| # https://podcorn.com/analytics-prefix/ + st\.fm # https://podsights.com/docs/ + )/e + )/''', '', url) |