Fix type in request_channel_id url
This commit is contained in:
parent
7e59499cec
commit
1eddcb686c
2 changed files with 21 additions and 18 deletions
|
|
@ -148,6 +148,7 @@ class Bot:
|
|||
|
||||
for message in messages:
|
||||
if message.author.id != self.bot_user.id and message.content.startswith(self.YT_CHANNEL_NAME_URL):
|
||||
try:
|
||||
self.logger.debug('Parsing message for youtube channel name conversion: %s', message)
|
||||
answers: list[str] = []
|
||||
for line in message.content.splitlines():
|
||||
|
|
@ -165,6 +166,8 @@ class Bot:
|
|||
guild_id=None,
|
||||
fail_if_not_exists=None)}, request_timeout=self.config.request_timeout)
|
||||
delayed_delete[bot_message.id] = bot_message
|
||||
except Exception as error:
|
||||
self.logger.error('Unexpected error while searching channel id from name: %s', error)
|
||||
delayed_delete[message.id] = message
|
||||
continue
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class YoutubeManager:
|
|||
|
||||
def request_channel_id(self, channel_name: str, request_timeout: float) -> str:
|
||||
url = ('https://www.googleapis.com/youtube/v3/channels?part=snippet'
|
||||
f'&forHandle%40={channel_name}&key={self._api_key}')
|
||||
f'&forHandle=%40{channel_name}&key={self._api_key}')
|
||||
self._logger.debug('YoutubeManager: request channel id for channel %s', channel_name)
|
||||
_, info = self._request(url=url, request_timeout=request_timeout)
|
||||
return info['items'][0]['id']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue