このコミットが含まれているのは:
@@ -0,0 +1 @@
|
||||
from .module.py import fetch_comments
|
||||
@@ -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 }
|
||||
|
||||
新しい課題から参照
ユーザをブロックする