Personal Threads Saved Posts Organization Tool
A personal tool for fetching, classifying, and browsing Threads saved posts. Automatically classify posts with OpenAI and provides a clean web interface for viewing and filtering.
- Auto Fetch Saved Posts: Use Playwright automation to scrape Threads saved posts
- AI Smart Classification: Use OpenAI to automatically classify posts and generate keyword tags
- Responsive Interface: Beautiful React + Tailwind CSS interface, supports mobile and desktop
- Tag Filtering: Support category and keyword filtering, quickly find desired posts
- Search Function: Support post content and author name search
- Statistics: Display post count and filter status
- Python >=3.11
- uv - Fast Python package manager
- Playwright - Browser automation
- OpenAI SDK - Post classification and keyword generation
- React 19
- TypeScript
- Tailwind CSS v4
- Vite
- JSON - Lightweight data storage
- Static Deployment
Create .env file from example:
cp .env.example .envThen edit .env and add your OpenAI API key:
OPENAI_API_KEY=your_openai_api_key_hereSave Threads cookies to cookies.json (refer to cookies.example.json)
1. Install uv
# macOS/Linux
brew install uv
# or using curl
curl -LsSf https://astral.sh/uv/install.sh | sh2. Install Python Dependencies
uv sync
uv run playwright install chromium3. Install Node.js Dependencies
npm installRequirements: Ensure .env and cookies.json are ready (see Prerequisites above).
# One-command setup
docker-compose upAccess frontend at http://localhost:5173
1. Create virtual environment
python3 -m venv .venv
source .venv/bin/activate2. Install dependencies
pip install -e .
playwright install chromium3. Install Node.js Dependencies
npm installPrerequisites: Complete the Installation & Setup section above first.
Step 1: Fetch Saved Posts
uv run python scripts/fetch_saved_posts.pyStep 2: Classify Posts
uv run python scripts/classify.pyStep 3: Start Frontend
npm run devFrontend will start at http://localhost:5173
# Start all services together
docker-compose up
# Or run scripts separately
docker-compose run python-scripts python scripts/fetch_saved_posts.py
docker-compose run python-scripts python scripts/classify.py
# Start frontend only
docker-compose up frontendFrontend will start at http://localhost:5173
Activate virtual environment first:
source .venv/bin/activateThen run:
# Fetch posts
python scripts/fetch_saved_posts.py
# Classify posts
python scripts/classify.py
# Start frontend
npm run devthread-tidy/
├── scripts/
│ ├── fetch_saved_posts.py # Fetch saved posts
│ ├── classify.py # AI classify posts
│ ├── classification_prompt.py # Classification prompt templates
│ └── estimate_cost.py # Estimate classification costs
├── src/
│ ├── App.jsx # Main React component
│ ├── main.tsx # React entry point
│ └── index.css # Style file
├── public/
│ ├── posts.json # Posts data (gitignored)
│ └── posts.example.json # Data format example
├── cookies.json # Threads login info (gitignored)
├── cookies.example.json # Login info example
├── pyproject.toml # Python project config (PEP 621)
├── uv.lock # Python dependency lock file
├── package.json # Node.js dependencies
├── Dockerfile.python # Docker config for Python scripts
├── Dockerfile.frontend # Docker config for React frontend
├── docker-compose.yml # Docker orchestration
├── vite.config.ts # Vite configuration
├── tailwind.config.js # Tailwind configuration
└── README.md # Project documentation
Post data is stored in public/posts.json with the following format:
[
{
"post_id": "abc123",
"url": "https://www.threads.net/post/abc123",
"author": {
"username": "myname",
"display_name": "My Name"
},
"content": "I tried a new ramen shop, it was great!",
"media": [
{"type": "image", "url": "https://..."}
],
"timestamp": "2024-06-01T15:00:00Z",
"saved_at": "2024-06-05T10:20:00Z",
"categories": ["Food", "Travel"],
"keywords": ["ramen", "Taipei"]
}
]- Search Box: Search post content and authors
- Tag Filtering:
- 📂 Category tags
- 🏷️ Keyword tags
- Post Display:
- Author info and time
- Post content
- Category and keyword tags
- Click tags to filter
- Support multiple filters
- One-click clear all filters
- Keyword tags display toggle
# Development mode
npm run dev
# Build
npm run build
# Preview build
npm run previewThis is a personal project developed with assistance from Claude AI. Suggestions and improvements are welcome.
MIT License
Happy using! 🎉