mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-19 06:38:55 +08:00
fix(route): update root url for newzmz (#12158)
* fix(route): update rootUrl for newzmz * refactor: migrate to v2 ---------
This commit is contained in:
@@ -3696,8 +3696,8 @@ router.get('/gab/user/:username', lazyloadRouteHandler('./routes/gab/user'));
|
||||
router.get('/gab/popular/:sort?', lazyloadRouteHandler('./routes/gab/explore'));
|
||||
|
||||
// NEW 字幕组
|
||||
router.get('/newzmz/view/:id', lazyloadRouteHandler('./routes/newzmz/view'));
|
||||
router.get('/newzmz/:category?', lazyloadRouteHandler('./routes/newzmz/index'));
|
||||
// router.get('/newzmz/view/:id', lazyloadRouteHandler('./routes/newzmz/view'));
|
||||
// router.get('/newzmz/:category?', lazyloadRouteHandler('./routes/newzmz/index'));
|
||||
|
||||
// Phrack Magazine
|
||||
router.get('/phrack', lazyloadRouteHandler('./routes/phrack/index'));
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = parseInt(ctx.params.category || '1');
|
||||
|
||||
const rootUrl = 'https://newzmz.com';
|
||||
const rootUrl = 'http://newzmz.com';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: rootUrl,
|
||||
url: `${rootUrl}/index.html`,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
@@ -16,7 +17,6 @@ module.exports = async (ctx) => {
|
||||
const links = await Promise.all(
|
||||
target
|
||||
.find('.slides li a')
|
||||
.slice(0, 15)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
|
||||
@@ -34,12 +34,13 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const $ = cheerio.load(resourceResponse.data);
|
||||
|
||||
item.link = $('.addgz').attr('href');
|
||||
item.pubDate = new Date(
|
||||
item.link = $('.addgz').attr('href').replace('http:', 'https:');
|
||||
item.pubDate = parseDate(
|
||||
$('.duration')
|
||||
.not('.upday')
|
||||
.text()
|
||||
.replace(/更新时间:/, '')
|
||||
).toUTCString();
|
||||
);
|
||||
|
||||
return item;
|
||||
})
|
||||
4
lib/v2/newzmz/maintainer.js
Normal file
4
lib/v2/newzmz/maintainer.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'/:category?': ['nczitzk'],
|
||||
'/view/:id?': ['nczitzk'],
|
||||
};
|
||||
19
lib/v2/newzmz/radar.js
Normal file
19
lib/v2/newzmz/radar.js
Normal file
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
'newzmz.com': {
|
||||
_name: 'NEW 字幕组',
|
||||
'.': [
|
||||
{
|
||||
title: '分类',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#new-zi-mu-zu',
|
||||
source: ['/'],
|
||||
target: '/newzmz',
|
||||
},
|
||||
{
|
||||
title: '指定剧集',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#new-zi-mu-zu',
|
||||
source: ['/view/:id'],
|
||||
target: (params) => `/newzmz/view/${params.id.replace('.html', '')}`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
4
lib/v2/newzmz/router.js
Normal file
4
lib/v2/newzmz/router.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/:category?', require('./index'));
|
||||
router.get('/view/:id', require('./view'));
|
||||
};
|
||||
@@ -4,7 +4,7 @@ const cheerio = require('cheerio');
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const rootUrl = `https://ysfx.tv`;
|
||||
const rootUrl = `https://s.newzmz.com`;
|
||||
const currentUrl = `${rootUrl}/view/${id}.html`;
|
||||
|
||||
const response = await got({
|
||||
Reference in New Issue
Block a user