Simple and powerful Python script to look for keywords and download files from AndroidFileHost by imitating their API calls. Supports downloading from multiple pages, mirror selection and sorting pages.
AFH is slowly dying, which means a lot of ROMs, kernels and whatnot will be forever gone if we don't archive them elsewhere. This script makes everything a lot easier.
Get the requirements: pip install httpx h2 beautifulsoup4
And run the script.
You can also check the releases page to download precompiled executables for your platform if you don't want to install Python. Releases are created automatically using GitHub Actions and mostly untested, so please create an issue if you encounter a problem.
Lastly, you can install the PyPi distribution globally by running pip install AndroidFileHostScraper. You can then call it via either AndroidFileHostScraper or afhscraper in your terminal.
Just run the tool, search for keywords, select your preferences and wait. The scraper will automatically go through the files and download them.
Downloads can be found within the root directory of the script.
AFHScraper V2.0.0 and later can take positional arguements and run like a CLI tool.
options:
-h, --help show this help message and exit
-s, --search SEARCH Search terms (comma-separated)
--sort {newest,popular}
Sort order (newest or popular)
-n, --files FILES Maximum files to download per search term
-m, --mirror {usa,germany}
Preferred mirror location
-t, --threads THREADS
Number of concurrent downloads (default: 1)
-o, --output OUTPUT Download directory
-l, --log-level {DEBUG,INFO,WARNING,ERROR}
Logging level (default: INFO)
This can be used to automate downloads. It also lets the user to specify an output directory unlike the interactive mode.
For example, to download the first 20 most popular files each from "twrp" and "lineage" searches with 5 threads from a USA server with DEBUG level outputs:
python AFHscraper.py -s "twrp,lineage" --sort popular -n 20 -t 5 -m usa -l DEBUG
And so on.
Enjoy my work? Please consider a small donation!