[ESP-ENG] Títulos y enlaces en DZONE || Titles and links in DZONE

avatar

Preview.pngImagen diseñada con canva || Image designed with canva

Saludo hivers. Les comparto un nuevo script elaborado en Python con el propósito de obtener los enlaces y títulos del sitio web dzone.

En este sitio web también encontraremos información sobre ciencia de datos, o sea, noticias sobre Big Data, gestión de base de datos, IoT, AI y otros temas relacionados como sería el caso del webservice y DevOps.

También dispone de newsletter, webinars, reportes de investigación y cuenta con una interfaz gráfica simple y amena para sus visitantes, donde encontraremos muchas publicaciones elaboradas con un estilo de redacción para el público general, sin perder profesionalismo y detalles técnicos esenciales.

En fin, creo que es un sitio web que tiene mucho que ofrecer y por tal motivo se los comparto con ustedes junto con mi pequeño script para que puedan disponer del y usarlos en sus proyectos.

Gracias por tomar su tiempo en pasar por mi blog. Hasta la próxima publicación.

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

Greetings hivers. I share with you a new script elaborated in Python with the purpose of getting the links and titles of the website dzone.

In this website we will also find information about data science, that is, news about Big Data, database management, IoT, AI and other related topics as would be the case of webservice and DevOps.

It also has a newsletter, webinars, research reports and has a simple and enjoyable graphical interface for its visitors, where we will find many publications prepared with a writing style for the general public, without losing professionalism and essential technical details.

In short, I think it is a website that has a lot to offer and for that reason I share it with you along with my little script so you can have it and use it in your projects.

Thanks for taking the time to stop by my blog. See you next time.

This script was executed with Python 3.9.13 on Lubuntu 18.0.4 operating system.

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'}

url_list=['https://dzone.com/artificial-intelligence-tutorials-tools-news',
'https://dzone.com/big-data-analytics-tutorials-tools-news',
'https://dzone.com/database-sql-nosql-tutorials-tools-news',
'https://dzone.com/microservices-news-tutorials-tools',
'https://dzone.com/iot-developer-tutorials-tools-news-reviews']

for url_list in url_list:

client=httpx.Client(headers=headers)
dzone=client.get(url_list).text

with open('dzone.html',mode='w') as f:

    f.write(dzone)
    f.close()

    html_doc=open('dzone.html')

    page=HTMLParser(html_doc.read())

for get_data in page.css('div > ul > li > a'):
    
    titles=get_data.text(strip=True)
    links=get_data.attributes['href']
        
    if 'articles' in titles or 'articles' in links:
        print(titles,links)

Result.png


Text translated by DeepL



0 comments