Skip to content

Instantly share code, notes, and snippets.

@drego85
Last active January 3, 2021 00:30
Show Gist options
  • Save drego85/9dd1e7030dc8b6821b34f0403cbc72b4 to your computer and use it in GitHub Desktop.
Save drego85/9dd1e7030dc8b6821b34f0403cbc72b4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
#
# Python script per il download immediato di tutti i
# numeri di Nuova Elettronica resi disponibili da
# Roberto Bizzarri: https://www.robertobizzarri.net
#
# Made with ♥ by Andrea Draghetti
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 3 (the ``GPL'').
#
import os
import requests
from bs4 import BeautifulSoup
os.makedirs("Fascicoli", exist_ok=True)
os.makedirs("Extra", exist_ok=True)
# Download Fascicoli
url = "https://www.robertobizzarri.net/download/?dir=NuovaElettronica/Fascicoli"
r = requests.get(url)
soupr = BeautifulSoup(r.text, "html.parser")
for link in soupr.find_all("a", onclick=True):
link = link["onclick"]
link = link.replace("myFunction('", "")
link = link.replace("')", "")
if link.endswith(".pdf"):
url = "https://www.robertobizzarri.net/download/" + link
filename = link.replace("download.php?file=NuovaElettronica%2FFascicoli%2F", "")
print("[+] Download: " + filename)
r = requests.get(url)
if r.status_code == 200:
with open("Fascicoli/" + filename, "wb") as f:
f.write(r.content)
# Download Extra
url = "https://www.robertobizzarri.net/download/?dir=NuovaElettronica/Extra"
r = requests.get(url)
soupr = BeautifulSoup(r.text, "html.parser")
for link in soupr.find_all("a", onclick=True):
link = link["onclick"]
link = link.replace("myFunction('", "")
link = link.replace("')", "")
if link.endswith(".pdf"):
url = "https://www.robertobizzarri.net/download/" + link
filename = link.replace("download.php?file=NuovaElettronica%2FExtra%2F", "")
filename = filename.replace("+", " ")
filename = filename.replace("%27", " ")
filename = filename.replace("%28", "")
filename = filename.replace("%29", "")
print("[+] Download: " + filename)
r = requests.get(url)
if r.status_code == 200:
with open("Extra/" + filename, "wb") as f:
f.write(r.content)
# Download Elenco di tutti i Kit
url = "https://www.robertobizzarri.net/download/download.php?file=NuovaElettronica%2FNuova+elettronica.xls"
print("[+] Download: Nuova elettronica.xls")
r = requests.get(url)
if r.status_code == 200:
with open("Nuova elettronica.xls", "wb") as f:
f.write(r.content)
@biank88
Copy link

biank88 commented Dec 2, 2020

line 82: manca la parentesi tonda chiusa al print

@drego85
Copy link
Author

drego85 commented Dec 2, 2020

line 82: manca la parentesi tonda chiusa al print

Grazie!

@biank88
Copy link

biank88 commented Dec 2, 2020

line 82: manca la parentesi tonda chiusa al print

Grazie!

Grazie a te per questo utile script

@drego85
Copy link
Author

drego85 commented Jan 2, 2021 via email

@Antonio-C
Copy link

Antonio-C commented Jan 3, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment