forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
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 6vdy (DIYgod#11907)
* feat(route): add 6vdy * fix(route): use tryGet for cache * fix(route): fix cache bug * fix(route): fix utils * fix(route): fix utils * fix: update route path ---------
- Loading branch information
Showing
7 changed files
with
150 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
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,14 @@ | ||
const { processItems } = require('./utils'); | ||
|
||
const baseURL = 'https://www.hao6v.cc/gvod/zx.html'; | ||
|
||
module.exports = async (ctx) => { | ||
const item = await processItems(ctx, baseURL); | ||
|
||
ctx.state.data = { | ||
title: '6v电影-最新电影', | ||
link: baseURL, | ||
description: '6v最新电影RSS', | ||
item, | ||
}; | ||
}; |
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,14 @@ | ||
const { processItems } = require('./utils'); | ||
|
||
const baseURL = 'https://www.hao6v.tv/gvod/dsj.html'; | ||
|
||
module.exports = async (ctx) => { | ||
const item = await processItems(ctx, baseURL); | ||
|
||
ctx.state.data = { | ||
title: '6v电影-最新电影', | ||
link: baseURL, | ||
description: '6v最新电影RSS', | ||
item, | ||
}; | ||
}; |
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,4 @@ | ||
module.exports = { | ||
'/latestMovies': ['tc9011'], | ||
'/latestTVSeries': ['tc9011'], | ||
}; |
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,23 @@ | ||
const radarConfig = { | ||
_name: '6v电影', | ||
'.': [ | ||
{ | ||
title: '最新电影', | ||
docs: 'https://docs.rsshub.app/multimedia.html#_6v-dian-ying', | ||
source: ['/', '/gvod/zx.html'], | ||
target: '/6v123/latestMovies', | ||
}, | ||
{ | ||
title: '最新电视剧', | ||
docs: 'https://docs.rsshub.app/multimedia.html#_6v-dian-ying', | ||
source: ['/', '/gvod/dsj.html'], | ||
target: '/6v123/latestTVSeries', | ||
}, | ||
], | ||
}; | ||
|
||
module.exports = { | ||
'hao6v.cc': radarConfig, | ||
'hao6v.tv': radarConfig, | ||
'hao6v.com': radarConfig, | ||
}; |
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,4 @@ | ||
module.exports = (router) => { | ||
router.get('/latestMovies', require('./latestMovies')); | ||
router.get('/latestTVSeries', require('./latestTVSeries')); | ||
}; |
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,81 @@ | ||
const got = require('@/utils/got'); | ||
const iconv = require('iconv-lite'); | ||
const cheerio = require('cheerio'); | ||
|
||
const utils = { | ||
loadDetailPage: async function loadDetailPage(link) { | ||
const response = await got.get(link, { | ||
responseType: 'buffer', | ||
}); | ||
response.data = iconv.decode(response.data, 'gb2312'); | ||
|
||
const $ = cheerio.load(response.data); | ||
|
||
const detailInfo = { | ||
title: $('title') | ||
.text() | ||
.replace(/,免费下载,迅雷下载|,6v电影/g, ''), | ||
description: $('meta[name="description"]').attr('content'), | ||
enclosure_urls: $('table td') | ||
.map((i, e) => ({ | ||
title: $(e).text().replace('磁力:', ''), | ||
magnet: $(e).find('a').attr('href'), | ||
})) | ||
.toArray() | ||
.filter((item) => item.magnet?.includes('magnet')), | ||
}; | ||
return detailInfo; | ||
}, | ||
processItems: async (ctx, baseURL) => { | ||
const response = await got.get(baseURL, { | ||
responseType: 'buffer', | ||
}); | ||
response.data = iconv.decode(response.data, 'gb2312'); | ||
|
||
const $ = cheerio.load(response.data); | ||
const list = $('ul.list')[0].children; | ||
|
||
const process = await Promise.all( | ||
list.map((item) => { | ||
const link = $(item).find('a'); | ||
const href = link.attr('href'); | ||
const pubDate = new Date($(item).find('span').text().replace(/[[\]]/g, '')).toUTCString(); | ||
|
||
if (href === undefined) { | ||
return undefined; | ||
} | ||
|
||
const itemUrl = 'https://www.hao6v.cc' + link.attr('href'); | ||
|
||
return ctx.cache.tryGet(itemUrl, async () => { | ||
const detailInfo = await utils.loadDetailPage(itemUrl); | ||
|
||
if (detailInfo.enclosure_urls.length > 1) { | ||
return detailInfo.enclosure_urls.map((url) => ({ | ||
enclosure_url: url.magnet, | ||
enclosure_type: 'application/x-bittorrent', | ||
title: `${link.text()} ( ${url.title} )`, | ||
description: detailInfo.description, | ||
pubDate, | ||
link: itemUrl, | ||
guid: `${itemUrl}#${url.title}`, | ||
})); | ||
} | ||
|
||
return { | ||
enclosure_url: detailInfo.enclosure_urls[0].magnet, | ||
enclosure_type: 'application/x-bittorrent', | ||
title: link.text(), | ||
description: detailInfo.description, | ||
pubDate, | ||
link: itemUrl, | ||
}; | ||
}); | ||
}) | ||
); | ||
|
||
return process.filter((item) => item !== undefined).flat(); | ||
}, | ||
}; | ||
|
||
module.exports = utils; |