Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(enhancement): WIP command-line tool add route. #16712

Closed
wants to merge 1 commit into from

Conversation

AntiKnot
Copy link
Contributor

Involved Issue / 该 PR 相关 Issue

Close #16598

Example for the Proposed Route(s) / 路由地址示例

New RSS Route Checklist / 新 RSS 路由检查表

  • New Route / 新的路由
  • Anti-bot or rate limit / 反爬/频率限制
    • If yes, do your code reflect this sign? / 如果有, 是否有对应的措施?
  • Date and time / 日期和时间
    • Parsed / 可以解析
    • Correct time zone / 时区正确
  • New package added / 添加了新的包
  • Puppeteer

Note / 说明

IFTTT has better support for TypeScript, Zapier offers better support for selectors.
The more idealized product should be able to generate routes through mechanisms or AI by using an input URL contain mapable item and a target. This is a WIP.
A test service has been added in the command line for beginners to test and understand selectors.

$ ts-node route-helper.js
Usage: route-helper [options] [command]

A command-tool to help add new routes. Usage example: node cli.js add-route

Options:
  -V, --version   output the version number
  -h, --help      display help for command

Commands:
  run-server      Run a test server with list and detail pages, and JSON API.
  add-route       Add a new route.
  help [command]  display help for command

Full usage example:
  $ node cli.js add-route
  Enter the namespace name: example
  Enter the route name: test
  Enter the maintainer name: John Doe
  Select data fetching method (1: API, 2: HTML, 3: Puppeteer): 1
ts-node route-helper.js run-server
Test server running at http://localhost:3000/
Features:
- List page (HTML): http://localhost:3000/
- List page with category filter (HTML): http://localhost:3000/?category=:category
- Item detail page (HTML): http://localhost:3000/item/:id?category=:category
- API list of items (JSON): http://localhost:3000/api/
- API list with category filter (JSON): http://localhost:3000/api/?category=:category
- API item detail (JSON): http://localhost:3000/api/item/:id?category=:category
ts-node route-helper.js add-route
Enter the namespace name: zzz
Enter the route name: i-index
Enter the maintainer name: foobar
Select data fetching method (1: API, 2: HTML, 3: Puppeteer): 2
New route created:
Route folder: /Users/conor/Code/RSSHub/lib/routes/zzz
Namespace file: /Users/conor/Code/RSSHub/lib/routes/zzz/namespace.ts
Route file: /Users/conor/Code/RSSHub/lib/routes/zzz/i-index.ts

@github-actions github-actions bot added the dependencies This PR involves changes to dependencies label Sep 12, 2024
Copy link
Contributor

Auto Route Test failed, please check your PR body format and reopen pull request. Check logs for more details.
自动路由测试失败,请确认 PR 正文部分符合格式规范并重新开启,详情请检查 日志

@github-actions github-actions bot added the Auto: Route No Found Automatic test failed to test route in PR body label Sep 12, 2024
@github-actions github-actions bot closed this Sep 12, 2024
@AntiKnot AntiKnot changed the title feat(enhancement)[WIP]: command-line tool add route. feat(enhancement): command-line tool add route. Sep 12, 2024
@AntiKnot AntiKnot changed the title feat(enhancement): command-line tool add route. feat(enhancement): WIP command-line tool add route. Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto: Route No Found Automatic test failed to test route in PR body Auto: Route Test Failed dependencies This PR involves changes to dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A command-line tool to help add new routes or new namespaces
1 participant