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

avatar

Preview.png

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

Hola lector. traigo nuevo sitio para ti. Esta vez se trata de inceptivemind Un sitio lanzado en el 2017 en el que puedes acceder para que hagas tus consultas sobre tecnología, robótica, transporte e inventos.

Este script fue ejecutado con Python 3.9.13 en el sistema operativo Lubuntu 18.04.6.

Hello reader. I bring new site for you. This time it's inceptivemind A site launched in 2017 where you can log in to ask your queries about technology, robotics, transportation and inventions.

This script was run with Python 3.9.13 on Lubuntu 18.04.6 operating system.

import asyncio
import aiohttp
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'}

async def parsing_page():

async with aiohttp.ClientSession() as session:

    for index in range(1,6): 
        
        async with session.get(f'https://www.inceptivemind.com/page/{index}/',headers=headers) as page:
            
            inceptivemind=await page.text() 
            inceptivemind_raw=HTMLParser(inceptivemind)
             
            for hl in inceptivemind_raw.css('div.td-module-meta-info > h2 > a'):

                headlines=hl.text(strip=True)
                links=hl.attributes['href']

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

asyncio.run(parsing_page())

result.png


Text translated by DeepL



0 comments