Skip to content

Feat/add new adapters (douban, sinablog, medium, substack)#185

Merged
jackwener merged 1 commit intojackwener:mainfrom
yuancafe:feat/add-new-adapters
Mar 21, 2026
Merged

Feat/add new adapters (douban, sinablog, medium, substack)#185
jackwener merged 1 commit intojackwener:mainfrom
yuancafe:feat/add-new-adapters

Conversation

@yuancafe
Copy link
Contributor

Summary

This PR adds and migrates the new adapters for:

  • douban
  • sinablog
  • medium
  • substack

All of these adapters are now implemented in TypeScript instead of YAML, and have been locally reviewed and verified.

Included commands

douban

  • book-hot
  • movie-hot
  • search

sinablog

  • hot
  • search
  • article
  • user

medium

  • feed
  • search
  • user

substack

  • feed
  • publication
  • search

Internal fixes

During the migration, I also fixed a few related core issues that affected adapter reliability:

  • prefer TS adapters over duplicate YAML entries during manifest generation
  • skip non-adapter TS files in manifest scanning
  • improve template expression evaluation
  • ensure select runs before map in mixed pipeline steps
  • support inline select inside map

Verification

Build

  • npm run build

Tests

  • npx vitest run src/build-manifest.test.ts src/pipeline/template.test.ts src/pipeline/transform.test.ts src/pipeline/executor.test.ts

Manual command verification

  • medium feed --topic ai
  • medium search --keyword ai
  • medium user --username canartuc
  • substack feed --category tech
  • substack publication --url https://ruben.substack.com
  • substack search --keyword 'claude code' --type posts
  • substack search --keyword claude --type publications
  • sinablog hot
  • sinablog search --keyword 冯矿伟
  • sinablog article --url https://blog.sina.com.cn/s/blog_59b3f4ee0102zjjw.html
  • sinablog user --uid 1504965870
  • douban book-hot
  • douban movie-hot
  • douban search --type book --keyword 三体
  • douban search --type movie --keyword 霸王别姬
  • douban search --type music --keyword 周杰伦

@jackwener
Copy link
Owner

jackwener commented Mar 21, 2026

你可以 pull rebase 到最新的代码吗,并且尽量少改动除了 clis 以外的内容

New adapters:
- douban: book-hot, movie-hot, search (browser/cookie)
- sinablog: hot, search, article, user (search uses public API)
- substack: feed, publication, search (search uses public API)

Medium upgrade (YAML → TS):
- Replace tag.yaml/user.yaml/publication.yaml with TS adapters
- feed.ts (tag feed by topic), search.ts, user.ts with browser scraping
- Richer data: readTime, claps, description

Core pipeline improvements:
- template.ts: trim template before matching (supports multiline expressions)
- template.ts: evalJsExpr fallback for JS expressions in YAML templates
- template.ts: add urlencode/urldecode filters
- transform.ts: inline select inside map params
- build-manifest.ts: TS-over-YAML dedup with warning log
- build-manifest.ts: export scanTs/shouldReplaceManifestEntry for testing

Co-authored-by: Yuan <leotsao.cy@gmail.com>
@jackwener jackwener force-pushed the feat/add-new-adapters branch from d47fbda to 815aeb0 Compare March 21, 2026 17:00
@jackwener jackwener merged commit bdf5967 into jackwener:main Mar 21, 2026
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.

2 participants