[ESP-ENG] Titulos y enlaces en dataversity || Titles and links in dataversity

in #siteslast year


Imagen diseñada con canva || Image designed with canva

import httpx
from selectolax.parser import HTMLParser

headers={'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)
dataversity=client.get(f'https://www.dataversity.net/category/blogs/page/{idx}/').text
dataversity_html=HTMLParser(dataversity)

for get_hl in dataversity_html.css('header h2.entry-title > a'):
    
    h=get_hl.text(strip=True)
    l=get_hl.attributes['href']
    
    print(f'headlines: {h} links: {l}')