Where do my Twitter friends live?
Small World downloads everyone you follow on Twitter/X and displays them in a searchable, filterable list and interactive map ā all running as a single serverless app on Val Town.
š Live demo
The app has three parts:
A lightweight wrapper around the TwitterAPI.io API that handles:
A script you run to populate your database. It:
friends SQLite table with profile info (name, handle, location, bio, avatar, follower count, etc.)An HTTP endpoint that serves a full-featured HTML interface with:
Fork this val ā Click "Fork" on the val page to get your own copy
Set your API key ā Add an environment variable called twitterapi_key with your TwitterAPI.io key (Val Settings ā Environment Variables)
Create the database table ā Run this SQL in your val's SQLite console or via a script:
CREATE TABLE IF NOT EXISTS friends (
id TEXT PRIMARY KEY,
user_name TEXT NOT NULL,
name TEXT NOT NULL,
location TEXT,
description TEXT,
url TEXT,
profile_picture TEXT,
cover_picture TEXT,
is_blue_verified INTEGER DEFAULT 0,
verified_type TEXT,
followers_count INTEGER DEFAULT 0,
following_count INTEGER DEFAULT 0,
statuses_count INTEGER DEFAULT 0,
favourites_count INTEGER DEFAULT 0,
media_count INTEGER DEFAULT 0,
created_at TEXT,
is_automated INTEGER DEFAULT 0,
downloaded_at TEXT NOT NULL DEFAULT (datetime('now'))
);
Update the username ā In download-friends.ts, change USERNAME to your Twitter handle. In main.ts, update the title/heading to your own name.
Download your friends ā Run download-friends.ts as a script. This will take a few minutes depending on how many people you follow (the API has rate limits of ~1 request per 5 seconds).
Visit your app ā Open the HTTP endpoint URL for main.ts to see your friends list and map!
GEO_DICT geocoding dictionary in main.ts for better map coveragedownload-friends.ts to an interval val to auto-refresh weekly