RSSHub/lib/routes/wikipedia
Alex 2ca1b3afa5
feat(route): add Wikipedia current events (#20100)
* feat(route): add Wikipedia current events

Add RSS feed for Wikipedia Portal:Current events providing the past 7 days of current events. Parses MediaWiki templates and converts wiki markup to HTML.

- Hierarchical bullet point structures with nested <ul>/<li> tags
- Proper paragraph breaks between sections
- Correct nesting depth for multi-level lists
- Clean separation of content sections

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(route/wikipedia): break down complex wikiToHtml function

- Split 123-line wikiToHtml function into 6 smaller, focused methods
- Each function now has a single responsibility (links, formatting, lists, etc.)
- Improved code readability and maintainability
- End-to-end tested: route produces identical RSS output with proper HTML formatting

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(route/wikipedia): use config.trueUA instead of hardcoded User-Agent

Replace hardcoded User-Agent string with config.trueUA to follow
project conventions for HTTP requests.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(route/wikipedia): use config.cache.contentExpire for cache duration

Replace hardcoded 6-hour cache duration with configurable contentExpire
setting to follow project caching conventions.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat(route/wikipedia): implement efficient current events RSS with single API request

- Switch from web scraping to MediaWiki API for better reliability
- Implement single batch API request with continuation support for multiple pages
- Add current-day inclusion parameter with time-based logic (auto/always/never/hour)
- Add proper error handling and ESLint compliance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(route/wikipedia): consolidate list processing and add API documentation

- Move wrapListItems and processNestedLists calls inside (renamed) processListsAndLines to eliminate non-obvious coupling
- Remove newlines from processNestedLists output for more compact HTML
- Add documentation about Wikipedia API endpoints and query options

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-21 22:12:30 +08:00
..
current-events.ts feat(route): add Wikipedia current events (#20100) 2025-09-21 22:12:30 +08:00
namespace.ts feat(route): add Wikipedia current events (#20100) 2025-09-21 22:12:30 +08:00