Skip to content

Commit

Permalink
🐛 fixed the site name not find.
Browse files Browse the repository at this point in the history
  • Loading branch information
AirportR committed Jun 19, 2024
1 parent 4a105f7 commit 595132a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion botmodule/subinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ async def getSubInfo(_, message):
subinfo_text = f"☁️订阅名称:{subname}" + subinfo_text
else:
subinfo_text = f"☁️订阅链接:{url}" + subinfo_text
subinfo_text = f"✈️机场名:{site_name}\n" + subinfo_text if site_name else "未知"
site_name = f"✈️机场名:{site_name}\n" if site_name else "✈️机场名:未知\n"
subinfo_text = site_name + subinfo_text
await back_message.edit_text(subinfo_text, parse_mode=ParseMode.DISABLED)
except RPCError as r:
logger.error(str(r))
6 changes: 4 additions & 2 deletions utils/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,13 @@ async def fetch_title(s: aiohttp.ClientSession, url):
async with aiohttp.ClientSession(headers=_headers) as session:
if domain:
url_domain = f"{parsed_url.scheme}://{domain}"
logger.info(f'获取域名的站点标题: {url_domain}')
domain_title = await fetch_title(session, url_domain)

if not domain_title:
if not domain_title and domain2:
url_subdomain = f"{parsed_url.scheme}://{domain2}"
await fetch_title(session, url_subdomain)
logger.info(f'尝试获取二级域名站点标题: {url_subdomain}')
domain_title = await fetch_title(session, url_subdomain)

site_title = domain_title or ""
return site_title
Expand Down

0 comments on commit 595132a

Please sign in to comment.