Skip to content

feat: add OPML import command#12

Open
pastukhov wants to merge 1 commit intoHyaxia:mainfrom
pastukhov:feat/opml-import
Open

feat: add OPML import command#12
pastukhov wants to merge 1 commit intoHyaxia:mainfrom
pastukhov:feat/opml-import

Conversation

@pastukhov
Copy link
Copy Markdown

Summary

  • Add blogwatcher import <file> command to bulk-import blog subscriptions from OPML files (Feedly, Inoreader, NewsBlur, etc.)
  • New internal/opml package: parses OPML 1.0/2.0 with support for non-UTF-8 encodings (ISO-8859-1), nested categories, and mixed outline types
  • Duplicates are gracefully skipped and reported: Imported 44 blogs, skipped 3 duplicates

Details

The parser extracts xmlUrl (feed) and htmlUrl (site) from <outline> elements, recursively traversing categories. Non-feed outlines (type="link", plain text, directories) are ignored.

Tested against:

  • Real Feedly export (100+ subscriptions)
  • All official examples from opml.org (subscriptionList, states, directory, category, placesLived)

Test plan

  • go test ./... — all tests pass
  • Unit tests cover: categories, empty categories, title fallback to text, missing xmlUrl, flat subscription lists (OPML 2.0), non-feed outlines (states, directory, category)
  • Manual test: blogwatcher import feedly-export.opml → imports blogs, skips duplicates
  • Manual test: blogwatcher blogs → imported blogs listed correctly

Add `blogwatcher import <file>` command to bulk-import blog subscriptions
from OPML files (e.g. Feedly, Inoreader exports). The parser handles
OPML 1.0/2.0, non-UTF-8 encodings (ISO-8859-1), nested categories,
and gracefully skips non-feed outlines (links, directories, plain text).
Duplicate blogs are counted and reported rather than causing errors.

Co-Authored-By: Claude <noreply@anthropic.com>
@pastukhov
Copy link
Copy Markdown
Author

Tested with examples from https://opml.org/

JulienTant added a commit to JulienTant/blogwatcher-cli that referenced this pull request Apr 3, 2026
Allow users to import blog subscriptions from OPML files exported by
feed readers like Feedly, Inoreader, and NewsBlur. Duplicates are
gracefully skipped and reported.

Based on upstream PR Hyaxia/blogwatcher#12 by @pastukhov, adapted to
our project patterns (context threading, testify, squirrel, etc.).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
JulienTant added a commit to JulienTant/blogwatcher-cli that referenced this pull request Apr 4, 2026
* Add OPML import command for bulk blog subscriptions

Allow users to import blog subscriptions from OPML files exported by
feed readers like Feedly, Inoreader, and NewsBlur. Duplicates are
gracefully skipped and reported.

Based on upstream PR Hyaxia/blogwatcher#12 by @pastukhov, adapted to
our project patterns (context threading, testify, squirrel, etc.).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fall back to site URL when OPML feed title is empty

Prevents multiple untitled feeds from colliding on empty name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant