Youtube Subscription Implementation (WIP)
This commit is contained in:
parent
816285efbc
commit
b80e4f7745
6 changed files with 333 additions and 133 deletions
|
|
@ -7,7 +7,7 @@ from typing import TYPE_CHECKING
|
|||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
from breadtube_bot.yt_objects import SearchResult
|
||||
from .yt_objects import ChannelResult, SearchResult
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -57,11 +57,11 @@ class YoutubeManager:
|
|||
raise RuntimeError(f'Timeout calling YT API ({url}): {error}') from error
|
||||
|
||||
def request_channel_info(self, channel_id: str, request_timeout: float) -> tuple[
|
||||
HTTPHeaders, dict]:
|
||||
HTTPHeaders, ChannelResult]:
|
||||
url = ('https://www.googleapis.com/youtube/v3/channels?part=snippet'
|
||||
f'&id={channel_id}&key={self._api_key}')
|
||||
headers, info = self._request(url=url, request_timeout=request_timeout)
|
||||
return headers, info
|
||||
return headers, ChannelResult.from_dict(info)
|
||||
|
||||
def request_channel_videos(self, channel_id: str, max_results: int, request_timeout: float) -> tuple[
|
||||
HTTPHeaders, SearchResult]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue