Skip to content

Commit 4a105f7

Browse files
committed
🐛 fixed the site name not find.
1 parent e9e7abf commit 4a105f7

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Diff for: utils/collector.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -364,18 +364,15 @@ async def fetch_title(s: aiohttp.ClientSession, url):
364364
else:
365365
domain2 = ''
366366
async with aiohttp.ClientSession(headers=_headers) as session:
367-
tasks = []
368367
if domain:
369368
url_domain = f"{parsed_url.scheme}://{domain}"
370-
tasks.append(fetch_title(session, url_domain))
371-
if domain2:
369+
domain_title = await fetch_title(session, url_domain)
370+
371+
if not domain_title:
372372
url_subdomain = f"{parsed_url.scheme}://{domain2}"
373-
tasks.append(fetch_title(session, url_subdomain))
373+
await fetch_title(session, url_subdomain)
374374

375-
results = await asyncio.gather(*tasks)
376-
domain_title = results[0] if len(results) > 0 else ""
377-
domain_title2 = results[1] if len(results) > 1 else ""
378-
site_title = domain_title or domain_title2 or ""
375+
site_title = domain_title or ""
379376
return site_title
380377

381378
@logger.catch()

0 commit comments

Comments
 (0)