feat(instagram): Adapt Instagram support into the new adapter structure#18
Open
borkweb wants to merge 5 commits into
Open
feat(instagram): Adapt Instagram support into the new adapter structure#18borkweb wants to merge 5 commits into
borkweb wants to merge 5 commits into
Conversation
Adds a complete Instagram-to-WordPress migration pipeline using the same CDP-based approach as Wix and Squarespace extractors. Scripts: - scripts/instagram/discover.js: Scroll-based GraphQL interception to inventory all posts with metadata, captions, timestamps, locations - scripts/instagram/extract.js: Per-post extraction with ?img_index=N for carousel slides, deduplication by Instagram media ID - scripts/instagram/import.js: XML-RPC import with wp.uploadFile for media, wp.newPost with featured images, gallery blocks for carousels, correct backdated post dates, and source links to original posts Also includes: - prompts/instagram.md: User-facing migration prompt - tests/instagram.test.js: 32 unit tests covering data transformation, XML-RPC encoding, carousel deduplication, and content generation - DISCOVERIES.md entry documenting key findings - Updated AGENTS.md, README.md, cli.js for Instagram support Tested against a 308-post profile: 364 media files uploaded, all posts imported with correct dates, unique carousel slides in gallery blocks, and featured images. Zero failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts: # .gitignore # AGENTS.md # README.md
Reworks the Instagram support originally added in #4 (by @edequalsawesome) on top of the new adapter/lib architecture introduced in #6. - src/adapters/instagram.ts implementing PlatformAdapter: - discover() scrolls the profile via CDP and intercepts GraphQL responses - extract() visits each post via CDP, walks ?img_index=N for carousel slides (deduped by Instagram media ID), downloads media, and emits wp:image / wp:gallery / wp:video Gutenberg blocks - hashtags become WP tags; @mentions and #hashtags in captions are linked - Registered in src/mcp-server.ts and detect-platform URL patterns - Removed the legacy scripts/instagram/ scripts and tests/instagram.test.js, which targeted the pre-restructure standalone-script entry points - Added test/adapters/instagram.test.ts with a fixture-driven dry-run that exercises the WXR pipeline end to end - Refreshed prompts/instagram.md for the new npm run liberate workflow - Updated README, AGENTS.md, CONTRIBUTING.md, docs/mcp.md to mention Instagram
…ame parsing - cli.js: revert PR #4's Instagram branch — it referenced scripts/instagram/ scripts that no longer exist after restructuring. The legacy CLI is for legacy script entry points only; Instagram is reachable via the adapter. - src/adapters/instagram.ts: parseInstagramUsername now strips path segments from non-URL inputs so 'foo/bar' cannot be smuggled into a navigation URL. - DISCOVERIES.md: rewrite the 'How it works' paragraph for the adapter pipeline instead of the deleted scripts/instagram/ pipeline.
7 tasks
# Conflicts: # AGENTS.md # CONTRIBUTING.md # DISCOVERIES.md # README.md # docs/mcp.md # src/lib/extraction/detect-platform.ts # src/mcp-server.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/adapters/instagram.tsimplementingPlatformAdapter(discover via CDP + GraphQL intercept, extract via?img_index=Ncarousel walk, WXR output withwp:image/wp:gallery/wp:videoblocks)@mentionsand#hashtagsin captions are linkified; each post gets a "View on Instagram" source linkWhat's in the branch
src/adapters/instagram.ts+ registration insrc/mcp-server.tsanddetect-platform.tstest/adapters/instagram.test.ts(20 tests) +test/fixtures/instagram-inventory.json+ new case intest/detect-platform.test.tsscripts/instagram/andtests/instagram.test.js(pre-restructure standalone scripts)prompts/instagram.mdfor thenpm run liberateworkflowREADME.md,AGENTS.md(→CLAUDE.mdsymlink),CONTRIBUTING.md,docs/mcp.md,DISCOVERIES.mdAuthor credit
Branched from @edequalsawesome's commit
337c915so the original Instagram work is preserved in history. Follow-up commits adapt it to the new structure and address review feedback.Test plan
npx vitest run test/adapters/instagram.test.ts test/detect-platform.test.ts— 31/31 passingNote: pre-existing
test/content-differ.test.tsfailures onmainare unrelated and not introduced by this branch.