fix youtube short

This commit is contained in:
Benny 2023-09-08 20:02:34 +02:00
parent fcfd68fcf1
commit 0607ae8b70
No known key found for this signature in database
GPG key ID: 6CD0DBDA5235D481

View file

@ -69,10 +69,10 @@ class Channel(Payment):
element = soup.find("link", rel=prop)
try:
href = element["href"]
if href not in ["null", "", None]:
if href not in ["null", "", None, "https://consent.youtube.com/m"]:
return href
except Exception:
logging.warning("Canonical exception %s", url)
except Exception as e:
logging.debug("Canonical exception %s %s e", url, e)
return url
@ -177,4 +177,5 @@ class Channel(Payment):
if __name__ == "__main__":
Channel.extract_canonical_link("https://www.youtube.com/watch?v=X4otYJGByic")
s = Channel.extract_canonical_link("https://www.youtube.com/shorts/KkbYbknjPBM")
print(s)