Hola queridos hivers. Les presento un nuevo script capaz de obtener publicaciones en formato PDF del sitio web del Banco Interamericano de Desarrollo(BID)[1]. Fue establecido en 1959 para impulsar la prosperidad económica y social en los países de la región latinoamericana y caribeña mediante el financiamiento de proyectos en diferentes sectores de la economía que sean inclusivos socialmente, sostenibles y que reduzcan la pobreza. También en su sitio web dispone de estudios, informes o investigaciones de acceso abierto para comprender la situación económica y social de la región.
El funcionamiento del script es simple; basta con solo copiar el link de la investigación que ustedes quieran descargar, pegarlo en el script y luego esperar unos segundos hasta que finalice la descargas y tendrán a su disposición un archivo en formato PDF lista para leer.
Adjunto imagen de como luce el sitio web con sus respectivos resultados y por supuesto, el código que colocaré a su disposición para que pueda usarlo según su criterio. el link para acceder a las publicaciones es el siguiente:
Vale mencionar que fue probado con la versión de Python 3.9.2 en el sistema operativo Debian Bullseye.
Hello dear hivers I present to you a new script capable of obtaining publications in PDF format from the Inter-American Development Bank(IDB)[1] website. It was established in 1959 to promote economic and social prosperity in the countries of the Latin American and Caribbean region by financing projects in different sectors of the economy that are socially inclusive, sustainable and reduce poverty. Its website also provides open access studies, reports and research to understand the economic and social situation in the region.
The operation of the script is simple; just copy the link of the research you want to download, paste it into the script and then wait a few seconds until the download finishes and you will have a file in PDF format ready to read.
Attached is an image of what the website looks like with its respective results and of course, the code that I will place at your disposal so you can use it at your discretion. The link to access the publications is the following:
It is worth mentioning that it was tested with Python version 3.9.2 on Debian Bullseye operating system.
import httpx
import aiofiles
import asyncio
from selectolax.parser import HTMLParserpublications=input('Insert link for download PDF in iadb:')
client=httpx.Client()
iadb=client.get(publications).text
dataurl=HTMLParser(iadb)
find=dataurl.css_first('a.fdl')
bl=find.attrs['href']+'?download=true'async def pdfcollect():
async with aiofiles.open('Book.pdf', mode='wb') as pdf:
await pdf.write(client.get(bl, follow_redirects=True, timeout=10).content)asyncio.run(pdfcollect())
print('Finish Download')