Improve shorts check (shared connection)
This commit is contained in:
parent
ef14b1cc07
commit
a9e0fd26d7
2 changed files with 4 additions and 3 deletions
|
|
@ -58,9 +58,8 @@ class YoutubeManager:
|
|||
except TimeoutError as error:
|
||||
raise RuntimeError(f'Timeout calling YT API ({url}): {error}') from error
|
||||
|
||||
def is_shorts(self, video_id: str, request_timeout: float) -> bool:
|
||||
def is_shorts(self, connection: http.client.HTTPConnection, video_id: str) -> bool:
|
||||
try:
|
||||
connection = http.client.HTTPSConnection('www.youtube.com', timeout=request_timeout)
|
||||
connection.request('GET', f'/shorts/{video_id}')
|
||||
response = connection.getresponse()
|
||||
return response.status != self.SHORTS_CHECK_STATUS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue