Last active
January 3, 2021 00:30
-
-
Save drego85/9dd1e7030dc8b6821b34f0403cbc72b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
line 82: manca la parentesi tonda chiusa al print
Grazie!
line 82: manca la parentesi tonda chiusa al print
Grazie!
Grazie a te per questo utile script
Ciao Antonio,
sono necessari i seguenti moduli:
requests
bs4
che puoi installare con pip:
pip3 install requests bs4
Andrea
Il 02/01/21 18:41, Antonio-C ha scritto:
… ***@***.**** commented on this gist.
------------------------------------------------------------------------
Buonasera,
scusate la poca competenza.. Pycharm non riconosce il modulo requests
alla riga 13 nè i contenuti della riga 14...
Immagino di dover predisporre meglio l'ambiente. Potete indicarmi quale
modulo o libreria occorra rendere disponibile?
Grazie,
Antonio
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/9dd1e7030dc8b6821b34f0403cbc72b4#gistcomment-3579981>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPKBQMETLS7ZZFMPOUI6WDSX5LFBANCNFSM4UK5VPNA>.
Grazie mille! Seguito la procedura e tutto ha funzionato perfettamente.
Buon Anno! A
Il Dom 3 Gen 2021, 00:05 Andrea Draghetti <[email protected]> ha
scritto:
… ***@***.**** commented on this gist.
------------------------------
Ciao Antonio,
sono necessari i seguenti moduli:
requests
bs4
che puoi installare con pip:
pip3 install requests bs4
Andrea
Il 02/01/21 18:41, Antonio-C ha scritto:
> ***@***.**** commented on this gist.
> ------------------------------------------------------------------------
>
> Buonasera,
> scusate la poca competenza.. Pycharm non riconosce il modulo requests
> alla riga 13 nè i contenuti della riga 14...
> Immagino di dover predisporre meglio l'ambiente. Potete indicarmi quale
> modulo o libreria occorra rendere disponibile?
> Grazie,
>
> Antonio
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <
https://gist.github.com/9dd1e7030dc8b6821b34f0403cbc72b4#gistcomment-3579981>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAPKBQMETLS7ZZFMPOUI6WDSX5LFBANCNFSM4UK5VPNA
>.
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://gist.github.com/9dd1e7030dc8b6821b34f0403cbc72b4#gistcomment-3580155>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKOGK4YI767KXVNEDAHQM3SX6RCJANCNFSM4UK5VPNA>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 82: manca la parentesi tonda chiusa al print