Skip to content

makhele/HAR-to-book

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HAR-to-Book

License GitHub stars Buy Me a Coffee

HAR-to-Book is a Python script that converts a HAR (HTTP Archive) file into a book by extracting images from the HAR file and generating a PDF document.

Features

  • Converts a HAR file into a book
  • Extracts images from the HAR file
  • Generates a PDF document from the extracted images

How it Works

The main.py script takes a .har file and creates a book from the images contained within it. The HAR file is a JSON file that stores all the requests made, including the images represented as Base64 strings.

Prerequisites

Before running the script, follow these steps:

  1. Go to the website where you want to create a book.
  2. Open the browser's Developer Tools by right-clicking anywhere on the page and selecting the "Inspect" option.
  3. Switch to the "Network" tab in the Developer Tools and minimize it.
  4. Manually browse through the book, clicking the next button as quickly as possible (you don't have to wait for each image to load).
    • Tip: Zoom in for high-quality images.
  5. Once you reach the last page, look for a button to download the .HAR file.
    • This file contains all the requests you made, including the images stored as Base64 strings.
    • Save the file in the "raw" folder and rename it to "book.json".

Usage

  1. Download the original .har, book.json, and deep.pdf files from the Google Drive.
  2. Make sure you have the following dependencies installed:
    • Python 3
    • Pillow library: Install it by running the command python3 -m pip install --upgrade Pillow.
  3. Run the script by executing the following command in your terminal or command prompt: python3 main.py.
  4. The script will perform the following actions:
    • Convert the book.json file into a more manageable format and save it as sample.json.
    • Remove unnecessary data from sample.json and save the modified version as sample2.json.
    • Convert all Base64-encoded images in sample2.json into PNG files and save them in the "pageImages" folder.
    • Combine all PNG images into a single PDF document named deep.pdf.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages