• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
joost

joost

aita

Remix of std/reactHonoStarter
Public
Like
1
aita
Home
Code
10
.idea
10
.venv
5
backend
2
db
frontend
5
local
3
.gitignore
.vtignore
README.md
deno.json
Branches
1
Pull requests
Remixes
History
Environment variables
1
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
local
/
README.md
Code
/
local
/
README.md
Search
7/23/2025
Viewing readonly version of main branch: v557
View latest version
README.md

Reddit AITA Database Extraction Script

This script extracts the top 100 most popular posts (by score) and all their comments from the AmItheAsshole subreddit database to a new, smaller SQLite database file.

Prerequisites

  • Deno installed on your system
  • Original database file at db/AmItheAsshole.sqlite

Usage

Run the script with the following command:

deno run --allow-read --allow-write extract_top_posts.ts

Alternatively, you can make the script executable and run it directly:

chmod +x extract_top_posts.ts ./extract_top_posts.ts

What the Script Does

  1. Opens the source database (db/AmItheAsshole.sqlite)
  2. Creates a new target database (db/Top100AmItheAsshole.sqlite)
  3. Extracts the top 100 posts from the source database based on score
  4. Extracts all comments associated with those posts
  5. Preserves all original data including IDs, timestamps, and relationships

Database Schema

The script maintains the original schema structure:

Submission Table

CREATE TABLE IF NOT EXISTS "submission" ( "id" INTEGER NOT NULL PRIMARY KEY, "submission_id" VARCHAR(255) NOT NULL, "title" TEXT NOT NULL, "selftext" TEXT NOT NULL, "created_utc" DATE NOT NULL, "permalink" TEXT NOT NULL, "score" INTEGER NOT NULL ); CREATE UNIQUE INDEX "submission_submission_id" ON "submission" ("submission_id");

Comment Table

CREATE TABLE IF NOT EXISTS "comment" ( "id" INTEGER NOT NULL PRIMARY KEY, "submission_id" INTEGER NOT NULL, "message" TEXT NOT NULL, "comment_id" VARCHAR(255) NOT NULL, "parent_id" VARCHAR(255) NOT NULL, "created_utc" DATE NOT NULL, "score" INTEGER NOT NULL, FOREIGN KEY ("submission_id") REFERENCES "submission" ("id") ); CREATE INDEX "comment_submission_id" ON "comment" ("submission_id"); CREATE UNIQUE INDEX "comment_comment_id" ON "comment" ("comment_id");
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.