Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

'Have your Say' scraper

Python version PyPI version GPLv3 license

A small utility to scrape the European Commission's 'Have your Say' plattform (https://ec.europa.eu/info/law/better-regulation/have-your-say). Can scrape an initiative's feedback submissions, attachments of these submissions, and the by country and by category statistics.

Installation

pip3 install hys_scraper

Tested to work with Python 3.9 on a Linux machine and Google Colab notebooks.

Getting started

To get started, you will need the publication id of the initiative you want to scrape. To get this, simply navigate to the initiative on 'Have your Say' and look at the URL - the number at the end is the publication id you will use in the next step. For example, for the AIAct commission adoption initiative, the publication id would be 24212003.

To scrape an initiative the following is sufficient (replace 24212003 with the publication id of the initiative you want to scrape):

python3 -m hys_scraper 24212003

This will create a new folder in your current working directory with the following layout:

24212003_requirements_for_artificial_intelligence/
├── attachments
│   ├── 2488672.pdf
│   ├── 2596917.pdf
│   └── ...
├── attachments.csv
├── categories.csv
├── countries.csv
└── feedbacks.csv

1 directory, 263 files

Advanced usage

The command line interface has a few more arguments. For example instead of having hys_scraper create a folder in the local working directory to save results into, you can also manually specify a target directory.

$ python3 -m hys_scraper -h
Scrape feedback and statistics from the European Commission's 'Have your Say' plattform.

positional arguments:
  PID                   The publication id - what comes after 'p_id=' in the initiative's URL.

optional arguments:
  -h, --help            show this help message and exit
  --dir target_dir, --target_dir target_dir
                        Directory to save the feedback and statistics dataframes to. Defaults to creating a new
                        folder in the current working directory.
  --no_attachments      Whether to skip the download of attachments.
  --sleep_time t        Minimum time between consecutive HTTP requests (in seconds).

Alternatively, you can also access hys_scraper from Python:

from hys_scraper import HYS_Scraper
feedbacks, countries, categories = HYS_Scraper("24212003").scrape()

Similar options are available as for the command line interface, check out help(HYS_Scraper) for details.

Release files for hys-scraper 0.1.33

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hys-scraper 0.1.33
File Size Uploaded
hys_scraper-0.1.33.tar.gz 20.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hys-scraper 0.1.33
File Interpreter ABI Platform
hys_scraper-0.1.33-py3-none-any.whl Python 3 none any Details

Total release size: 41.4 kB

Release files / hys_scraper-0.1.33.tar.gz

Download URL hys_scraper-0.1.33.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7f624accecf120dc3ec45d8d8e821d35c71ed26dfea4b3c4b958e71a5fff47aa
BLAKE2b-256 checksum
How to use checksums
43fea39e380132cfeed0b52784cad5f02a62f7dddddefdef4d3762badfbb0f33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / hys_scraper-0.1.33-py3-none-any.whl

Download URL hys_scraper-0.1.33-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3424a9c20aae019fe4b2ae086521660e9905e6786c8bf3fbff9845f1856a73c1
BLAKE2b-256 checksum
How to use checksums
c6ec6af921ac0c82bbf04ae999769fe7e4081ae35cc8c3c3a6d9d2170d0a7d96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page