サムネ取得ミス修正
このコミットが含まれているのは:
@@ -95,13 +95,14 @@ def main (
|
||||
|
||||
uri = f"https://www.nicovideo.jp/watch/{ datum['contentId'] }"
|
||||
(title, description, thumbnail) = get_embed_info (uri)
|
||||
upload = client.com.atproto.repo.upload_blob (
|
||||
io.BytesIO (requests.get (thumbnail).content))
|
||||
|
||||
embed_external = models.AppBskyEmbedExternal.Main (
|
||||
external = models.AppBskyEmbedExternal.External (
|
||||
title = title,
|
||||
description = description,
|
||||
thumb = client.com.atproto.repo.upload_blob (
|
||||
io.BytesIO (requests.get (thumbnail).content)),
|
||||
thumb = upload.blob,
|
||||
uri = uri))
|
||||
client.post (Talk.main (f"""
|
||||
ニコニコに『{ datum['title'] }』という動画がアップされました。
|
||||
@@ -185,6 +186,10 @@ def get_nico_deerjika ():
|
||||
def get_embed_info (
|
||||
url: str
|
||||
) -> (str, str, str):
|
||||
title: str = ''
|
||||
description: str = ''
|
||||
thumbnail: str = ''
|
||||
|
||||
try:
|
||||
res = requests.get (url, timeout = 60)
|
||||
except Exception:
|
||||
@@ -205,7 +210,7 @@ def get_embed_info (
|
||||
|
||||
tmp = soup.find ('meta', attrs = { 'name': 'thumbnail' })
|
||||
if tmp is not None:
|
||||
thumbnail = tmp.get (' content')
|
||||
thumbnail = tmp.get ('content')
|
||||
|
||||
return (title, description, thumbnail)
|
||||
|
||||
|
||||
新しい課題から参照
ユーザをブロックする