Initial commit

This commit is contained in:
2025-01-25 19:04:20 -06:00
commit d556823350
10 changed files with 334 additions and 0 deletions

16
app/page_info.py Normal file
View File

@@ -0,0 +1,16 @@
import asyncio
import aiohttp
from bs4 import BeautifulSoup
from typing import Optional
class PageInfoFetcher:
async def get_page_title(self, url: str) -> Optional[str]:
try:
async with aiohttp.ClientSession() as session:
async with session.get(url, timeout=5) as response:
if response.status == 200:
html = await response.text()
soup = BeautifulSoup(html, 'html.parser')
return soup.title.string if soup.title else None
except:
return None