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

in #sites2 years ago

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

import asyncio
import aiohttp
from selectolax.parser import HTMLParser

headers={'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 index in range(1,6): 
        
        async with session.get(f'https://geeksroom.com/page/{index}/',headers=headers) as page:
            
            geeksroom=await page.text() 
            geeksroom_html=HTMLParser(geeksroom)
             
            for hl in geeksroom_html.css('header h2.title.front-view-title a'):

                h=hl.text(strip=True)
                l=hl.attributes['href']

                print(f'headlines: {h} links: {l}')

asyncio.run(parsing_page())


Text translated by DeepL

Sort:  

Congratulations @pynomiems! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You have been a buzzy bee and published a post every day of the week.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out our last posts:

Christmas Challenge - Offer a gift to your friends
HiveBuzz World Cup Contest - Sponsor Feedback and Feedback Request
HiveBuzz World Cup Contest - Prizes from our sponsors
The Hive Gamification Proposal Renewal
Support the HiveBuzz project. Vote for our proposal!