-
Notifications
You must be signed in to change notification settings - Fork 9k
feat(route): Extend E-Hentai routes with Watched, Popular and Toplist #20306
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
Changes from all commits
5dfe368
d75f7ae
bb6c963
23047db
5ee21eb
fe8c25c
b6e17fd
e949932
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,7 +6,7 @@ import ConfigNotFoundError from '@/errors/types/config-not-found'; | |||||||
| export const route: Route = { | ||||||||
| path: '/favorites/:favcat?/:order?/:page?/:routeParams?', | ||||||||
| categories: ['picture'], | ||||||||
| example: '/ehentai/favorites/0/posted/0/bittorrent=true&embed_thumb=false', | ||||||||
| example: '/ehentai/favorites/0/posted/0/bittorrent=true&embed_thumb=false&my_tags=true', | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not change the example unless it doesn't work anymore. |
||||||||
| parameters: { | ||||||||
| favcat: 'Favorites folder number', | ||||||||
| order: '`posted`(Sort by gallery release time) , `favorited`(Sort by time added to favorites)', | ||||||||
|
|
@@ -34,10 +34,11 @@ async function handler(ctx) { | |||||||
| const favcat = ctx.req.param('favcat') ? Number.parseInt(ctx.req.param('favcat')) : 0; | ||||||||
| const page = ctx.req.param('page'); | ||||||||
| const routeParams = new URLSearchParams(ctx.req.param('routeParams')); | ||||||||
| const bittorrent = routeParams.get('bittorrent') || false; | ||||||||
| const embed_thumb = routeParams.get('embed_thumb') || false; | ||||||||
| const bittorrent = routeParams.get('bittorrent') === 'true'; | ||||||||
| const embed_thumb = routeParams.get('embed_thumb') === 'true'; | ||||||||
| const my_tags = routeParams.get('my_tags') === 'true'; | ||||||||
|
Comment on lines
+37
to
+39
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not change the default value. RSSHub/lib/routes/ehentai/namespace.ts Lines 9 to 11 in e949932
|
||||||||
| const inline_set = ctx.req.param('order') === 'posted' ? 'fs_p' : 'fs_f'; | ||||||||
| const items = await EhAPI.getFavoritesItems(cache, favcat, inline_set, page, bittorrent, embed_thumb); | ||||||||
| const items = await EhAPI.getFavoritesItems(cache, favcat, inline_set, page, bittorrent, embed_thumb, my_tags); | ||||||||
|
|
||||||||
| return EhAPI.from_ex | ||||||||
| ? { | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,53 @@ | ||||||||
| import { Route } from '@/types'; | ||||||||
| import cache from '@/utils/cache'; | ||||||||
| import EhAPI from './ehapi'; | ||||||||
|
|
||||||||
| export const route: Route = { | ||||||||
| path: '/popular/:params?/:routeParams?', | ||||||||
| categories: ['picture'], | ||||||||
| example: '/ehentai/popular/f_sft=on&f_sfu=on&f_sfl=on/bittorrent=true&embed_thumb=false&my_tags=true', | ||||||||
| parameters: { | ||||||||
| params: 'Filter parameters. You can copy the content after `https://e-hentai.org/popular?`', | ||||||||
| routeParams: 'Additional parameters, see the table above. E.g. `bittorrent=true&embed_thumb=false`', | ||||||||
| }, | ||||||||
| features: { | ||||||||
| requireConfig: false, | ||||||||
| requirePuppeteer: false, | ||||||||
| antiCrawler: true, | ||||||||
| supportBT: true, | ||||||||
| supportPodcast: false, | ||||||||
| supportScihub: false, | ||||||||
| nsfw: true, | ||||||||
| }, | ||||||||
| name: 'Popular', | ||||||||
| maintainers: ['yindaheng98', 'syrinka', 'rosystain'], | ||||||||
| handler, | ||||||||
| }; | ||||||||
|
|
||||||||
| async function handler(ctx) { | ||||||||
| let params = ctx.req.param('params') ?? ''; | ||||||||
| let routeParams = ctx.req.param('routeParams'); | ||||||||
|
|
||||||||
| if (params && !routeParams && (params.includes('bittorrent=') || params.includes('embed_thumb=') || params.includes('my_tags='))) { | ||||||||
| routeParams = params; | ||||||||
| params = ''; | ||||||||
| } | ||||||||
|
|
||||||||
| const routeParamsParsed = new URLSearchParams(routeParams); | ||||||||
| const bittorrent = routeParamsParsed.get('bittorrent') === 'true'; | ||||||||
| const embed_thumb = routeParamsParsed.get('embed_thumb') === 'true'; | ||||||||
| const my_tags = routeParamsParsed.get('my_tags') === 'true'; | ||||||||
|
Comment on lines
+37
to
+39
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not change the default value. RSSHub/lib/routes/ehentai/namespace.ts Lines 9 to 11 in e949932
|
||||||||
| const items = await EhAPI.getPopularItems(cache, params, bittorrent, embed_thumb, my_tags); | ||||||||
|
|
||||||||
| return EhAPI.from_ex | ||||||||
| ? { | ||||||||
| title: `ExHentai Popular`, | ||||||||
| link: `https://exhentai.org/popular${params || ''}`, | ||||||||
| item: items, | ||||||||
| } | ||||||||
| : { | ||||||||
| title: `E-Hentai Popular`, | ||||||||
| link: `https://e-hentai.org/popular${params || ''}`, | ||||||||
| item: items, | ||||||||
| }; | ||||||||
| } | ||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not add tags to description. Having them in
categoryis already enough.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the suggestion. As an optional feature that relies on cookies and is disabled by default, I believe its presence in the description is valuable.
my_tagsand the tags incategoryare not the same.my_tagsrefers to highlight tags set by the E-Hentai user themselves, while the tags incategoryare all the tags for that item.The
my_tagsin the description can inform users that an item contains elements of interest to them, and in this respect, it is not a redundant implementation of category.Concurrently, including appropriate data in the description also allows RSSHub's
filter_descriptionto be utilized for more granular filtering rules.Additionally, in some E-Hentai layouts (such as the most common thumbnail view), tags information is lost, while
my_tagsassociated highlighted tags are unaffected. Treating them as two different types of data facilitates more reliable conditional judgments in some automated workflows (e.g., automated downloads, message forwarding).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So why not have the
my_tagsincategoryin a form ofmy_tags:some_tag_i_likesimilar toRSSHub/lib/routes/ehentai/ehapi.ts
Line 182 in e949932
Since you mentioned
filter_descriptionwhy can't one simply apply filtering withfilter_category? Especially if you have a closer look at what's insidedescription. The description will have a thumbnail fromRSSHub/lib/routes/ehentai/ehapi.ts
Line 173 in e949932
In
processThumbnailthe thumbnail can be created fromRSSHub/lib/routes/ehentai/ehapi.ts
Line 111 in e949932
RSSHub/lib/routes/ehentai/ehapi.ts
Lines 29 to 35 in e949932
Performing string searching
filter_descriptionon a long stringdescriptionwill always be slower than searching in short stringsfilter_category.