Sabemos que es muy importante estar al tanto sobre lo que ocurre en nuestro entorno. En especial el ambiente uno no puede ignorar el simple hecho de que un acontecimiento como tal lo describe este artículo de la DW CHANNEL. Por esa vital razón, es considerable que tomemos acciones o medidas-sean individuales o colectivas- que nos permitan realizar un esfuerzo consciente para cambiar nuestros hábitos y mejorar nuestra relación con el planeta.
Los resultados científicos en ese aspecto no mienten, desenmascaran la forma en como nuestra conducta, conjugada con los modelos productivos imperantes, están degenerando la vida y ocasionando impactos ambientales negativos e insostenibles.
Por esa razón, hoy he preparado otro script en Python para compartirlos con ustedes. Se trata de un simple script que podemos usar para extraer los enlaces y títulos de un sitio web que pertenece a institución que fue fundada en el año de 1912 y que desde entonces se ha caracterizado en efectuar importantes labores en las ciencias ambientales. El sitio web en cuestión pertenece a la britishecologicalsociety.
Este sitio web dispone de muchísima información interesante y me ha dejado fascinado. Incluso, quería publicar sobre algunas lecturas que he tenido sobre sus investigaciones y hasta entonces no he decido cuál novedad puedo traer a mis lectores de hive.
Sin embargo, puedo decirles que me comprometo en realizar sobre las lecturas reflexivas que he obtenido en este sitio web, ya que soy un lector regular de esta página.
Ahora que he desarrollado mis habilidades como programador novato en Python finalmente he logrado desarrollar mi propio script que cumple perfectamente con su propósito.
En fin, mis queridos hivers abajo les dejo el fulano script y sus resultados.
Gracias por visitar esta publicación. Estaré atento a sus comentarios.
Este script fue ejecutado con Python 3.9.13 en el sistema operativo Lubuntu 18.0.4.
We know that it is very important to be aware of what is happening in our environment. Especially the environment one cannot ignore the simple fact that such an event as described in this article from DW CHANNEL. For that vital reason, it is considerable that we take actions or measures-whether individual or collective-that allow us to make a conscious effort to change our habits and improve our relationship with the planet.
The scientific results in this regard do not lie, they unmask the way in which our behavior, combined with the prevailing productive models, are degenerating life and causing negative and unsustainable environmental impacts.
For that reason, today I have prepared another Python script to share with you. It is a simple script that we can use to extract the links and titles of a website that belongs to an institution that was founded in 1912 and since then has been characterized in carrying out important work in the environmental sciences. The website in question belongs to the britishecologicalsociety.
This website has a lot of interesting information and has fascinated me. I even wanted to post about some of the readings I have had on their research and have not yet decided what news I can bring to my hive readers.
However, I can tell you that I am committed to realize about the thoughtful readings I have obtained from this website, as I am a regular reader of this page.
Now that I have developed my skills as a novice Python programmer I have finally managed to develop my own script that serves its purpose perfectly.
Anyway, my dear hivers below is the script and its results.
Thanks for visiting this post. I will be attentive to your comments.
This script was run with Python 3.9.13 on the Lubuntu 18.0.4 operating system.
import asyncio
import aiohttp
from selectolax.parser import HTMLParserheaders={'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():
for index in range(1,5): async with aiohttp.ClientSession() as session: url=f'https://www.britishecologicalsociety.org/news-and-opinion/page/{index}/' async with session.get(url,headers=headers) as site: britishecologicalsociety = await site.text() britishecologicalsociety_raw = HTMLParser(britishecologicalsociety) for gethl in britishecologicalsociety_raw.css('div.masonry--third.cf > div > a'): titles=gethl.text(strip=True) links=gethl.attributes['href'] print(f'titles: {titles} links: {links}')asyncio.run(parsing_page())