diff --git a/app.py b/app.py index 270a7c0..25141f5 100644 --- a/app.py +++ b/app.py @@ -23,7 +23,7 @@ except FileNotFoundError: s = requests.Session() s.headers.update({ - "User-Agent": "Twitterbot/1.0" + "User-Agent": "Googlebot/2.1" }) s.cookies = cookie_jar # type: ignore @@ -64,8 +64,13 @@ def proxy(video_id): og_tags = soup.find_all("meta", property=lambda x: x) # type: ignore for tag in og_tags: + # Fix thumbnail if tag.get("property") == "og:image" and thumbnail_url: tag["content"] = thumbnail_url + break + # Fix embed (Niconico doesn't return MP4s) + if tag.get("property") == "og:video:type": + tag["content"] = "text/html" og_tags_str = "\n".join(str(tag) for tag in og_tags) html_response = f"""