diff --git a/assets/radar-rules.js b/assets/radar-rules.js index 1ff95538d..3ddd2dd65 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -480,6 +480,16 @@ }, ], }, + 'pianyuan.la': { + _name: '片源网', + '.': [ + { + title: '电影和剧集', + description: 'https://docs.rsshub.app/multimedia.html#pian-yuan', + source: '/', + }, + ], + }, 'sspai.com': { _name: '少数派', '.': [ diff --git a/docs/multimedia.md b/docs/multimedia.md index 9a8b2833b..e06a535c9 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -276,6 +276,12 @@ pageClass: routes +## 片源网 + +### 最新资源 + + + ## 色花堂中文论坛 ### 原创 BT 电影 diff --git a/lib/router.js b/lib/router.js index 0cfa5ea68..046be0783 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2007,4 +2007,7 @@ router.get('/transferwise/pair/:source/:target', require('./routes/transferwise/ // chocolatey router.get('/chocolatey/software/:name?', require('./routes/chocolatey/software')); +// 片源网 +router.get('/pianyuan/:media?', require('./routes/pianyuan/app')); + module.exports = router; diff --git a/lib/routes/pianyuan/app.js b/lib/routes/pianyuan/app.js new file mode 100644 index 000000000..9f4aec3cd --- /dev/null +++ b/lib/routes/pianyuan/app.js @@ -0,0 +1,53 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const media = ctx.params.media || -1; + const link_base = 'http://pianyuan.la/'; + let description = '电影和剧集'; + let link = link_base; + if (media !== -1) { + link = link_base + `?cat=${media}`; + if (media === 'mv') { + description = '电影'; + } else if (media === 'tv') { + description = '剧集'; + } else { + link = link_base; + } + } + + const response = await got.get(link); + const data = response.data; + const $ = cheerio.load(data); + + const items = []; + $('#main-container > div > div.col-md-10 > table > tbody > tr').each(function(i, item) { + const link = $(item) + .find('td.dt.prel.nobr > a') + .attr('href'); + const text = $(item) + .find('td.dt.prel.nobr > a') + .text(); + const description = $(item) + .find('td.dt.prel.nobr') + .text() + .replace(/^\s+|\s+$/g, ''); + const size = $(item) + .find('td:nth-child(2)') + .text(); + + items.push({ + title: `[${size}] ${text}`, + description: description, + link: link_base + link, + }); + }); + + ctx.state.data = { + title: `片源网`, + description: description, + link: link_base, + item: items, + }; +};