[utils] add a function to clean podcast URLs

This commit is contained in:
Remita Amine
2021-01-04 00:51:55 +01:00
parent 0889eb33e0
commit e88c9ef62a
2 changed files with 22 additions and 0 deletions

View File

@ -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)