Giter VIP home page Giter VIP logo

archive-downloader's Introduction

Archive-downloader

Archive-downloader is a python package for downloading files on archive.org. It uses Beautiful Soup 4 and wget to extract links from the HTML and download the files.

Requirement

This script uses pandas and Beautiful Soup 4. To install the libraries:
pip install bs4 pandas

Usage

Everything is done through the ArchiveDownloader class. To initate, simply use the URL and the destination directory as input.

from archive_downloader import ArchiveDownloader

# Both /details/ and /download/ are supported:
input_url = 'https://archive.org/details/KSC-KSC-69P-168'  # Str

download_directory_path = '~/Desktop/download'  # Str

test_dl = ArchiveDownloader(input_url, download_directory_path)

To download all the files:

test_dl.get()

You should find this photo of the S-1C booster for the Apollo 11 Saturn V rocket in the specified destination directory.

To download only some of files by file extension, first uses the generate_config_file method to generate a configuration file:

test_dl.generate_config_file(filename='test_dl.config')
# Default filename is archive_downloader.config

This will generate a config file listing all the files to be downloaded. The default is not to download any files ('N'). This can be changed by setting default_download=True above.

To select files by their file extension and download them:

test_dl.edit_config_file('extension', 'jpg', set_download=True, filename='test_dl.config')
test_dl.get(config_file='test_dl.config')

Only .jpg files will be downloaded to the specified destination directory.

To-do

  • Add a configuration file option to let the user to download only some of the files in the URL. (Done!)

Known Issues

  • Archive-downloader has some issues dealing with filenames that have Unicode characters. wget will throw an illegal byte sequence error when saving the file. To deal with this, one can change the LC_CTYPE and LANG variables of the shell.

archive-downloader's People

Contributors

jeffreyrdcs avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

archive-downloader's Issues

How to use?

How do I actually use this script? Executing python3 archive_downloader.py results in import bs4 ModuleNotFoundError: No module named 'bs4' .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.