-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Projectjav #21525
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
Open
Exat1979
wants to merge
6
commits into
DIYgod:master
Choose a base branch
from
Exat1979:projectjav
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+147
−0
Open
Projectjav #21525
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
68b9acb
feat: implement projectjav actress route
Exat1979 63e1021
Merge branch 'DIYgod:master' into projectjav
Exat1979 7203617
Merge branch 'DIYgod:master' into projectjav
Exat1979 ff85abe
fix linter errors
Alistair1231 da21d24
import cache directly instead of passing it
Alistair1231 be2560a
projectjav: add support for trailing slash
Alistair1231 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import type { Route } from '@/types'; | ||
|
|
||
| import { processItems, rootUrl } from './utils'; | ||
|
|
||
| export const route: Route = { | ||
| path: '/actress/:id{[^/]+/?}', | ||
| categories: ['multimedia'], | ||
| example: '/projectjav/actress/rima-arai-22198', | ||
| parameters: { id: 'Actress ID or slug, can be found in the actress page URL' }, | ||
| features: { | ||
| requireConfig: false, | ||
| requirePuppeteer: false, | ||
| antiCrawler: false, | ||
| supportBT: false, | ||
| supportPodcast: false, | ||
| supportScihub: false, | ||
| nsfw: true, | ||
| }, | ||
| radar: [ | ||
| { | ||
| source: ['projectjav.com/actress/:id'], | ||
| target: '/actress/:id', | ||
| }, | ||
| ], | ||
| name: 'Actress', | ||
| maintainers: ['Exat1979'], | ||
| handler, | ||
| url: 'projectjav.com/', | ||
| description: 'Fetches the latest movies from a specific actress page on ProjectJAV.', | ||
| }; | ||
|
|
||
| async function handler(ctx) { | ||
| const id = ctx.req.param('id').replace(/\/$/, ''); | ||
| const currentUrl = `${rootUrl}/actress/${id}`; | ||
| return await processItems(currentUrl); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import type { Namespace } from '@/types'; | ||
|
|
||
| export const namespace: Namespace = { | ||
| name: 'ProjectJAV', | ||
| url: 'projectjav.com', | ||
| description: 'ProjectJAV provides adult video content information and streaming.', | ||
| lang: 'en', | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| import { load } from 'cheerio'; | ||
|
|
||
| import type { DataItem } from '@/types'; | ||
| import cache from '@/utils/cache'; | ||
| import got from '@/utils/got'; | ||
| import { parseDate } from '@/utils/parse-date'; | ||
|
|
||
| const rootUrl = 'https://projectjav.com'; | ||
| const processItems = async (currentUrl: string) => { | ||
| const response = await got({ | ||
| method: 'get', | ||
| url: currentUrl, | ||
| }); | ||
|
|
||
| const $ = load(response.data); | ||
|
|
||
| let items: DataItem[] = $('div.video-item') | ||
| .toArray() | ||
| .map((element) => { | ||
| const item = $(element); | ||
| const link = item.find('a').attr('href'); | ||
| return { | ||
| title: item.find('div.name span').text() || '', | ||
| link: link?.startsWith('http') ? link : `${rootUrl}${link}`, | ||
| }; | ||
| }) | ||
| .filter((item) => item.link && /\/movie\/.*/.test(item.link)); | ||
|
|
||
| items = await Promise.all( | ||
| items.map((item) => | ||
| cache.tryGet(item.link!, async () => { | ||
| const detailResponse = await got({ | ||
| method: 'get', | ||
| url: item.link, | ||
| }); | ||
|
|
||
| const content = load(detailResponse.data); | ||
|
|
||
| // Remove ads | ||
| content('div.top-banner-ads, div.bottom-content-ads').remove(); | ||
|
|
||
| // Get main content | ||
| const mainContent = content('main'); | ||
|
|
||
| // Extract title | ||
| const h1Title = mainContent.find('h1').text().trim(); | ||
| if (h1Title) { | ||
| item.title = h1Title; | ||
| } | ||
|
|
||
| // Extract categories | ||
| const categories = mainContent | ||
| .find('div.badge a') | ||
| .toArray() | ||
| .map((v) => content(v).text().trim()) | ||
| .filter(Boolean); | ||
| if (categories.length > 0) { | ||
| item.category = categories; | ||
| } | ||
|
|
||
| // Extract author/actress (support multiple actresses) | ||
| const actresses = mainContent | ||
| .find('div.actress-item a') | ||
| .toArray() | ||
| .map((v) => content(v).text().trim()) | ||
| .filter(Boolean); | ||
| if (actresses.length > 0) { | ||
| item.author = actresses.join(', '); | ||
| } | ||
|
|
||
| // Extract date | ||
| let dateText: string | null = null; | ||
| mainContent | ||
| .find('div.second-main~div.row>div.col-3') | ||
| .toArray() | ||
| .some((el) => { | ||
| if (content(el).text().includes('Date added')) { | ||
| dateText = content(el).next().text().trim(); | ||
| return true; | ||
| } | ||
| return false; | ||
| }); | ||
|
Comment on lines
+76
to
+82
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. Use find() instead of |
||
| if (dateText) { | ||
| // ProjectJAV uses DD/MM/YYYY format | ||
| item.pubDate = parseDate(dateText, 'DD/MM/YYYY'); | ||
| } | ||
|
|
||
| // Get description | ||
| item.description = mainContent.html() || ''; | ||
|
|
||
| return item; | ||
| }) | ||
| ) | ||
| ); | ||
|
|
||
| return { | ||
| title: $('title').text() || 'ProjectJAV', | ||
| link: currentUrl, | ||
| item: items, | ||
| }; | ||
| }; | ||
|
|
||
| export { processItems, rootUrl }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.