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 index in range(1,5):
client=httpx.Client() researchworld=client.get(f'https://researchworld.com/articles?page={index}',headers=headers,follow_redirects=True).text researchworld_html=HTMLParser(researchworld) for find_hl in researchworld_html.css('div > h4 > a'): h=find_hl.text(strip=True) l=find_hl.attributes['href'] print(f'Headlines: {h} Links:{l}')