
import asyncio
import aiohttp
from selectolax.parser import HTMLParserheaders={'user-agent': 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_5 rv:3.0; sl-SI) AppleWebKit/534.49.1 (KHTML, like Gecko) Version/4.0.1 Safari/534.49.1'}
async def parsing_page():
async with aiohttp.ClientSession() as session:
for idx in range(2,6):
async with session.get(f'https://mycodebit.com/page/{idx}/',headers=headers) as page:
mycodebit=await page.text()
mycodebit_html=HTMLParser(mycodebit)
for hl in mycodebit_html.css('h2.penci-entry-title.entry-title.grid-title > a'):
h=hl.text(strip=True)
l=hl.attributes['href']
print(f'headlines: {h} links: {l}')asyncio.run(parsing_page())