Skip to main content

Archive Ed Discussion courses into RAG-ready JSON

Project description

Ed Archiver

Archive Ed Discussion courses into RAG-ready JSON files.

Features

  • RAG-optimized output - Clean JSON with text, metadata, and quality signals
  • Multi-region support - Works with US, EU, AU Ed instances
  • Preserves media - Extracts image and link URLs from posts
  • Rate-limit handling - Automatic retry with exponential backoff

Installation

git clone https://github.com/eliemada/edstem-archiver.git
cd ed-archiver
uv sync

Setup

  1. Generate an API token at https://edstem.org/us/settings/api-tokens (or your region)
  2. Create a .env file:
    ED_API_TOKEN=your_token_here
    

Usage

# Interactive mode
uv run ed-archiver

# Direct course ID (defaults to US region)
uv run ed-archiver 23247

# Full URL (auto-detects region)
uv run ed-archiver https://edstem.org/eu/courses/1124/discussion/

# Custom output directory
uv run ed-archiver 1124 -o ./data

Output Structure

out/{course_id}/
├── metadata.json
└── threads/
    └── {thread_id}.json

Thread Schema

{
  "id": 124296,
  "type": "question",
  "title": "How to implement X?",
  "category": "Homework 3",
  "subcategory": "",
  "created_at": "2024-03-27T20:33:03Z",
  "is_answered": true,
  "is_pinned": false,
  "is_endorsed": false,
  "vote_count": 5,
  "view_count": 219,
  "reply_count": 3,
  "content": "Plain text content...",
  "images": ["https://static.eu.edusercontent.com/files/..."],
  "links": ["https://example.com/reference"],
  "answers": [
    {
      "id": 185874,
      "content": "Answer text...",
      "images": [],
      "links": [],
      "vote_count": 2,
      "is_endorsed": true,
      "is_accepted": true,
      "created_at": "2024-03-27T21:19:56Z",
      "comments": [...]
    }
  ],
  "full_text": "Concatenated text for embedding..."
}

Metadata Schema

{
  "course_id": "1124",
  "region": "eu",
  "archived_at": "2026-01-25T18:30:00Z",
  "thread_count": 2000,
  "base_url": "https://edstem.org/eu/courses/1124"
}

RAG Integration

The output is designed for RAG pipelines:

Field RAG Use
full_text Direct embedding input
vote_count, is_endorsed Quality ranking signals
category, type Metadata filtering
images Vision-language captioning
base_url + id Source citation URLs

Reconstruct source URLs:

source_url = f"{metadata['base_url']}/discussion/{thread['id']}"
# → "https://edstem.org/eu/courses/1124/discussion/124296"

Acknowledgments

Built on top of edapi by @smartspot2. Thank you for creating and maintaining the unofficial Ed API client.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ed_archiver-0.1.0.tar.gz (43.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ed_archiver-0.1.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file ed_archiver-0.1.0.tar.gz.

File metadata

  • Download URL: ed_archiver-0.1.0.tar.gz
  • Upload date:
  • Size: 43.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ed_archiver-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c9e3224374d11e507ca369961fd3fff6f803f4f427e01084b97925786ffb0e79
MD5 ddb60c63b85f2ae3edc603617a88ba60
BLAKE2b-256 1585820bebfe749f843534fa3018b25d51dce0f1f001334c97379b43a5ced1be

See more details on using hashes here.

File details

Details for the file ed_archiver-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ed_archiver-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ed_archiver-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d91beefc16c371a5f938ffaaa64a38e1cf1c1e337a22eae89453c2d7c042de9
MD5 4905dbf6f9c1c4ca24c4a06fc0802deb
BLAKE2b-256 b7260c60ae77b54e8f5d7766462d78b513123972ffc88c56be1d4286afaf5b8d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page