Politix-Sweden is a tool designed to monitor and visualize the social media presence of high-ranking Swedish members of parliament (Riksdagsledamöter). It tracks activity across X (formerly Twitter), Bluesky, and Mastodon to provide insights into how political communication is shifting across platforms.
The tool is inspired by a similar initiative by Maël Thomas in France and after getting started, I also discovered leavex.eu after I started, which has the explicit purpose of calling out politicians still on X.
The Swedish researcher Carl Heath has published several articles on the risk of keeping the Swedish democratic debate on X and calls for politicians and journalists to exit the platform. The goal of Politix-Sweden is to accelerate this exit and to fuel the wider debate on where democratic debates happen in our digital society with quantitative data. Since it comes from Wikidata and has been thoroughly completed, it is available for anyone to reuse and I hope researchers and journalists find it interesting.
- Politician Metadata: The list of politicians, their party affiliations, and social media handles are fetched directly from Wikidata using a SPARQL query.
- Activity Data: The "last post" dates are scraped or fetched via public APIs for each platform.
- Accuracy: Since handles are sourced from Wikidata, the data is only as accurate as its community-maintained source. Users are encouraged to click "Edit on Wikidata" in the dashboard to fix missing or incorrect information.
The project exports a structured data.json file nightly. You are free to reuse this data for research or other visualizations.
id: The Wikidata Q-identifier.last_check: ISO timestamp of the last time social data was successfully updated.social: Contains handles andlast_postdates (ISO format, "closed", or "protected").
This project is a monorepo consisting of a Python scraper and a Next.js frontend.
- uv (Python package manager)
- Node.js & npm
The scraper manages its own virtual environment using uv.
-
Setup:
uv sync
-
Configuration: Create a
.envfile in the root with your X credentials (if you intend to scrape X activity):X1_USERNAME=your_username X1_EMAIL=your_email X1_PASSWORD=your_password
-
Run:
uv run scraper.py
The frontend is located in the frontend/ directory.
-
Setup:
cd frontend npm install -
Run Development Server:
npm run dev
-
Build Static Site:
npm run build
Since the data is mostly from Wikidata, its license is CC0. Don't hesitate to link back to this project though. The code source is under AGPLv3.