01-05-2017, 08:56 PM
(This post was last modified: 01-05-2017, 08:57 PM by Psycho_Coder.)
A simple script to download Phrack Issues. I skipped some of the formalities, like, how many issues will be downloaded?, if it is already present or not? and blah blah. The code is pretty simple. Move to the directory where you want to save them and run this python script there and you're done. You are free to improve the code as you wish. Code is tested with python 3 only.
Jupyter Notebook Link: https://github.com/AnimeshShaw/MyJupyter...ader.ipynb
Code:
import re
import shutil
from urllib.request import urlopen, urlretrieve
BASE_URL = "http://phrack.org/archives/tgz/"
with urlopen(BASE_URL) as resp:
html = resp.read()
links = re.findall(r'<A HREF="(.*?)">', str(html))[5:]
shutil.os.mkdir('phrack-files')
shutil.os.chdir('phrack-files')
for link in links:
print('Now downloading: ' + link)
if not shutil.os.path.exists(link):
with urlopen(BASE_URL + link) as resp, open(link, 'wb') as fobj:
shutil.copyfileobj(resp, fobj)
print("\nDownload Complete.")
Jupyter Notebook Link: https://github.com/AnimeshShaw/MyJupyter...ader.ipynb