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


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)
lefnec=client.get(f'https://www.lefnec.com/page/{idx}/').text
lefnec_html=HTMLParser(lefnec)

for hl in lefnec_html.css('h3.entry-title.td-module-title > a'):
    
    h=hl.text(strip=True)
    l=hl.attributes['href']
    
    print(f'headlines: {h} links: {l}')

H2
H3
H4
3 columns
2 columns
1 column
1 Comment
Ecency