This project is a command-line tool that fetches web pages, saves them to disk for later retrieval and browsing, and can display metadata about the fetched pages.
- Fetch and save complete web pages, including assets (images, CSS, JavaScript)
- Display metadata about fetched pages (number of links, images, last fetch time)
- Save metadata to disk for quick retrieval
- Support for fetching multiple URLs in a single command
- Docker
- Clone this repository
- Build the Docker image:
docker build -t fetch .
- Run the app:
docker run --rm -v $(pwd):/app fetch https://www.example.com https://another-example.com
- Fetch metadata
docker run --rm -v $(pwd):/app fetch --metadata https://www.example.com https://another-example.com
Some improvements could be made
- Using sqlite for database instead of JSON file would make the metadata storage more robust
- Parallelising the download of assets would speed up the fetching process
- Adding a cache layer to reduce the number of requests to the same URL
- Adding a progress bar to show the progress of the download
- Adding a way to specify the output directory for the fetched pages
- Add a more friendly command for running the project
Added unit tests that run at build time (During Docker build) Else they can be run with this command:
docker run --rm --entrypoint python fetch-app -m unittest test_fetch.py
Rougly 65 minutes