[Python] Phrack Magazines downloader
#1
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.

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
Reply
#2
Thank you for this Smile I'll definetly use it, need a specific issue.
Reply
#3
Nice little script, definitely a keeper!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Ebook Collection [89 Files] Insider 15 90,624 08-12-2021, 08:02 PM
Last Post: zzeuss
  NSA Python Training Insider 4 29,813 08-12-2021, 02:14 AM
Last Post: hworth
  Having an issue writing a python script with vim FancyBear 4 23,536 01-03-2021, 11:27 PM
Last Post: FancyBear
  Python Data structures and algorithms resources skinnyj0shua 1 18,044 12-23-2020, 12:52 PM
Last Post: enmafia2