File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212__all__ = ('WebsiteLink' , 'websites' )
1313
14+
15+ session = aiohttp .ClientSession ()
16+
1417def call_if_valid (func : Callable ) -> Callable :
1518 """
1619 A static method decorator that ensures the wrapped function is executed only if
@@ -327,12 +330,11 @@ async def get_fixed_url(self) -> tuple[Optional[str], Optional[str]]:
327330 subdomain = self .route_fix_subdomain () + subdomain
328331 prepared_url = self .get_patched_url (self .match ['domain' ], subdomain , self .route_fix_post_path_segments ())
329332 try :
330- async with aiohttp .ClientSession () as session :
331- async with session .get ("https://embedez.com/api/v1/providers/combined" , params = {'q' : prepared_url }, timeout = aiohttp .ClientTimeout (total = 30 )) as response :
332- if response .status != 200 :
333- return None , None
334- search_hash = (await response .json ())['data' ]['key' ]
335- return f"https://embedez.com/embed/{ search_hash } " , self .fixer_name
333+ async with session .get ("https://embedez.com/api/v1/providers/combined" , params = {'q' : prepared_url }, timeout = aiohttp .ClientTimeout (total = 30 )) as response :
334+ if response .status != 200 :
335+ return None , None
336+ search_hash = (await response .json ())['data' ]['key' ]
337+ return f"https://embedez.com/embed/{ search_hash } " , self .fixer_name
336338 except asyncio .TimeoutError :
337339 return None , None
338340
You can’t perform that action at this time.
0 commit comments