-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(route): add anime1 add 2 anime1 route: 1. anime 2. search * Update anime.ts fix example * remove deprecated route remove deprecated anime1 route: 1. anime.js 2. search.js * Update search.ts remove radar rule
- Loading branch information
Showing
5 changed files
with
126 additions
and
50 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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,63 @@ | ||
import { Route } from '@/types'; | ||
import { parseDate } from '@/utils/parse-date'; | ||
import ofetch from '@/utils/ofetch'; | ||
import { load } from 'cheerio'; | ||
|
||
export const route: Route = { | ||
path: 'anime/:category/:name', | ||
name: 'Anime', | ||
url: 'anime1.me', | ||
maintainers: ['cxheng315'], | ||
example: '/anime1/anime/2024年夏季/神之塔-第二季', | ||
categories: ['anime'], | ||
parameters: { | ||
category: 'Anime1 Category', | ||
name: 'Anime1 Name', | ||
}, | ||
features: { | ||
requireConfig: false, | ||
requirePuppeteer: false, | ||
antiCrawler: false, | ||
supportBT: false, | ||
supportPodcast: false, | ||
supportScihub: false, | ||
}, | ||
radar: [ | ||
{ | ||
source: ['anime1.me/category/:category/:name'], | ||
target: '/anime/:category/:name', | ||
}, | ||
], | ||
handler, | ||
}; | ||
|
||
async function handler(ctx) { | ||
const { category, name } = ctx.req.param(); | ||
|
||
const response = await ofetch(`https://anime1.me/category/${category}/${name}`); | ||
|
||
const $ = load(response); | ||
|
||
const title = $('page-title').text().trim(); | ||
|
||
const items = $('article') | ||
.toArray() | ||
.map((el) => { | ||
const $el = $(el); | ||
const title = $el.find('.entry-title a').text().trim(); | ||
return { | ||
title, | ||
link: $el.find('.entry-title a').attr('href'), | ||
description: title, | ||
pubDate: parseDate($el.find('time').attr('datetime') || ''), | ||
itunes_item_image: $el.find('video').attr('poster'), | ||
}; | ||
}); | ||
|
||
return { | ||
title, | ||
link: `https://anime1.me/category/${category}/${name}`, | ||
description: title, | ||
item: items, | ||
}; | ||
} |
This file contains 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,6 @@ | ||
import type { Namespace } from '@/types'; | ||
|
||
export const namespace: Namespace = { | ||
name: 'Anime1', | ||
url: 'anime1.me', | ||
}; |
This file contains 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,57 @@ | ||
import { Route } from '@/types'; | ||
import { parseDate } from '@/utils/parse-date'; | ||
import ofetch from '@/utils/ofetch'; | ||
import { load } from 'cheerio'; | ||
|
||
export const route: Route = { | ||
path: 'search/:keyword', | ||
name: 'Search', | ||
url: 'anime1.me', | ||
maintainers: ['cxheng315'], | ||
example: '/anime1/search/神之塔', | ||
categories: ['anime'], | ||
parameters: { | ||
keyword: 'Anime1 Search Keyword', | ||
}, | ||
features: { | ||
requireConfig: false, | ||
requirePuppeteer: false, | ||
antiCrawler: false, | ||
supportBT: false, | ||
supportPodcast: false, | ||
supportScihub: false, | ||
}, | ||
handler, | ||
}; | ||
|
||
async function handler(ctx) { | ||
const { keyword } = ctx.req.param(); | ||
|
||
const response = await ofetch(`https://anime1.me/?s=${keyword}`); | ||
|
||
const $ = load(response); | ||
|
||
const title = $('page-title').text().trim(); | ||
|
||
const items = $('article.type-post') | ||
.toArray() | ||
.map((el) => { | ||
const $el = $(el); | ||
const title = $el.find('.entry-title a').text().trim(); | ||
return { | ||
title, | ||
link: $el.find('.entry-title a').attr('href'), | ||
description: title, | ||
pubDate: parseDate($el.find('time').attr('datetime') || ''), | ||
}; | ||
}); | ||
|
||
return { | ||
title, | ||
link: `https://anime1.me/?s=${keyword}`, | ||
description: title, | ||
itunes_author: 'Anime1', | ||
itunes_image: 'https://anime1.me/wp-content/uploads/2021/02/cropped-1-180x180.png', | ||
item: items, | ||
}; | ||
} |