tetsuya-ki / discord-live-notificationbot

discordでライブ配信などを通知するBotです(ニコニコ生放送, YouTubeのみ対応)
MIT License
8 stars 3 forks source link

youtube_recent_urlを取得する際のチェックが足りておらず、IndexErrorでタスクが終了してしまう #10

Closed tetsuya-ki closed 2 years ago

tetsuya-ki commented 2 years ago
Unhandled exception in internal background task 'printer'.
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/tasks/__init__.py", line 101, in _loop
    await self.coro(*args, **kwargs)
  File "/home/runner/discord-live-notificationbot/cogs/livenotificationcog.py", line 43, in printer
    result_dict_list = await self.liveNotification.get_youtube(live['channel_id'], live['recent_id'], live['recent_movie_length'], live['updated_at'])
  File "/home/runner/discord-live-notificationbot/cogs/modules/live_notification.py", line 378, in get_youtube
    youtube_recent_url = response[7][4].attrib['href'] if response[7][4] is not None else ''
IndexError: child index out of range
2021-12-28 10:08:41,722@ live-notification-bot [INFO] live_notification_list: live-notificationを確認するぜ!
2021-12-28 10:08:41,722@ live-notification-bot [INFO] check_printer_is_running: Taskが停止していたので再起動します。
2021-12-28 10:08:41,726@ asyncio [ERROR] default_exception_handler: Task exception was never retrieved
future: <Task finished name='Task-10080' coro=<Loop._loop() done, defined at /opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/tasks/__init__.py:88> exception=IndexError('child index out of range')>
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/tasks/__init__.py", line 125, in _loop
    raise exc
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/tasks/__init__.py", line 101, in _loop
    await self.coro(*args, **kwargs)
  File "/home/runner/discord-live-notificationbot/cogs/livenotificationcog.py", line 43, in printer
    result_dict_list = await self.liveNotification.get_youtube(live['channel_id'], live['recent_id'], live['recent_movie_length'], live['updated_at'])
  File "/home/runner/discord-live-notificationbot/cogs/modules/live_notification.py", line 378, in get_youtube
    youtube_recent_url = response[7][4].attrib['href'] if response[7][4] is not None else ''
IndexError: child index out of range
tetsuya-ki commented 2 years ago

取り急ぎ、replitは修正済(最初作ったときから埋まってたバグ)