Skip to content

Commit

Permalink
fix youtube short
Browse files Browse the repository at this point in the history
  • Loading branch information
BennyThink committed Sep 8, 2023
1 parent fcfd68f commit 0607ae8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ytdlbot/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ def extract_canonical_link(url: str) -> str:
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

Expand Down Expand Up @@ -177,4 +177,5 @@ def del_cache(self, user_link: str) -> int:


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)

0 comments on commit 0607ae8

Please sign in to comment.