import httpx
from selectolax.parser import HTMLParserheaders={'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75'}
for idx in range(1,5):
client=httpx.Client(headers=headers) itsecuritycentral=client.get(f'https://itsecuritycentral.teramind.co/latest-posts/page/{idx}/').text itsecuritycentral_html=HTMLParser(itsecuritycentral) for hl in itsecuritycentral_html.css('div.postInfo > h3 > a'): h=hl.text(strip=True) l=hl.attributes['href'] print(f'headlines: {h} links: {l}')