このコミットが含まれているのは:
@@ -116,6 +116,32 @@ def fetch_embed_info (
|
||||
return (title, description, thumbnail)
|
||||
|
||||
|
||||
def fetch_latest_video (
|
||||
tags: list[str],
|
||||
) -> VideoInfo | None:
|
||||
tag = ' OR '.join (tags)
|
||||
url = f"https://www.nicovideo.jp/tag/{ tag }"
|
||||
|
||||
params = { 'sort': 'f',
|
||||
'order': 'd' }
|
||||
|
||||
video_info = { }
|
||||
|
||||
bs = _create_bs_from_url (url, params)
|
||||
if bs is None:
|
||||
return None
|
||||
|
||||
try:
|
||||
video = (bs.find_all ('ul', class_ = 'videoListInner')[1]
|
||||
.find ('li', class_ = 'item'))
|
||||
|
||||
video_info['contentId'] = video['data-video-id']
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
return fetch_video_info (video_info['contentId'])
|
||||
|
||||
|
||||
def _create_bs_from_url (
|
||||
url: str,
|
||||
params: dict | None = None,
|
||||
|
||||
新しい課題から参照
ユーザをブロックする