Attempt to embed as iframe
This commit is contained in:
parent
fb3ee42ead
commit
f83d853fec
7
app.py
7
app.py
|
@ -23,7 +23,7 @@ except FileNotFoundError:
|
||||||
|
|
||||||
s = requests.Session()
|
s = requests.Session()
|
||||||
s.headers.update({
|
s.headers.update({
|
||||||
"User-Agent": "Twitterbot/1.0"
|
"User-Agent": "Googlebot/2.1"
|
||||||
})
|
})
|
||||||
s.cookies = cookie_jar # type: ignore
|
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
|
og_tags = soup.find_all("meta", property=lambda x: x) # type: ignore
|
||||||
for tag in og_tags:
|
for tag in og_tags:
|
||||||
|
# Fix thumbnail
|
||||||
if tag.get("property") == "og:image" and thumbnail_url:
|
if tag.get("property") == "og:image" and thumbnail_url:
|
||||||
tag["content"] = 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)
|
og_tags_str = "\n".join(str(tag) for tag in og_tags)
|
||||||
html_response = f"""
|
html_response = f"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user