Skip to content

Commit

Permalink
bs4 exact match
Browse files Browse the repository at this point in the history
  • Loading branch information
BennyThink committed Feb 25, 2024
1 parent 5dbc4fb commit 5be9d65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ytdlbot/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def extract_canonical_link(url: str) -> str:
html_doc = requests.get(url, headers=headers, cookies=cookie, timeout=5).text
soup = BeautifulSoup(html_doc, "html.parser")
for prop in props:
element = soup.find("link", rel=prop)
element = soup.find(lambda tag: tag.name == "link" and tag.get("rel") == ["prop"])
try:
href = element["href"]
if href not in ["null", "", None, "https://consent.youtube.com/m"]:
Expand Down

0 comments on commit 5be9d65

Please sign in to comment.