Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brubru EU scraper library

Two official Python libraries for working with European Union institutional data through Brubru, by Beresol BV.

  • brubru: the official client for the Brubru EU Data API. It gives you the whole EU institutional data estate behind one key (legislation, procedures, institutions, the social directory, and the input-first extract engine) on a single five-datapoint contract.
  • brubru-eurovoc (import name eurovoc): a standalone, open-source EuroVoc classifier. It tags any text into the EU's official subject space (7,029 descriptors, 127 microthesauri, 21 domains), multilingual including Catalan. A modern successor to the 2021 PyEuroVoc package.

The Brubru EU Data API itself is documented at https://brubru.beresol.eu/api/docs

Install

pip install brubru
pip install "brubru-eurovoc[local]"   # [local] adds the classifier model

brubru: quickstart

import brubru

bru = brubru.Client(api_key="brubru_live_...")

# Extract structured items from any EU institutional URL, optionally EuroVoc-tagged
res = bru.extract("https://cinea.ec.europa.eu/news-events/news_en", classify=True)
for item in res:
    print(item.document_date, item.title, item.public_url)

# Recent posts from a mapped entity (MEP, Commissioner, institution, journalist)
posts = bru.social.posts(entity_type="commissioner", platform="x", limit=20)

Get an API key on the Professional subscription, or contact hello@beresol.eu.

eurovoc: quickstart

import eurovoc

for d in eurovoc.classify("Markets in crypto-assets regulation"):
    print(d.label, "|", d.domain, d.domain_label, "|", round(d.score, 3))

The two libraries interoperate: enrich the descriptors the API returns with eurovoc.from_descriptors(...), or classify a live EU URL through the hosted engine with eurovoc.classify_url(...).

Repository layout

brubru/     the brubru SDK (distribution: brubru)
eurovoc/    the EuroVoc classifier (distribution: brubru-eurovoc, import: eurovoc)

Each package has its own README, pyproject.toml and tests.

Tests

cd brubru  && pip install -e ".[test]"        && pytest -m "not live"
cd eurovoc && pip install -e ".[test,local]"  && pytest -m "not model"

License

MIT. See LICENSE. Built by Beresol BV. EuroVoc is a trademark of the Publications Office of the European Union.

About

Python library that imports all the data from all the URLs of the europa.eu domain ecosystem

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages