From 0607ae8b70be6d75b0c529012f3043090e44ae5e Mon Sep 17 00:00:00 2001 From: Benny Date: Fri, 8 Sep 2023 20:02:34 +0200 Subject: [PATCH] fix youtube short --- ytdlbot/channel.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ytdlbot/channel.py b/ytdlbot/channel.py index 3715fa4..52d2236 100644 --- a/ytdlbot/channel.py +++ b/ytdlbot/channel.py @@ -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)