A python Package for downloading files from websites using the directory listing function
Project description
Directory Downloader
Directory Downloader is a Python library for downloading files from websites using the directory listing function used mostly in apache/nginx and ftp an example can be seen here
Dependencies
Before installation, make sure you have the required dependencies of asyncio, aiohttp, bs4 and colorama.
Installation
Use the package manager pip to install directory_downloader.
pip install directory-downloader
Usage
import asyncio
from directory_downloader import DDownloader
async def main():
url = "https://example.com/directory/"
downloader = DDownloader()
await downloader.crawl(url) # fetch all the links from /directory/
await downloader.download_files() # download all files to current directory
if __name__ == '__main__':
asyncio.run(main())
Advanced Usage
to disable coloring:
downloader = DDownloader(coloring=False)
to disable verbose mode:
downloader = DDownloader(verbose=False)
to change the directory simply add:
downloader.download_files(full_directory=r"C:\Users\User\Desktop")
to make downloads faster you can increase the number of workers (by default 5):
downloader.download_files(workers=5)
note : increasing the number of workers too much can lead to unstable behavior use at your own risk
to fetch file links that have extension of pdf only you can use:
await downloader.crawl(extensions=[".pdf"])
you can also use regex like the following:
await downloader.crawl(filter=r"test\d\d\d\.apk")
to download an existing list of urls you can do as follow:
urls = set(["www.example/example/file1.pdf","www.example/example/file2.pdf",...])
await downloader.download_files(urls=urls)
also you can use filter on downloadable files:
await downloader.download_files(urls=urls,filter=r"test\d\d\d\.apk")
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file directory-downloader-2.0.1.tar.gz
.
File metadata
- Download URL: directory-downloader-2.0.1.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 207312f5e59a18e8840d150b0f1f3fa6b920f5f90d231998310d8f2be76c6c3a |
|
MD5 | 624c6477d32286b32e657baaef88d4aa |
|
BLAKE2b-256 | 28afa8af21a3a067f84392257a3ce120ad4c3accf6f6398bc3841c6a430f1d64 |
File details
Details for the file directory_downloader-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: directory_downloader-2.0.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d749e929c208f954a2e8f6b4c645c964ef12fff839a3555a9922c5152fc0963 |
|
MD5 | 35e5691b6e38728b13a16add61a8fedf |
|
BLAKE2b-256 | 446f8e64d0537ef5ee73cfdf82048b17fce53a4361935f803df1b94132376682 |