このコミットが含まれているのは:
2025-01-10 10:10:57 +00:00
コミット 1b7ebf8744
2個のファイルの変更26行の追加0行の削除
+1
ファイルの表示
@@ -0,0 +1 @@
from .module.py import fetch_comments
+25
ファイルの表示
@@ -0,0 +1,25 @@
def fetch_video_info (
video_code: str,
) -> VideoInfo | None:
bs = _create_bs_from_url (f"https://www.nicovideo.jp/watch/{ video_code }")
if bs is None:
return None
try:
title = bs.find ('title')
if title is None:
return None
title = '-'.join (title.text.split ('-')[:(-1)])[:(-1)]
tags_str: str = bs.find ('meta', attrs = { 'name': 'keywords' }).get ('content') # type: ignore
tags = tags_str.split (',')
description = bs.find ('meta', attrs = { 'name': 'description' }).get ('content') # type: ignore
except Exception:
return None
return { 'contentId': video_code,
'title': title,
'tags': tags,
'description': description }