Skip to main content

reels-wiki logo

reels-wiki

CI Release Please GitHub Pages GitHub Release PyPI Python License: MIT Homebrew

Local-first pipeline that converts saved Instagram Reels into atomic Markdown notes inside an existing 3-layer Obsidian LLM Wiki vault without duplicates.

Available interfaces: Python SDK (reels_wiki), CLI (reels-sync), MCP server (reels-wiki-mcp), Telegram capture bot (reels-wiki-telegram), and Agent Skill (SKILL.md).

Table of Contents

Quick Start

Prerequisites: Python 3.10 or newer and ffmpeg on your PATH. ffmpeg is only required when audio or frame fallbacks run.

Step 1: Clone and install

git clone https://github.com/AtaCanYmc/reels-secretary.git
cd reels-secretary
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

To enable offline audio transcription with faster-whisper, include the local extra:

pip install -e ".[dev,local]"

Step 2: Configure your vault path

Copy the example configuration and set vault_path to your Obsidian LLM Wiki root directory:

cp config.example.yaml config.yaml

reels-wiki searches for configuration files in this order:

  1. --config <path> CLI flag
  2. $REELS_WIKI_CONFIG environment variable
  3. ./config.yaml in the current working directory
  4. ~/.config/reels-wiki/config.yaml

You can override vault_path at runtime with --vault <path> or $REELS_WIKI_VAULT. Unknown keys in config.yaml are rejected on load to catch typos early.

Step 3: Add API keys in .env

Create a .env file in the project root with your provider credentials:

GROQ_API_KEY=your_groq_api_key
GEMINI_API_KEY=your_gemini_api_key

# Optional: only required for the Telegram capture bot
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_ALLOWED_CHAT_ID=123456789

Step 4: Set up Instagram authentication

Instagram blocks anonymous scraping. Choose one authentication method under the extraction: section in config.yaml:

  • cookies_from_browser: chrome: reads your active browser session via yt-dlp. Also supports firefox or profile syntax such as "chrome:Profile 1".
  • cookies_file: ~/cookies.txt: reads a Netscape-format cookie export file.

Keep delay_seconds at 2.0 or higher, process items in small batches, and keep yt-dlp updated with pip install -U yt-dlp.

Step 5: Verify the installation

Run the queue statistics command to verify configuration loading and vault access:

reels-sync stats

Usage

1. Enqueue a single Reel

reels-sync ingest "https://www.instagram.com/reel/DAbCdEfGhIj/?igsh=xyz"

Duplicate shortcodes are skipped automatically unless --force is passed.

2. Import an Instagram data export

  1. Open Instagram and go to Accounts Center > Your information and permissions > Export your information.
  2. Select JSON format and include Saved items.
  3. Pass the downloaded folder or saved_posts.json file to the importer:
reels-sync import-ig ~/Downloads/instagram-export/

3. Process the queue

Preview pending items before spending LLM or transcription calls:

reels-sync process --dry-run

Run extraction, synthesis, and note writing in batches:

reels-sync process --limit 10

Retry previously failed items:

reels-sync process --retry-failed

4. Reprocess stored artifacts

Re-run LLM synthesis from the saved sources/reels/<shortcode>.json artifact without downloading media or running Whisper again:

reels-sync reprocess DAbCdEfGhIj
reels-sync reprocess --all

5. Inspect queue statistics

reels-sync stats
reels-sync --json stats

When using --json, global flags must appear before the subcommand.

Telegram Capture Bot

  1. Create a bot via @BotFather and retrieve your numeric chat ID via @userinfobot.
  2. Set TELEGRAM_BOT_TOKEN and TELEGRAM_ALLOWED_CHAT_ID in .env.
  3. Start the long-polling listener:
reels-sync telegram

Share a Reel to your bot from the Instagram mobile app. The bot rejects all other chat IDs and refuses to start without TELEGRAM_ALLOWED_CHAT_ID. It only enqueues URLs; schedule reels-sync process via cron or launchd to digest the queue.

MCP Server

Add the server to your MCP client configuration:

{
  "mcpServers": {
    "reels-wiki": {
      "command": "/path/to/reels-secretary/.venv/bin/reels-wiki-mcp",
      "env": {
        "REELS_WIKI_CONFIG": "/path/to/reels-secretary/config.yaml"
      }
    }
  }
}

Exposed MCP tools: enqueue_reel, import_ig_export, process_reels_queue, get_queue_stats.

Python SDK

from reels_wiki import enqueue, load_config, process_queue

cfg = load_config()
enqueue("https://www.instagram.com/reel/DAbCdEfGhIj/", "script", vault=cfg.vault_path)
process_queue(cfg, limit=3)

How It Works

flowchart LR
    A["CLI / Telegram / MCP / IG Export"] --> B["Queue (inbox/reels-queue.jsonl)"]
    B --> C{"Index Dedupe (sources/.reels_index.json)"}
    C -->|"New Shortcode"| D["1. yt-dlp Metadata & Caption"]
    D --> E["2. Audio -> Whisper Transcript"]
    E --> F["3. Frames -> Gemini Vision OCR"]
    F --> G["sources/reels/<shortcode>.json"]
    G --> H{"LLM Synthesis (Noise Filter)"}
    H -->|"should_keep = false"| I["Mark skipped"]
    H -->|"should_keep = true"| J["Write <folder>/<slug>.md"]
    J --> K["Update _index.md & _log.md"]

Step 1: URL normalization and deduplication

Every incoming URL variant (/reel/, /reels/, /p/, /tv/, optional /<user>/, and tracking query parameters) is reduced to its 11-character shortcode and normalized to https://www.instagram.com/reel/<shortcode>/.

sources/.reels_index.json acts as an O(1) lookup gate mapping each shortcode to {status, url, note_path, updated_at}. The queue at inbox/reels-queue.jsonl is append-only, where the last snapshot per shortcode determines the current state. If the index is lost or corrupted, it is rebuilt from the queue. All writes are atomic and guarded by a file lock. Items left in processing after a crash are automatically reset on the next run. A forced re-run reuses the existing note_path and preserves user edits to status and created frontmatter fields.

Step 2: Cost-aware 3-stage waterfall extraction

  1. Metadata: Calls yt_dlp Python API with extract_info(download=False) to retrieve the caption, creator, duration, upload date, and subtitles.
  2. Audio transcription: Runs only when the caption is shorter than min_caption_chars (default 150) and no usable subtitles exist. Audio is downloaded to a temporary directory and transcribed with Groq whisper-large-v3-turbo or local faster-whisper.
  3. Frame OCR: Runs only when both caption and transcript fall below min_caption_chars and min_transcript_chars (default 40). vision_frames (default 4) evenly spaced frames are extracted via ffmpeg and read with gemini-2.5-flash.

Failures in any stage are recorded in the artifact warnings list instead of aborting the pipeline. Reels with zero extracted text are marked skipped without spending an LLM synthesis call. Extracted payloads are stored in sources/reels/<shortcode>.json. No media files are saved inside the vault.

Step 3: Vault discovery and strict enforcement

Before synthesis, reels-wiki reads the vault to discover allowed folders from backticked folder tokens in _CLAUDE.md and _index.md, existing #tags, and existing note titles. sources/ and inbox/ are excluded as output destinations. You can override discovery with allowed_folders in config.yaml.

Model output is validated before writing:

  • Invalid folders fall back to default_folder.
  • File slugs are transliterated to ASCII (including Turkish characters).
  • Tags are normalized against the vault taxonomy.
  • related_wikilinks that do not match an existing note are rendered as plain text (new note candidate) ... to prevent broken links.
  • Notes are written atomically inside the vault path using python-frontmatter.
  • _index.md entries are inserted idempotently under the matching folder heading, and _log.md entries match the file's existing format.

Step 4: Noise filtering and retries

The AtomicNoteSynthesis schema includes a should_keep boolean. Memes, trends, and low-signal posts are marked skipped with skip_reason stored in the index. Malformed JSON responses trigger repair retries and then fall back to fallback_provider if configured.

Repository Layout

reels-secretary/
├── assets/
│   └── logo.png
├── docs/
│   ├── architecture.md
│   ├── cli-and-mcp.md
│   ├── configuration.md
│   ├── example-walkthrough.md
│   ├── step-by-step.md
│   └── troubleshooting.md
├── src/
│   └── reels_wiki/
│       ├── __init__.py
│       ├── cli.py
│       ├── config.py
│       ├── extractor.py
│       ├── ig_export.py
│       ├── mcp_server.py
│       ├── models.py
│       ├── pipeline.py
│       ├── queue_manager.py
│       ├── synthesizer.py
│       ├── telegram_bot.py
│       ├── utils.py
│       ├── vault_context.py
│       └── writer.py
├── tests/
│   ├── test_cli.py
│   ├── test_ig_export.py
│   ├── test_queue_manager.py
│   ├── test_synthesizer.py
│   ├── test_telegram_bot.py
│   └── test_writer.py
├── config.example.yaml
├── Makefile
├── pyproject.toml
└── SKILL.md

Tests run offline via make test (pytest) without making network or LLM API calls.

Documentation and Governance

Notes and Limits

  • Shortcodes are validated as exactly 11 characters ([A-Za-z0-9_-]). Instagram /share/... redirect links are not resolved automatically; open them in a browser first and copy the canonical URL.
  • Carousel and photo posts (/p/) are accepted. yt-dlp may fail on image-only posts, which marks them failed. Use import-ig --reels-only to filter them out during bulk import.
  • Note titles are generated in Turkish for Turkish content and technical English otherwise.
  • Provider integrations for Groq, Google GenAI, and yt-dlp are isolated in extractor.py and synthesizer.py so upstream SDK changes only require edits in those two files.

Metadata

Release files for reels-wiki 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reels-wiki 0.1.2
File Size Uploaded Provenance Actions
reels_wiki-0.1.2.tar.gz 1.1 MB With provenance Details for reels_wiki-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for reels-wiki 0.1.2
File Interpreter ABI Platform Actions
reels_wiki-0.1.2-py3-none-any.whl Python 3 none any Details for reels_wiki-0.1.2-py3-none-any.whl

Total release size: 1.1 MB

Release files / reels_wiki-0.1.2.tar.gz

Download URL reels_wiki-0.1.2.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
e144e4e572880dde9a0343ba4da695da801df8fd292ac32b16d4d9a93564aebb
BLAKE2b-256 checksum
How to use checksums
64d353335c15cc5820a74291fe7e61f1337cee6d24575f0ee7a366a7cae1f614
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / reels_wiki-0.1.2-py3-none-any.whl

Download URL reels_wiki-0.1.2-py3-none-any.whl
Size 42.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4d39911b5f38b2643ad0797b1b11fc1c8f9a99de43bba3b7812eae298679192
BLAKE2b-256 checksum
How to use checksums
a57e0b9cf79f753360379078bf82700604a7cfeea1a87e8d509fce607d10fa78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for reels-wiki 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for reels_wiki-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page