-
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 olevod.one (#15405)
* feat(route): add olevod.one * fix: feed category --------- Co-authored-by: root <root@debian.st>
- Loading branch information
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
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: '欧乐影院', | ||
url: 'olevod.one', | ||
}; |
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,49 @@ | ||
import { Route } from '@/types'; | ||
import { load } from 'cheerio'; | ||
import ofetch from '@/utils/ofetch'; | ||
|
||
export const route: Route = { | ||
path: '/vod/:id', | ||
categories: ['multimedia'], | ||
example: '/olevod/vod/202449091', | ||
parameters: { id: '视频id号' }, | ||
radar: [ | ||
{ | ||
source: ['www.olevod.one/vod/:id'], | ||
target: '/vod/:id', | ||
}, | ||
], | ||
name: '视频', | ||
maintainers: ['fang63625'], | ||
handler, | ||
}; | ||
|
||
async function handler(ctx) { | ||
const urlBase = 'https://www.olevod.one'; | ||
const id = ctx.req.param('id'); | ||
const url = `${urlBase}/vod/${id}`; | ||
|
||
const response = await ofetch(url); | ||
const $ = load(response); | ||
|
||
const title = $('.title.scookie').text().trim(); | ||
const image = $('.vodlist_thumb.lazyload').attr('data-original'); | ||
const items = $('.content_playlist.clearfix a') | ||
.toArray() | ||
.map((item) => { | ||
const tmp = $(item); | ||
const href = urlBase + tmp.attr('href'); | ||
|
||
return { | ||
title: `${title} ${tmp.text()}`, | ||
link: href, | ||
}; | ||
}); | ||
|
||
return { | ||
title, | ||
link: url, | ||
item: items, | ||
image: urlBase + image, | ||
}; | ||
} |
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,48 @@ | ||
import { Route } from '@/types'; | ||
import { load } from 'cheerio'; | ||
import ofetch from '@/utils/ofetch'; | ||
|
||
export const route: Route = { | ||
path: '/vodlist', | ||
categories: ['multimedia'], | ||
example: '/olevod/vodlist', | ||
radar: [ | ||
{ | ||
source: ['www.olevod.one'], | ||
target: '/vodlist', | ||
}, | ||
], | ||
name: '最新视频', | ||
maintainers: ['fang63625'], | ||
handler, | ||
}; | ||
|
||
async function handler() { | ||
const urlBase = 'https://www.olevod.one'; | ||
const title = '欧乐影院 最新视频'; | ||
|
||
const response = await ofetch(urlBase); | ||
const $ = load(response); | ||
|
||
const items = $('.cbox1 .vodlist_thumb.lazyload') | ||
.toArray() | ||
.map((item) => { | ||
const tmp = $(item); | ||
const href = urlBase + tmp.attr('href'); | ||
const title = tmp.attr('title'); | ||
const image = urlBase + tmp.attr('data-original'); | ||
|
||
return { | ||
title: `${title} ${tmp.find('.pic_text.text_right').text()}`, | ||
link: href, | ||
image, | ||
description: `豆瓣评分 ${tmp.find('.text_right.text_dy').text()}`, | ||
}; | ||
}); | ||
|
||
return { | ||
title, | ||
link: urlBase, | ||
item: items, | ||
}; | ||
} |