コミットを比較

...

3 コミット

作成者 SHA1 メッセージ 日付
みてるぞ f290e64a4e feat: 旧検索ページから最新取得(暫定)(#2) (#6)
#2

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #6
2026-01-09 04:15:51 +09:00
みてるぞ 76e41ad78d feat: 例外出力(#3) (#5)
#3

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #5
2026-01-09 03:48:50 +09:00
みてるぞ 85670982f0 gitignore 追加 2025-10-23 00:03:00 +09:00
2個のファイルの変更14行の追加9行の削除
+1
ファイルの表示
@@ -0,0 +1 @@
__pycache__
+12 -8
ファイルの表示
@@ -44,7 +44,8 @@ def fetch_video_info (
description = (bs.find ('meta', attrs = { 'name': 'description' }) description = (bs.find ('meta', attrs = { 'name': 'description' })
.get ('content')) # type: ignore .get ('content')) # type: ignore
except (AttributeError, TypeError): except (AttributeError, TypeError) as ex:
print (ex)
return None return None
return { 'contentId': video_code, return { 'contentId': video_code,
@@ -86,15 +87,15 @@ def fetch_embed_info (
if tmp is not None and hasattr (tmp, 'get'): if tmp is not None and hasattr (tmp, 'get'):
try: try:
description = str (tmp.get ('content')) description = str (tmp.get ('content'))
except (AttributeError, TypeError): except (AttributeError, TypeError) as ex:
pass print (ex)
tmp = bs.find ('meta', attrs = { 'name': 'thumbnail' }) tmp = bs.find ('meta', attrs = { 'name': 'thumbnail' })
if tmp is not None and hasattr (tmp, 'get'): if tmp is not None and hasattr (tmp, 'get'):
try: try:
thumbnail = str (tmp.get ('content')) thumbnail = str (tmp.get ('content'))
except (AttributeError, TypeError): except (AttributeError, TypeError) as ex:
pass print (ex)
return (title, description, thumbnail) return (title, description, thumbnail)
@@ -119,7 +120,8 @@ def fetch_latest_video (
tag = ' OR '.join (tags) tag = ' OR '.join (tags)
url = f"https://www.nicovideo.jp/tag/{ tag }" url = f"https://www.nicovideo.jp/tag/{ tag }"
params = { 'sort': 'f', params = { 'new_search': 'false',
'sort': 'f',
'order': 'd' } 'order': 'd' }
video_info = { } video_info = { }
@@ -133,7 +135,8 @@ def fetch_latest_video (
.find ('li', class_ = 'item')) .find ('li', class_ = 'item'))
video_info['contentId'] = video['data-video-id'] video_info['contentId'] = video['data-video-id']
except (AttributeError, IndexError, KeyError, TypeError): except (AttributeError, IndexError, KeyError, TypeError) as ex:
print (ex)
return None return None
return fetch_video_info (video_info['contentId']) return fetch_video_info (video_info['contentId'])
@@ -164,7 +167,8 @@ def _create_bs_from_url (
try: try:
req = requests.get (url, params = params, timeout = 60) req = requests.get (url, params = params, timeout = 60)
except Timeout: except Timeout as ex:
print (ex)
return None return None
if req.status_code != 200: if req.status_code != 200: