Empresia.es is a free Spanish company directory built on the Commercial Registry. Every company has a report with its CIF, CNAE activity code, share capital, sales band, employees, address, phones, board, officers and the announcements it published in the BORME (Spain's Official Gazette of the Commercial Registry). It also lists, day by day and province by province, every company that was incorporated, dissolved or changed its capital. For lead generation, KYC or market research, that is a clean B2B dataset. Here is how to pull it into Python, and what to watch out for.
Why not plain requests
import requests
r = requests.get("https://www.empresia.es/empresa/mercadona/")
print(r.status_code) # 200, for now
Empresia renders everything on the server, so a single request works. The problem starts at volume: the site sits behind Cloudflare, and a crawl of thousands of company pages from one IP is exactly what gets throttled. Sending each request through Scrape.do rotates the IP on every call and retries failures. A plain request is enough, no extra parameters: 1 credit per page, about 2 seconds.
TOKEN = "<your_token>"
def fetch(url):
r = requests.get("https://api.scrape.do/", params={"token": TOKEN, "url": url}, timeout=60)
r.raise_for_status()
return r.text
Where the data is on a company page
There is no JSON-LD and no API behind the page. The data sits in a few predictable blocks:
-
div.datos-ident: name, phones, fax, address, websites and e-mail, then label/value pairs (span.list-group-item-headingfollowed byp.list-group-item-text) for CIF, incorporation date, share capital, sales band, registry, last filed accounts, employees, governing body and auditor. -
#organigrama: the board, oneliper person with the role after the link. -
#ListaRelaciones: officers with appointment and removal dates. -
#ListaEventos: the BORME timeline (changes of address, appointments, capital increases), each with a link to the official PDF.
Two details catch people out. The e-mail is not in the HTML as text: Cloudflare replaces it with [email protected] and a data-cfemail attribute, a hex string whose first byte is the XOR key for the rest. And the sales figure is a band ("Superior a 2.500.000 euros"), kept in the title of a tooltip, not in the visible text.
from bs4 import BeautifulSoup
def decode_cfemail(hex_str):
data = bytes.fromhex(hex_str)
return bytes(b ^ data[0] for b in data[1:]).decode()
def company(slug):
soup = BeautifulSoup(fetch(f"https://www.empresia.es/empresa/{slug}/"), "html.parser")
box = soup.select_one("div.datos-ident")
fields = {}
for label in box.select("span.list-group-item-heading"):
value = label.find_next_sibling("p", class_="list-group-item-text")
if value:
fields[label.get_text(strip=True)] = value
purpose, _, cnae = fields["Objeto social"].get_text("\n", strip=True).partition("\nCNAE ")
sales = fields["Ventas"].select_one("[title]")
email = box.select_one("[data-cfemail]")
return {
"name": box.select_one("span.bolder").get_text(strip=True),
"cif": fields["CIF"].get_text(strip=True),
"cnae": cnae,
"purpose": purpose,
"capital": fields["Capital social"].get_text(strip=True),
"sales_band": sales["title"] if sales else "",
"employees": fields["Número empleados"].get_text(strip=True),
"registry": fields["Registro"].get_text(strip=True),
"email": decode_cfemail(email["data-cfemail"]) if email else "",
"board": [(a.get_text(strip=True), a.find_next_sibling(string=True).strip())
for a in soup.select("#organigrama li a")],
}
In a live run on Mercadona this returned the CIF, CNAE 4711, the sales band, 108,742 employees, the registry (Valencia), the decoded e-mail and 13 board members, from one request. Values Empresia shows as - (Mercadona's share capital, for example) come back as -, so clean them before loading the data anywhere.
Every new company, every day
The most useful part of Empresia for lead generation is the BORME by day. Each weekday the gazette publishes every incorporation, and Empresia lists them by act and province:
/borme/fecha/2026-11-13/acto/constitucion/provincia/barcelona/
Change constitucion to disolucion, ampliacion-de-capital, cambio-de-domicilio-social or nombramientos for other acts. On 13 November 2026 there were 41 act types across 34 provinces, and Barcelona alone had 71 new companies. Each row links to the announcement, which has a small table with the registry, start date, share capital, corporate purpose and registered address:
import csv
BASE = "https://www.empresia.es"
def new_companies(date, province):
url = f"{BASE}/borme/fecha/{date}/acto/constitucion/provincia/{province}/"
soup = BeautifulSoup(fetch(url), "html.parser")
for row in soup.select("#contenido table tbody tr"):
name = row.select_one("a.lk")
event = row.select_one('a[href*="/evento/"]')
yield name.get_text(strip=True), BASE + event["href"]
def announcement(url):
soup = BeautifulSoup(fetch(url), "html.parser")
cells = [td.get_text(" ", strip=True) for td in soup.select("div.eventonly table td")]
return dict(zip(cells[::2], cells[1::2]))
with open("new_companies.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(["company", "registry", "start", "capital", "purpose", "address"])
for name, link in new_companies("2026-11-13", "barcelona"):
d = announcement(link)
writer.writerow([name, d.get("Registro"), d.get("Fecha inicio"), d.get("Capital"),
d.get("Objeto social"), d.get("Domicilio")])
That is one request for the list plus one per company: 72 credits for a full day of Barcelona incorporations. Run it on a schedule and you have a daily feed of companies that did not exist last week.
Search, and its ceiling
Search is /busqueda/?q=<text>&pagina=<n>. Results mix companies (EMPRESA), officers (DIRECTIVO) and trademarks (DISTINTIVO), and Empresia stops at 100 results: past the last page it quietly sends page 1 again, so compare the "Mostrando del X al Y" counter before trusting a page. For anything broader than a name, the BORME lists by province are the better entry point.
Skip the code
The same scraper is an open-source package with a CLI:
pip install empresia-scraper
export SCRAPEDO_TOKEN=<your_token>
empresia-scraper telefonica mercadona -f csv -o companies.csv
empresia-scraper --borme 2026-11-13 --province madrid --details -o new_companies.json
Source and tests: github.com/bugrahansss/empresia-scraper
Use the data responsibly
The data comes from public registers, but officers are real people and their names are personal data under the GDPR. Use it for legitimate purposes such as B2B research or KYC, keep only what you need, honour objection requests and respect Empresia's terms.
Run it at scale with Scrape.do
Every page is one plain Scrape.do call with a rotating IP: no proxy pool, no Cloudflare handling, no headless browser. 1,000 company reports cost 1,000 credits. Get 1000 free credits and start scraping with Scrape.do.
Top comments (0)