Lire en français
This Python script automates the process of downloading and renaming scanned mails from the ESP-xxxx WOISA portal.
xxxx is usually the name of the domiciliary company you have subscribed to.
For security purpose, you will need to login manually on the website as usual in your browser.
Then, find your session cookie, paste it in the config.ini
and you are ready to save hours!
- Python 3.7 or higher
- pip (Python package installer)
- Clone this repository or download the script files.
- Install the required Python packages:
pip install requests beautifulsoup4
- Duplicate
config.ini.dist
and rename itconfig.ini
. - Open the
config.ini
file and update the following settings:Cookie
: name and value (see below for instructions)Scraping
: start and end page numbersPaths
: directory to save downloaded filesURLs
: base URL and document page URL
To use this script, you need to provide a valid session cookie. Here's how to get it:
- Open Chrome and log in to the ESP-xxxx portal.
- Once logged in, press F12 to open Developer Tools.
- Go to the "Application" tab.
- In the left sidebar, expand "Cookies" and click on the ESP-xxxx URL.
- Look for a cookie named
POLYxxxxxxxx
(or similar). - Copy the cookie's value and paste it into the
config.ini
file.
Below is a screenshot of the Chrome browser. The steps are near identical in Microsoft Edge, Firefox, Safari, Brave...
Run the script using Python:
python scraper.py
The script will:
- Read the configuration from
config.ini
- Connect to the ESP-xxxx portal using the provided cookie
- Navigate through the specified pages
- Download all available documents
- Save the documents in the specified directory withe the cleaned up upload date and time
- Log all activities to
debug.log
Below is a screenshot of the log file.
If you encounter any issues:
- Check the
debug.log
file for error messages. - Ensure your cookie is valid and not expired.
- Verify that the URLs in
config.ini
are correct.
This script is for personal use only. Ensure you have the right to access and download these documents. Use responsibly and in accordance with ESP-xxxx's terms of service.
Pour générer de nouveaux GIF :
gif_screen_source.png
: the source screenshot.gif_screen_result.png
: the result screenshot.hero.gif
: the generated GIF.
pip install Pillow imageio
cd img
python gif-generator.py