feat: v3 migration - 1/n
This commit is contained in:
parent
85ad31e260
commit
c88553b225
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = 'http://www.0818tuan.com';
|
||||
|
|
@ -9,7 +9,7 @@ module.exports = async (ctx) => {
|
|||
const url = `${baseUrl}/list-${listId}-0.html`;
|
||||
|
||||
const { data: response } = await got(url);
|
||||
const $ = cheerio.load(response);
|
||||
const $ = load(response);
|
||||
|
||||
const list = $(listId === '3' ? '.col-xs-12 .thumbnail > a' : '.col-md-8 .list-group > a')
|
||||
.toArray()
|
||||
|
|
@ -26,7 +26,7 @@ module.exports = async (ctx) => {
|
|||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const { data: response } = await got(item.link);
|
||||
const $ = cheerio.load(response);
|
||||
const $ = load(response);
|
||||
|
||||
$('.pageLink, .alert, p[style="margin:15px;"]').remove();
|
||||
|
||||
|
|
@ -38,10 +38,10 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('head title').text(),
|
||||
link: url,
|
||||
image: 'http://www.0818tuan.com/favicon.ico',
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
const config = require('@/config').value;
|
||||
import { config } from '@/config';
|
||||
|
||||
const rootUrl = 'https://kyfw.12306.cn';
|
||||
|
||||
|
|
@ -46,10 +46,10 @@ function getStationInfo(stationName, ctx) {
|
|||
}
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const date = ctx.params.date;
|
||||
const fromStationInfo = await getStationInfo(ctx.params.from, ctx);
|
||||
const toStationInfo = await getStationInfo(ctx.params.to, ctx);
|
||||
const type = ctx.params.type ?? 'ADULT';
|
||||
const date = ctx.req.param('date');
|
||||
const fromStationInfo = await getStationInfo(ctx.req.param('from'), ctx);
|
||||
const toStationInfo = await getStationInfo(ctx.req.param('to'), ctx);
|
||||
const type = ctx.req.param('type') ?? 'ADULT';
|
||||
|
||||
const apiUrl = `${rootUrl}/otn/leftTicket/queryA?leftTicketDTO.train_date=${date}&leftTicketDTO.from_station=${fromStationInfo.code}&leftTicketDTO.to_station=${toStationInfo.code}&purpose_codes=${type}`;
|
||||
const linkUrl = `${rootUrl}/otn/leftTicket/init?linktypeid=dc&fs=${fromStationInfo.code}&ts=${toStationInfo.code}&date=${date}&flag=N,N,Y`;
|
||||
|
|
@ -100,9 +100,9 @@ module.exports = async (ctx) => {
|
|||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${fromStationInfo.name} → ${toStationInfo.name} ${date}`,
|
||||
link: linkUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const url = require('url');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id || -1;
|
||||
const id = ctx.req.param('id') || -1;
|
||||
|
||||
const link = id === -1 ? 'https://www.12306.cn/mormhweb/zxdt/index_zxdt.html' : `https://www.12306.cn/mormhweb/1/${id}/index_fl.html`;
|
||||
|
||||
const response = await got.get(link);
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const $ = load(data);
|
||||
const name = $('div.nav_center > a:nth-child(4)').text();
|
||||
|
||||
const list = $('#newList > ul > li')
|
||||
|
|
@ -35,7 +35,7 @@ module.exports = async (ctx) => {
|
|||
}
|
||||
|
||||
const response = await got.get(itemUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
let description = $('.article-box').html();
|
||||
description = description ? description.replaceAll('src="', `src="${url.resolve(itemUrl, '.')}`).trim() : $('.content_text').html() || '文章已被删除';
|
||||
|
||||
|
|
@ -50,9 +50,9 @@ module.exports = async (ctx) => {
|
|||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${name}最新动态`,
|
||||
link,
|
||||
item: out,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
if (ctx.path === '/') {
|
||||
ctx.redirect(`/141jav${$('.overview').first().attr('href')}`);
|
||||
|
|
@ -63,9 +63,9 @@ module.exports = async (ctx) => {
|
|||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `141JAV - ${$('title').text().split('-')[0].trim()}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
if (ctx.path === '/') {
|
||||
ctx.redirect(`/141ppv${$('.overview').first().attr('href')}`);
|
||||
|
|
@ -66,9 +66,9 @@ module.exports = async (ctx) => {
|
|||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `141PPV - ${$('title').text().split('-')[0].trim()}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
const root_url = 'https://inf.ds.163.com';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const id = ctx.req.param('id');
|
||||
|
||||
const current_url = `${root_url}/v1/web/feed/basic/getSomeOneFeeds?feedTypes=1,2,3,4,6,7,10,11&someOneUid=${id}`;
|
||||
const response = await got({
|
||||
|
|
@ -25,9 +25,9 @@ module.exports = async (ctx) => {
|
|||
pubDate: parseDate(feed.updateTime),
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${response.data.result.userInfos[0].user.nick} 的动态`,
|
||||
link: `https://ds.163.com/user/${id}`,
|
||||
item: list,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
const { parseDyArticle } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -19,11 +19,11 @@ module.exports = async (ctx) => {
|
|||
|
||||
const items = await Promise.all(list.map((e) => parseDyArticle(charset, e, ctx.cache.tryGet)));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `网易号 - ${list[0].author}`,
|
||||
link: items[0].feedLink,
|
||||
description: items[0].feedDescription,
|
||||
image: items[0].feedImage,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const iconv = require('iconv-lite');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
const { parseDyArticle } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const limit = ctx.query.limit ?? 30;
|
||||
const limit = ctx.req.query('limit') ?? 30;
|
||||
const url = `https://www.163.com/dy/media/${id}.html`;
|
||||
|
||||
const response = await got(url, { responseType: 'buffer' });
|
||||
|
||||
const charset = response.headers['content-type'].split('=')[1];
|
||||
const data = iconv.decode(response.data, charset);
|
||||
const $ = cheerio.load(data);
|
||||
const $ = load(data);
|
||||
|
||||
const list = $('.tab_content ul li')
|
||||
.slice(0, limit)
|
||||
|
|
@ -31,12 +31,12 @@ module.exports = async (ctx) => {
|
|||
|
||||
const items = await Promise.all(list.map((item) => parseDyArticle(charset, item, ctx.cache.tryGet)));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${$('head title').text()} - 网易号`,
|
||||
link: url,
|
||||
description: $('.icon_line.desc').text(),
|
||||
image: $('.head_img').attr('src'),
|
||||
item: items,
|
||||
author: $('h2').text(),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
const ids = {
|
||||
|
|
@ -73,7 +73,7 @@ const ids = {
|
|||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id ?? '';
|
||||
const id = ctx.req.param('id') ?? '';
|
||||
|
||||
const rootUrl = 'https://3g.163.com';
|
||||
const currentUrl = `${rootUrl}/touch/exclusive${id ? `/sub/${id}` : ''}`;
|
||||
|
|
@ -115,7 +115,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
content('.m-linkCard').remove();
|
||||
|
||||
|
|
@ -140,9 +140,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `网易独家 - ${ids[id].title}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const got = require('@/utils/got');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -30,10 +30,10 @@ module.exports = async (ctx) => {
|
|||
link: `https://music.163.com/#/song?id=${song.id}`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${artist.name} - 歌手歌曲`,
|
||||
link: `https://music.163.com/#/artist?id=${id}`,
|
||||
description: `网易云音乐 - 歌手歌曲 - ${artist.name}`,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const got = require('@/utils/got');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const id = ctx.req.param('id');
|
||||
|
||||
const response = await got(`https://music.163.com/api/artist/albums/${id}`, {
|
||||
headers: {
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const data = response.data;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: data.artist.name,
|
||||
link: `https://music.163.com/#/artist/album?id=${id}`,
|
||||
description: `网易云音乐歌手专辑 - ${data.artist.name}`,
|
||||
|
|
@ -35,5 +35,5 @@ module.exports = async (ctx) => {
|
|||
author: singer,
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const id = ctx.req.param('id');
|
||||
|
||||
const ProcessFeed = (limit, offset) =>
|
||||
got.post('https://music.163.com/api/dj/program/byradio', {
|
||||
|
|
@ -62,7 +62,7 @@ module.exports = async (ctx) => {
|
|||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: radio.name,
|
||||
link: `https://music.163.com/djradio?id=${id}`,
|
||||
subtitle: radio.desc,
|
||||
|
|
@ -74,5 +74,5 @@ module.exports = async (ctx) => {
|
|||
itunes_author: dj.nickname,
|
||||
itunes_category: radio.category,
|
||||
item: items.flat(),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const config = require('@/config').value;
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { config } from '@/config';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -8,7 +8,7 @@ module.exports = async (ctx) => {
|
|||
throw new Error('163 Music RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>');
|
||||
}
|
||||
|
||||
const id = ctx.params.id;
|
||||
const id = ctx.req.param('id');
|
||||
|
||||
const response = await got.post('https://music.163.com/api/v3/playlist/detail', {
|
||||
headers: {
|
||||
|
|
@ -31,7 +31,7 @@ module.exports = async (ctx) => {
|
|||
});
|
||||
const songs = songinfo.data.songs;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: data.name,
|
||||
link: `https://music.163.com/#/playlist?id=${id}`,
|
||||
description: `网易云音乐歌单 - ${data.name}`,
|
||||
|
|
@ -51,5 +51,5 @@ module.exports = async (ctx) => {
|
|||
author: singer,
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const path = require('path');
|
||||
const got = require('@/utils/got');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
const renderDescription = (info) => art(path.join(__dirname, '../templates/music/userevents.art'), info);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -15,7 +15,7 @@ module.exports = async (ctx) => {
|
|||
const { data } = response;
|
||||
const { nickname, signature, avatarUrl } = data.events[0].user;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${nickname}的云村动态`,
|
||||
link: `https://music.163.com/#/user/event?id=${id}`,
|
||||
description: `网易云音乐用户动态 - ${signature}`,
|
||||
|
|
@ -48,5 +48,5 @@ module.exports = async (ctx) => {
|
|||
comments: item.info.commentCount,
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const got = require('@/utils/got');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const uid = ctx.req.param('uid');
|
||||
|
||||
const response = await got.post('https://music.163.com/api/user/playlist', {
|
||||
headers: {
|
||||
|
|
@ -22,7 +22,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const { nickname, signature, avatarUrl } = creator;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${nickname} 的所有歌单`,
|
||||
link: `https://music.163.com/user/home?id=${uid}`,
|
||||
subtitle: signature,
|
||||
|
|
@ -52,5 +52,5 @@ module.exports = async (ctx) => {
|
|||
category: pl.tags,
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const config = require('@/config').value;
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { config } from '@/config';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
const headers = {
|
||||
|
|
@ -38,18 +38,18 @@ function getItem(records) {
|
|||
}
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const type = Number.parseInt(ctx.params.type) || 0;
|
||||
const uid = ctx.req.param('uid');
|
||||
const type = Number.parseInt(ctx.req.param('type')) || 0;
|
||||
|
||||
const url = `https://music.163.com/api/v1/play/record?uid=${uid}&type=${type}`;
|
||||
const response = await got(url, { headers });
|
||||
|
||||
const records = type === 1 ? response.data.weekData : response.data.allData;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${type === 1 ? '听歌榜单(最近一周)' : '听歌榜单(所有时间}'} - ${uid}}`,
|
||||
link: `https://music.163.com/user/home?id=${uid}`,
|
||||
updated: response.headers.date,
|
||||
item: getItem(records),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const iconv = require('iconv-lite');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const rootUrl = 'https://news.163.com';
|
||||
|
||||
|
|
@ -76,9 +76,9 @@ const timeRange = {
|
|||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category || 'whole';
|
||||
const type = ctx.params.type || 'click';
|
||||
const time = ctx.params.time || 'day';
|
||||
const category = ctx.req.param('category') || 'whole';
|
||||
const type = ctx.req.param('type') || 'click';
|
||||
const time = ctx.req.param('time') || 'day';
|
||||
|
||||
const cfg = config[category];
|
||||
if (!cfg) {
|
||||
|
|
@ -94,7 +94,7 @@ module.exports = async (ctx) => {
|
|||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const $ = cheerio.load(iconv.decode(response.data, 'gbk'));
|
||||
const $ = load(iconv.decode(response.data, 'gbk'));
|
||||
|
||||
const list = $('div.tabContents')
|
||||
.eq(timeRange[time].index + (category === 'whole' ? (type === 'click' ? -1 : 2) : type === 'click' ? 0 : 2))
|
||||
|
|
@ -125,7 +125,7 @@ module.exports = async (ctx) => {
|
|||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
content('.bot_word, .js-open-app, .s-img').remove();
|
||||
content('video').each(function () {
|
||||
|
|
@ -147,9 +147,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `网易新闻${timeRange[time].title}${type === 'click' ? '点击' : '跟帖'}榜 - ${cfg.title}`,
|
||||
link: currentUrl,
|
||||
item: items.filter(Boolean),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { load } from 'cheerio';
|
||||
const typeMap = {
|
||||
1: '轻松一刻',
|
||||
2: '槽值',
|
||||
|
|
@ -19,10 +19,10 @@ const typeMap = {
|
|||
15: '沸点',
|
||||
};
|
||||
module.exports = async (ctx) => {
|
||||
if (!ctx.params.type) {
|
||||
if (!ctx.req.param('type')) {
|
||||
throw new Error('Bad parameter. See <a href="https://docs.rsshub.app/routes/game#wang-yi-da-shen">https://docs.rsshub.app/routes/game#wang-yi-da-shen</a>');
|
||||
}
|
||||
const selectedType = Number.parseInt(ctx.params.type);
|
||||
const selectedType = Number.parseInt(ctx.req.param('type'));
|
||||
let type;
|
||||
switch (selectedType) {
|
||||
case 1:
|
||||
|
|
@ -93,7 +93,7 @@ module.exports = async (ctx) => {
|
|||
}
|
||||
return ctx.cache.tryGet(url, async () => {
|
||||
const article_response = await got(url);
|
||||
const $ = cheerio.load(article_response.data);
|
||||
const $ = load(article_response.data);
|
||||
|
||||
article.link = url;
|
||||
article.description = $('.article-body').html() || $('div[class="video"]').html();
|
||||
|
|
@ -106,9 +106,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
const selectedTypeName = typeMap[selectedType];
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: selectedTypeName ? `${selectedTypeName} - 网易专栏` : '网易专栏',
|
||||
link: 'https://3g.163.com/touch/exclusive/?referFrom=163',
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://vip.open.163.com';
|
||||
|
||||
const list_response = await got(url);
|
||||
const $ = cheerio.load(list_response.data);
|
||||
const $ = load(list_response.data);
|
||||
const initialState = JSON.parse(
|
||||
$('script')
|
||||
.text()
|
||||
|
|
@ -38,7 +38,7 @@ module.exports = async (ctx) => {
|
|||
},
|
||||
});
|
||||
|
||||
const $ = cheerio.load(data.courseInfo.description, null, false);
|
||||
const $ = load(data.courseInfo.description, null, false);
|
||||
$('img').each((_, img) => {
|
||||
img.attribs.src = img.attribs.src.split('?')[0];
|
||||
delete img.attribs.width;
|
||||
|
|
@ -55,9 +55,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '网易公开课 - 精品课程',
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const iconv = require('iconv-lite');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
const titles = {
|
||||
texie: '特写',
|
||||
|
|
@ -13,7 +13,7 @@ const titles = {
|
|||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category ?? 'texie';
|
||||
const category = ctx.req.param('category') ?? 'texie';
|
||||
|
||||
const rootUrl = 'https://renjian.163.com';
|
||||
const currentUrl = `${rootUrl}/special/renjian_${category}/`;
|
||||
|
|
@ -31,14 +31,14 @@ module.exports = async (ctx) => {
|
|||
const urls = data.match(/url:"(.*)",/g);
|
||||
|
||||
if (urls) {
|
||||
items = urls.slice(0, ctx.query.limit ? Number.parseInt(ctx.query.limit) : 50).map((item) => ({
|
||||
items = urls.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 50).map((item) => ({
|
||||
link: item.match(/url:"(.*)",/)[1],
|
||||
}));
|
||||
} else {
|
||||
const $ = cheerio.load(data);
|
||||
const $ = load(data);
|
||||
|
||||
items = $('.article h3 a')
|
||||
.slice(0, ctx.query.limit ? Number.parseInt(ctx.query.limit) : 50)
|
||||
.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 50)
|
||||
.toArray()
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
|
|
@ -55,7 +55,7 @@ module.exports = async (ctx) => {
|
|||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.title = content('h1').text();
|
||||
item.author = content('script')
|
||||
|
|
@ -69,9 +69,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `人间 - ${titles[category]} - 网易新闻`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const needContent = /t|y/i.test(ctx.params.need_content ?? 'true');
|
||||
const needContent = /t|y/i.test(ctx.req.param('need_content') ?? 'true');
|
||||
|
||||
const rootUrl = 'https://gw.m.163.com';
|
||||
const currentUrl = `${rootUrl}/nc/api/v1/feed/static/normal-list?start=0&tid=T1573700340788&size=${ctx.query.limit ?? (needContent ? 30 : 200)}`;
|
||||
const currentUrl = `${rootUrl}/nc/api/v1/feed/static/normal-list?start=0&tid=T1573700340788&size=${ctx.req.query('limit') ?? (needContent ? 30 : 200)}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
@ -31,7 +31,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
content('.bot_word').remove();
|
||||
|
||||
|
|
@ -47,9 +47,9 @@ module.exports = async (ctx) => {
|
|||
);
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '今日关注 - 网易新闻',
|
||||
link: 'https://wp.m.163.com/163/html/newsapp/todayFocus/index.html',
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const iconv = require('iconv-lite');
|
||||
const { art } = require('@/utils/render');
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
const parseDyArticle = (charset, item, tryGet) =>
|
||||
|
|
@ -11,7 +11,7 @@ const parseDyArticle = (charset, item, tryGet) =>
|
|||
});
|
||||
|
||||
const html = iconv.decode(response.data, charset);
|
||||
const $ = cheerio.load(html);
|
||||
const $ = load(html);
|
||||
|
||||
$('.post_main img').each((_, i) => {
|
||||
if (!i.attribs.src) {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const { defaultDomain, getRootUrl } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const id = ctx.req.param('id');
|
||||
const { domain = defaultDomain } = ctx.query;
|
||||
const rootUrl = getRootUrl(domain, ctx);
|
||||
const rootUrl = getRootUrl(domain);
|
||||
|
||||
const currentUrl = `${rootUrl}/album/${id}`;
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
const category = $('span[data-type="tags"]')
|
||||
.first()
|
||||
|
|
@ -53,7 +53,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
content('.tab-content').remove();
|
||||
|
||||
|
|
@ -69,10 +69,10 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
description: $('meta[property="og:description"]').attr('content'),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const { defaultDomain, getRootUrl } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category ?? '';
|
||||
const category = ctx.req.param('category') ?? '';
|
||||
const { domain = defaultDomain } = ctx.query;
|
||||
const rootUrl = getRootUrl(domain, ctx);
|
||||
const rootUrl = getRootUrl(domain);
|
||||
|
||||
const currentUrl = `${rootUrl}/blogs${category ? `/${category}` : ''}`;
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('.title')
|
||||
.toArray()
|
||||
|
|
@ -38,7 +38,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.pubDate = parseDate(content('.date').first().text());
|
||||
|
||||
|
|
@ -55,12 +55,12 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title')
|
||||
.text()
|
||||
.replace(/最新的/, $('.article-nav .active').text()),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
description: $('meta[property="og:description"]').attr('content'),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
const { defaultDomain, getRootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category ?? 'all';
|
||||
const keyword = ctx.params.keyword ?? '';
|
||||
const time = ctx.params.time ?? 'a';
|
||||
const order = ctx.params.order ?? 'mr';
|
||||
const category = ctx.req.param('category') ?? 'all';
|
||||
const keyword = ctx.req.param('keyword') ?? '';
|
||||
const time = ctx.req.param('time') ?? 'a';
|
||||
const order = ctx.req.param('order') ?? 'mr';
|
||||
const { domain = defaultDomain } = ctx.query;
|
||||
const rootUrl = getRootUrl(domain, ctx);
|
||||
const rootUrl = getRootUrl(domain);
|
||||
|
||||
const currentUrl = `${rootUrl}/albums${category === 'all' ? '' : `/${category}`}${keyword ? `?screen=${keyword}` : '?'}${time === 'a' ? '' : `&t=${time}`}${order === 'mr' ? '' : `&o=${order}`}`;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
const { defaultDomain, getRootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const option = ctx.params.option ?? 'photos';
|
||||
const category = ctx.params.category ?? 'all';
|
||||
const keyword = ctx.params.keyword ?? '';
|
||||
const time = ctx.params.time ?? 'a';
|
||||
const order = ctx.params.order ?? 'mr';
|
||||
const option = ctx.req.param('option') ?? 'photos';
|
||||
const category = ctx.req.param('category') ?? 'all';
|
||||
const keyword = ctx.req.param('keyword') ?? '';
|
||||
const time = ctx.req.param('time') ?? 'a';
|
||||
const order = ctx.req.param('order') ?? 'mr';
|
||||
const { domain = defaultDomain } = ctx.query;
|
||||
const rootUrl = getRootUrl(domain, ctx);
|
||||
const rootUrl = getRootUrl(domain);
|
||||
|
||||
const currentUrl = `${rootUrl}/search/${option}${category === 'all' ? '' : `/${category}`}${keyword ? `?search_query=${keyword}` : '?'}${time === 'a' ? '' : `&t=${time}`}${order === 'mr' ? '' : `&o=${order}`}`;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
const config = require('@/config').value;
|
||||
import { config } from '@/config';
|
||||
|
||||
const defaultDomain = 'jmcomic1.me';
|
||||
// list of address: https://jmcomic2.bet
|
||||
const allowDomain = new Set(['18comic.vip', '18comic.org', 'jmcomic.me', 'jmcomic1.me', 'jm-comic3.art', 'jm-comic.club', 'jm-comic2.ark']);
|
||||
|
||||
const getRootUrl = (domain, ctx) => {
|
||||
const getRootUrl = (domain) => {
|
||||
if (!config.feature.allow_user_supply_unsafe_domain && !allowDomain.has(domain)) {
|
||||
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
||||
throw new Error(`This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
||||
}
|
||||
|
||||
return `https://${domain}`;
|
||||
|
|
@ -25,10 +25,10 @@ module.exports = {
|
|||
|
||||
const response = await got(currentUrl);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('.video-title')
|
||||
.slice(0, ctx.query.limit ? Number.parseInt(ctx.query.limit) : 20)
|
||||
.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 20)
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
|
@ -45,7 +45,7 @@ module.exports = {
|
|||
ctx.cache.tryGet(item.guid, async () => {
|
||||
const detailResponse = await got(item.link);
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.pubDate = parseDate(content('div[itemprop="datePublished"]').first().attr('content'));
|
||||
item.category = content('span[data-type="tags"]')
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const iconv = require('iconv-lite');
|
||||
const { isValidHost } = require('@/utils/valid-host');
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ const setCookie = function (cookieName, cookieValue, seconds, path, domain, secu
|
|||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const city = ctx.params.city ?? 'www';
|
||||
const city = ctx.req.param('city') ?? 'www';
|
||||
if (!isValidHost(city)) {
|
||||
throw new Error('Invalid city');
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ module.exports = async (ctx) => {
|
|||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const $ = cheerio.load(iconv.decode(response.data, 'gbk'));
|
||||
const $ = load(iconv.decode(response.data, 'gbk'));
|
||||
|
||||
$('.title-more').remove();
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ module.exports = async (ctx) => {
|
|||
},
|
||||
});
|
||||
|
||||
const content = cheerio.load(iconv.decode(detailResponse.data, 'gbk'));
|
||||
const content = load(iconv.decode(detailResponse.data, 'gbk'));
|
||||
|
||||
content('.name-lz, .postView-pk-mod').remove();
|
||||
|
||||
|
|
@ -70,9 +70,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title').text().split('-')[0],
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const path = ctx.params.path ?? '';
|
||||
const path = ctx.req.param('path') ?? '';
|
||||
const rootUrl = `https://www.1lou.me`;
|
||||
const currentUrl = `${rootUrl}/${path}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('li.media.thread.tap:not(.hidden-sm)')
|
||||
.toArray()
|
||||
|
|
@ -33,7 +33,7 @@ module.exports = async (ctx) => {
|
|||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
item.description = content('.message.break-all').html();
|
||||
const torrents = content('.attachlist').find('a');
|
||||
if (torrents.length > 0) {
|
||||
|
|
@ -45,9 +45,9 @@ module.exports = async (ctx) => {
|
|||
})
|
||||
)
|
||||
);
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '1Lou',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const categoryMap = {
|
||||
|
|
@ -37,12 +37,12 @@ module.exports = async (ctx) => {
|
|||
const { data } = await got(`${rootUrl}/wp-json/wp/v2/posts`, {
|
||||
searchParams: {
|
||||
categories: category ? categoryMap[category].id : undefined,
|
||||
per_page: ctx.query.limit ? Number.parseInt(ctx.query.limit) : 100,
|
||||
per_page: ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 100,
|
||||
},
|
||||
});
|
||||
|
||||
const items = data.map((item) => {
|
||||
const $ = cheerio.load(item.content.rendered, null, false);
|
||||
const $ = load(item.content.rendered, null, false);
|
||||
$('h2').nextAll().remove();
|
||||
$('[powered-by="1p3a"], h2').remove();
|
||||
$('img').each((_, img) => {
|
||||
|
|
@ -59,9 +59,9 @@ module.exports = async (ctx) => {
|
|||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${category ? `${categoryMap[category].title} | ` : ''}美国留学就业生活攻略`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
const { rootUrl, apiRootUrl, types, ProcessThreads } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id ?? '';
|
||||
const type = ctx.params.type ?? 'hot';
|
||||
const order = ctx.params.order ?? '';
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit) : 10;
|
||||
const id = ctx.req.param('id') ?? '';
|
||||
const type = ctx.req.param('type') ?? 'hot';
|
||||
const order = ctx.req.param('order') ?? '';
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10;
|
||||
|
||||
const currentUrl = `${rootUrl}${id ? `/category/${id}` : ''}`;
|
||||
const apiUrl = `${apiRootUrl}/api${id ? `/tags/${id}/` : ''}threads?type=${type}&includes=tags,forum_name,summary&ps=${limit}&pg=1&order=${order === '' ? '' : 'time_desc'}&is_groupid=1`;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `一亩三分地 - ${id}${types[type]}`,
|
||||
link: currentUrl,
|
||||
item: await ProcessThreads(ctx.cache.tryGet, apiUrl, order),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const { art } = require('@/utils/render');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -53,7 +53,7 @@ module.exports = async (ctx) => {
|
|||
// },
|
||||
// });
|
||||
// const tid = responseBasic_1.data.background.tid;
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '录取结果 - 一亩三分地',
|
||||
link: 'https://offer.1point3acres.com',
|
||||
item: data.map((item) => ({
|
||||
|
|
@ -65,5 +65,5 @@ module.exports = async (ctx) => {
|
|||
link: 'https://offer.1point3acres.com',
|
||||
guid: `1point3acres:offer:${year}:${major}:${school}:${item.id}`,
|
||||
})),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,17 +12,17 @@ const sections = {
|
|||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id ?? '';
|
||||
const type = ctx.params.type ?? 'hot';
|
||||
const order = ctx.params.order ?? '';
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit) : 10;
|
||||
const id = ctx.req.param('id') ?? '';
|
||||
const type = ctx.req.param('type') ?? 'hot';
|
||||
const order = ctx.req.param('order') ?? '';
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10;
|
||||
|
||||
const currentUrl = `${rootUrl}${id ? (isNaN(id) ? `/category/${id}` : `/section/${id}`) : ''}`;
|
||||
const apiUrl = `${apiRootUrl}/api${id ? (isNaN(id) ? `/tags/${id}/` : `/forums/${id}/`) : ''}threads?type=${type}&includes=tags,forum_name,summary&ps=${limit}&pg=1&order=${order === '' ? '' : 'time_desc'}&is_groupid=1`;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `一亩三分地 - ${Object.hasOwn(sections, id) ? sections[id] : id}${types[type]}`,
|
||||
link: currentUrl,
|
||||
item: await ProcessThreads(ctx.cache.tryGet, apiUrl, order),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
const { rootUrl, apiRootUrl, types, ProcessThreads } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type ?? 'hot';
|
||||
const order = ctx.params.order ?? '';
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit) : 10;
|
||||
const type = ctx.req.param('type') ?? 'hot';
|
||||
const order = ctx.req.param('order') ?? '';
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10;
|
||||
|
||||
const apiUrl = `${apiRootUrl}/api/threads?type=${type}&includes=tags,forum_name,summary&ps=${limit}&pg=1&order=${order === '' ? '' : 'time_desc'}&is_groupid=1`;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `一亩三分地 - ${types[type]}`,
|
||||
link: rootUrl,
|
||||
item: await ProcessThreads(ctx.cache.tryGet, apiUrl, order),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const got = require('@/utils/got');
|
||||
import got from '@/utils/got';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
|
@ -6,7 +6,7 @@ module.exports = async (ctx) => {
|
|||
const { posts } = (await got.get(`https://instant.1point3acres.com/v2/api/user/post?pg=1&ps=10&user_id=${id}`)).data;
|
||||
const [{ author_name: author }] = posts;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${author}的回复 - 一亩三分地`,
|
||||
link: `https://instant.1point3acres.com/profile/${id}`,
|
||||
description: `${author}的回复 - 一亩三分地`,
|
||||
|
|
@ -17,5 +17,5 @@ module.exports = async (ctx) => {
|
|||
pubDate: new Date(item.create_time + ' GMT+8').toUTCString(),
|
||||
link: `https://instant.1point3acres.com/thread/${item.thread_id}/post/${item.id}`,
|
||||
})),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const got = require('@/utils/got');
|
||||
import got from '@/utils/got';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
|
@ -6,7 +6,7 @@ module.exports = async (ctx) => {
|
|||
const { threads } = (await got.get(`https://instant.1point3acres.com/v2/api/user/thread?pg=1&ps=10&user_id=${id}`)).data;
|
||||
const [{ author_name: author }] = threads;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${author}的主题帖 - 一亩三分地`,
|
||||
link: `https://instant.1point3acres.com/profile/${id}`,
|
||||
description: `${author}的主题帖 - 一亩三分地`,
|
||||
|
|
@ -17,5 +17,5 @@ module.exports = async (ctx) => {
|
|||
pubDate: new Date(item.update_time + ' GMT+8').toUTCString(),
|
||||
link: `https://instant.1point3acres.com/thread/${item.id}`,
|
||||
})),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
const bbcode = require('bbcodejs');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id ?? '2';
|
||||
const id = ctx.req.param('id') ?? '2';
|
||||
|
||||
const rootUrl = 'https://hjd2048.com';
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ module.exports = async (ctx) => {
|
|||
accept: '*/*',
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response);
|
||||
const $ = load(response);
|
||||
return $('ul li a')
|
||||
.toArray()
|
||||
.find((item) => $(item).text() === '最新線路1').attribs.href;
|
||||
|
|
@ -29,7 +29,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const currentHost = `https://${new URL(response.url).host}`; // redirected host
|
||||
|
||||
$('#shortcut').remove();
|
||||
|
|
@ -58,7 +58,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
content('.ads, .tips').remove();
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ module.exports = async (ctx) => {
|
|||
url: downloadLink.text(),
|
||||
});
|
||||
|
||||
const torrent = cheerio.load(torrentResponse.data);
|
||||
const torrent = load(torrentResponse.data);
|
||||
|
||||
item.enclosure_type = 'application/x-bittorrent';
|
||||
item.enclosure_url = `https://data.datapps.org/${torrent('.uk-button').last().attr('href')}`;
|
||||
|
|
@ -105,9 +105,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${$('#main #breadCrumb a').last().text()} - 2048核基地`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
// http://www.2cycd.com/forum.php?mod=forumdisplay&fid=43&orderby=dateline
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const fid = ctx.params.fid ?? '43';
|
||||
const sort = ctx.params.sort ?? 'dateline';
|
||||
const fid = ctx.req.param('fid') ?? '43';
|
||||
const sort = ctx.req.param('sort') ?? 'dateline';
|
||||
|
||||
const rootUrl = 'http://www.2cycd.com/forum.php?mod=forumdisplay';
|
||||
const currentUrl = `${rootUrl}&fid=${fid}&orderby=${sort}`;
|
||||
|
|
@ -17,7 +17,7 @@ module.exports = async (ctx) => {
|
|||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const $ = cheerio.load(iconv.decode(response.data, 'gbk'));
|
||||
const $ = load(iconv.decode(response.data, 'gbk'));
|
||||
|
||||
const list = $('tbody[id^="normalthread_"]')
|
||||
.map((_, item) => {
|
||||
|
|
@ -39,7 +39,7 @@ module.exports = async (ctx) => {
|
|||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const content = cheerio.load(iconv.decode(detailResponse.data, 'gbk'));
|
||||
const content = load(iconv.decode(detailResponse.data, 'gbk'));
|
||||
const first_post = content('td[id^="postmessage_"]').first();
|
||||
const dateobj = content('em[id^="authorposton"]').first();
|
||||
item.description = first_post.html();
|
||||
|
|
@ -49,9 +49,9 @@ module.exports = async (ctx) => {
|
|||
})
|
||||
)
|
||||
);
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const { rootUrl, ProcessItem } = require('./utils');
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ const categories = {
|
|||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category ?? '24';
|
||||
const category = ctx.req.param('category') ?? '24';
|
||||
|
||||
const currentUrl = category === '24' ? rootUrl : `${rootUrl}/hot-list/catalog`;
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ module.exports = async (ctx) => {
|
|||
const data = getProperty(JSON.parse(response.data.match(/window.initialState=({.*})/)[1]), categories[category].key);
|
||||
|
||||
let items = data
|
||||
.slice(0, ctx.query.limit ? Number.parseInt(ctx.query.limit) : 10)
|
||||
.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10)
|
||||
.filter((item) => item.itemType !== 0)
|
||||
.map((item) => {
|
||||
item = item.templateMaterial ?? item;
|
||||
|
|
@ -51,9 +51,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
items = await Promise.all(items.map((item) => ProcessItem(item, ctx.cache.tryGet)));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `36氪 - ${categories[category].title}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const { rootUrl, ProcessItem } = require('./utils');
|
||||
|
||||
|
|
@ -23,12 +23,12 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
const data = JSON.parse(response.data.match(/"itemList":(\[.*?])/)[1]);
|
||||
|
||||
let items = data
|
||||
.slice(0, ctx.query.limit ? Number.parseInt(ctx.query.limit) : 30)
|
||||
.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 30)
|
||||
.filter((item) => item.itemType !== 0)
|
||||
.map((item) => {
|
||||
item = item.templateMaterial ?? item;
|
||||
|
|
@ -45,9 +45,9 @@ module.exports = async (ctx) => {
|
|||
items = await Promise.all(items.map((item) => ProcessItem(item, ctx.cache.tryGet)));
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `36氪 - ${$('title').text().split('_')[0]}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const CryptoJS = require('crypto-js');
|
||||
|
||||
const rootUrl = 'https://www.36kr.com';
|
||||
|
|
@ -16,7 +16,7 @@ module.exports = {
|
|||
const cipherTextList = detailResponse.data.match(/{"state":"(.*)","isEncrypt":true}/) ?? [];
|
||||
|
||||
if (cipherTextList.length === 0) {
|
||||
const $ = cheerio.load(detailResponse.body);
|
||||
const $ = load(detailResponse.body);
|
||||
item.description = $('div.articleDetailContent').html();
|
||||
} else {
|
||||
const key = CryptoJS.enc.Utf8.parse('efabccee-b754-4c');
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const { parseArticle } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -8,7 +8,7 @@ module.exports = async (ctx) => {
|
|||
const url = `https://www.3dmgame.com/games/${name}/${type}/`;
|
||||
|
||||
const { data: response } = await got(url);
|
||||
const $ = cheerio.load(response);
|
||||
const $ = load(response);
|
||||
const listSelector = type === 'resource' ? $('.ZQ_Left .Llis_4 .lis li, .zq_left .rigtbox7 li').toArray() : $('.ZQ_Left .lis, .zq_left .newsleft li').toArray();
|
||||
|
||||
const list = listSelector.map((i) => {
|
||||
|
|
@ -25,10 +25,10 @@ module.exports = async (ctx) => {
|
|||
|
||||
const items = await Promise.all(list.map((item) => parseArticle(item, ctx.cache.tryGet)));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('head title').text().split('_')[0],
|
||||
description: $('head meta[name="Description"]').attr('content'),
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
const { parseArticle } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -9,7 +9,7 @@ module.exports = async (ctx) => {
|
|||
const isArcPost = category && !isNaN(category); // https://www.3dmgame.com/news/\d+/
|
||||
const url = `https://www.3dmgame.com/${category && category !== 'news_36_1' ? 'news/' : ''}${category ?? 'news'}/`;
|
||||
const res = await got(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
const $ = load(res.data);
|
||||
const list = $(isArcPost ? '.selectarcpost' : '.selectpost')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
|
|
@ -33,10 +33,10 @@ module.exports = async (ctx) => {
|
|||
|
||||
const out = await Promise.all(list.map((item) => parseArticle(item, ctx.cache.tryGet)));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '3DM - ' + $('title').text().split('_')[0],
|
||||
description: $('meta[name="Description"]').attr('content'),
|
||||
link: url,
|
||||
item: out,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
const parseArticle = (item, tryGet) =>
|
||||
tryGet(item.link, async () => {
|
||||
const { data: response } = await got(item.link);
|
||||
const $ = cheerio.load(response);
|
||||
const $ = load(response);
|
||||
|
||||
if (item.link.startsWith('https://dl.3dmgame.com/')) {
|
||||
const lis = $('.patchtop .lis');
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const rootUrl = 'https://www.423down.com';
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ module.exports = async (ctx) => {
|
|||
const url = `${rootUrl}/${categeoryMap[category][type]}`;
|
||||
|
||||
const response = await got.get(url);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const list = $('div.content-wrap > div > ul > li > a')
|
||||
.filter((_, item) => {
|
||||
const notAnotherWebPage = $(item).attr('style') !== 'display: none !important;';
|
||||
|
|
@ -85,7 +85,7 @@ module.exports = async (ctx) => {
|
|||
list.map(async (item) => {
|
||||
item = await ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got.get(item.link);
|
||||
const $ = cheerio.load(detailResponse.data);
|
||||
const $ = load(detailResponse.data);
|
||||
|
||||
const title = $('div.content-wrap > div > div.meta > h1 > a').text();
|
||||
const pageContent = $('div.content-wrap > div > div.entry').html();
|
||||
|
|
@ -106,9 +106,9 @@ module.exports = async (ctx) => {
|
|||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `423down-${titleMap[category][type]}`,
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const got = require('@/utils/got');
|
||||
import got from '@/utils/got';
|
||||
const { parseList, parseItem, getCategories } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { category } = ctx.params;
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit) : 25;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 25;
|
||||
const isLatest = !category;
|
||||
|
||||
const { data: response } = await got(`https://www.4gamers.com.tw/site/api/news/${isLatest ? 'latest' : `by-category/${category}`}`, {
|
||||
|
|
@ -23,9 +23,9 @@ module.exports = async (ctx) => {
|
|||
categoryName = categories.find((c) => c.id === Number.parseInt(category)).name;
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `4Gamers - ${categoryName}`,
|
||||
link: `https://www.4gamers.com.tw/news${isLatest ? '' : `/category/${category}/${categoryName}`}`,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const got = require('@/utils/got');
|
||||
import got from '@/utils/got';
|
||||
const { parseList, parseItem } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { tag } = ctx.params;
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit) : 25;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 25;
|
||||
|
||||
const { data: response } = await got(`https://www.4gamers.com.tw/site/api/news/by-tag`, {
|
||||
searchParams: {
|
||||
|
|
@ -15,9 +15,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
const items = await Promise.all(list.map((item) => ctx.cache.tryGet(item.link, () => parseItem(item))));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `4Gamers - #${tag}`,
|
||||
link: `https://www.4gamers.com.tw/news/tag/${tag}`,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const got = require('@/utils/got');
|
||||
import got from '@/utils/got';
|
||||
const { parseList, parseItem } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { topic } = ctx.params;
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit) : 25;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 25;
|
||||
|
||||
const { data: response } = await got(`https://www.4gamers.com.tw/site/api/news/option-cfg/${topic}`, {
|
||||
searchParams: {
|
||||
|
|
@ -14,9 +14,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
const items = await Promise.all(list.map((item) => ctx.cache.tryGet(item.link, () => parseItem(item))));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `4Gamers - ${topic}`,
|
||||
link: `https://www.4gamers.com.tw/news/option-cfg/${topic}`,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
import got from '@/utils/got';
|
||||
const path = require('path');
|
||||
const { art } = require('@/utils/render');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import { art } from '@/utils/render';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const getCategories = (tryGet) =>
|
||||
tryGet('4gamers:categories', async () => {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id ?? '2-1';
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit) : 25;
|
||||
const id = ctx.req.param('id') ?? '2-1';
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 25;
|
||||
|
||||
const rootUrl = 'https://www.4ksj.com';
|
||||
const currentUrl = `${rootUrl}/forum-${id}.html`;
|
||||
|
|
@ -19,7 +19,7 @@ module.exports = async (ctx) => {
|
|||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const $ = cheerio.load(iconv.decode(response.data, 'gbk'));
|
||||
const $ = load(iconv.decode(response.data, 'gbk'));
|
||||
|
||||
let items = $('div.nex_cmo_piv a')
|
||||
.slice(0, limit)
|
||||
|
|
@ -41,7 +41,7 @@ module.exports = async (ctx) => {
|
|||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const content = cheerio.load(iconv.decode(detailResponse.data, 'gbk'));
|
||||
const content = load(iconv.decode(detailResponse.data, 'gbk'));
|
||||
|
||||
const details = {};
|
||||
const links = {};
|
||||
|
|
@ -104,12 +104,12 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `4k世界 - ${$('#fontsearch ul.cl li.a')
|
||||
.toArray()
|
||||
.map((a) => $(a).text())
|
||||
.join('+')}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
const { baseUrl, getTribeDetail, getTribeSets } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const limit = Number.parseInt(ctx.query.limit) || 100;
|
||||
const limit = Number.parseInt(ctx.req.query('limit')) || 100;
|
||||
|
||||
const { tribe } = await getTribeDetail(id, ctx.cache.tryGet);
|
||||
const tribeSets = await getTribeSets(id, limit, ctx.cache.tryGet);
|
||||
|
|
@ -19,11 +19,11 @@ module.exports = async (ctx) => {
|
|||
link: `${baseUrl}/community/set/${item.id}/details`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: tribe.name,
|
||||
description: `${tribe.watchword} - ${tribe.introduce}`,
|
||||
link: `${baseUrl}/page/tribe/detail?tribeId=${id}&pagev=set`,
|
||||
image: tribe.avatar.a1,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const { art } = require('@/utils/render');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import { art } from '@/utils/render';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const path = require('path');
|
||||
const { baseUrl, getUserInfoFromUsername, getUserInfoFromId, getUserWorks } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let { id } = ctx.params;
|
||||
const limit = Number.parseInt(ctx.query.limit) || 100;
|
||||
const limit = Number.parseInt(ctx.req.query('limit')) || 100;
|
||||
|
||||
if (id.length !== 33) {
|
||||
id = (await getUserInfoFromUsername(id, ctx.cache.tryGet)).id;
|
||||
|
|
@ -22,11 +22,11 @@ module.exports = async (ctx) => {
|
|||
link: `${baseUrl}/community/photo-details/${item.id}`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: userInfo.nickName,
|
||||
description: userInfo.about,
|
||||
image: userInfo.avatar.a1,
|
||||
link: `${baseUrl}/${id}`,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('@/config').value;
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { config } from '@/config';
|
||||
|
||||
const baseUrl = 'https://500px.com.cn';
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ const headers = {
|
|||
const getUserInfoFromUsername = (username, tryGet) =>
|
||||
tryGet(`500px:user:${username}`, async () => {
|
||||
const { data } = await got(`${baseUrl}/${username}`);
|
||||
const $ = cheerio.load(data);
|
||||
const $ = load(data);
|
||||
return JSON.parse(
|
||||
$('script[type="text/javascript"]')
|
||||
.text()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'http://www.50forum.org.cn';
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
if (!data) {
|
||||
return;
|
||||
}
|
||||
const $ = cheerio.load(data);
|
||||
const $ = load(data);
|
||||
let out = $('div.container div.list_list.mtop10 ul li')
|
||||
.find('a')
|
||||
.toArray()
|
||||
|
|
@ -34,7 +34,7 @@ module.exports = async (ctx) => {
|
|||
ctx.cache.tryGet(item.link, async () => {
|
||||
const result = await got(item.link);
|
||||
|
||||
const $ = cheerio.load(result.data);
|
||||
const $ = load(result.data);
|
||||
|
||||
item.description = $('div.list_content').html();
|
||||
item.pubDate = timezone(parseDate($('span#publish_time').text(), 'YYYY-MM-DD HH:mm'), +8);
|
||||
|
|
@ -42,10 +42,10 @@ module.exports = async (ctx) => {
|
|||
})
|
||||
)
|
||||
);
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `中国经济50人论坛专家文章`,
|
||||
link: 'http://www.50forum.org.cn/home/article/index/category/zhuanjia.html',
|
||||
description: '中国经济50人论坛专家文章',
|
||||
item: out,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const area = ctx.params.area ?? 'global';
|
||||
const type = ctx.params.type ?? '';
|
||||
const area = ctx.req.param('area') ?? 'global';
|
||||
const type = ctx.req.param('type') ?? '';
|
||||
|
||||
const rootUrl = 'https://www.52hrtt.com';
|
||||
const currentUrl = `${rootUrl}/${area}/n/w${type ? `?infoTypeId=${type}` : ''}`;
|
||||
|
|
@ -21,7 +21,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(titleResponse.data);
|
||||
const $ = load(titleResponse.data);
|
||||
|
||||
const list = response.data.data.infosMap.infoList
|
||||
.filter((item) => item.infoTitle)
|
||||
|
|
@ -39,7 +39,7 @@ module.exports = async (ctx) => {
|
|||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.description = content('.info-content').html();
|
||||
|
||||
|
|
@ -48,9 +48,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${response.data.data.area.areaName} - ${$('.router-link-active').eq(0).text()} - 华人头条`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id ?? '';
|
||||
const classId = ctx.params.classId ?? '';
|
||||
const id = ctx.req.param('id') ?? '';
|
||||
const classId = ctx.req.param('classId') ?? '';
|
||||
|
||||
const rootUrl = 'https://www.52hrtt.com';
|
||||
const currentUrl = `${rootUrl}/global/n/w/symposium/${id}`;
|
||||
|
|
@ -21,7 +21,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(titleResponse.data);
|
||||
const $ = load(titleResponse.data);
|
||||
|
||||
const list = response.data.data
|
||||
.filter((item) => item.infoTitle)
|
||||
|
|
@ -39,7 +39,7 @@ module.exports = async (ctx) => {
|
|||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.description = content('.info-content').html();
|
||||
|
||||
|
|
@ -48,9 +48,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ const { rootUrl, fetchItems } = require('./util');
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const { category = '1_1' } = ctx.params;
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit, 10) : 30;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
|
||||
|
||||
const currentUrl = new URL(`class/${category}.html`, rootUrl).href;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ const { rootUrl, fetchItems } = require('./util');
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const { category = 'weekvisit' } = ctx.params;
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit, 10) : 30;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
|
||||
|
||||
const currentUrl = new URL(`top/${category.split(/_/)[0]}_1.html`, rootUrl).href;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const iconv = require('iconv-lite');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
const rootUrl = 'https://www.56kog.com';
|
||||
|
|
@ -13,7 +13,7 @@ const fetchItems = async (limit, currentUrl, tryGet) => {
|
|||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const $ = cheerio.load(iconv.decode(response, 'gbk'));
|
||||
const $ = load(iconv.decode(response, 'gbk'));
|
||||
|
||||
let items = $('p.line')
|
||||
.toArray()
|
||||
|
|
@ -37,7 +37,7 @@ const fetchItems = async (limit, currentUrl, tryGet) => {
|
|||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const content = cheerio.load(iconv.decode(detailResponse, 'gbk'));
|
||||
const content = load(iconv.decode(detailResponse, 'gbk'));
|
||||
|
||||
const details = content('div.mohe-content p')
|
||||
.toArray()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const path = require('path');
|
||||
|
||||
const { CookieJar } = require('tough-cookie');
|
||||
const cheerio = require('cheerio');
|
||||
import { load } from 'cheerio';
|
||||
|
||||
const got = require('@/utils/got');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
const { isValidHost } = require('@/utils/valid-host');
|
||||
|
||||
const cookieJar = new CookieJar();
|
||||
|
|
@ -26,7 +26,7 @@ function appendRentalAPIParams(urlString) {
|
|||
async function getToken() {
|
||||
const html = await client('https://rent.591.com.tw').text();
|
||||
|
||||
const $ = cheerio.load(html);
|
||||
const $ = load(html);
|
||||
const csrfToken = $('meta[name="csrf-token"]').attr('content');
|
||||
|
||||
if (!csrfToken) {
|
||||
|
|
@ -104,8 +104,8 @@ async function getHouseList(houseListURL) {
|
|||
const renderHouse = (house) => art(path.join(__dirname, 'templates/house.art'), { house });
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const query = ctx.params.query ?? '';
|
||||
const country = ctx.params.country ?? 'tw';
|
||||
const query = ctx.req.param('query') ?? '';
|
||||
const country = ctx.req.param('country') ?? 'tw';
|
||||
|
||||
if (!isValidHost(country) && country !== 'tw') {
|
||||
throw new Error('Invalid country codes. Only "tw" is supported now.');
|
||||
|
|
@ -131,14 +131,14 @@ module.exports = async (ctx) => {
|
|||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '591 租屋 - 自訂查詢',
|
||||
link: queryUrl,
|
||||
description: `591 租屋 - 自訂查詢, query: ${query}`,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.json = {
|
||||
ctx.set('json', {
|
||||
houses,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const cheerio = require('cheerio');
|
||||
import { load } from 'cheerio';
|
||||
const zlib = require('zlib');
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const config = require('@/config').value;
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { config } from '@/config';
|
||||
const { getAcwScV2ByArg1 } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -68,7 +68,7 @@ module.exports = async (ctx) => {
|
|||
cookie: `acw_sc__v2=${acw_sc__v2}`,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(detailResponse);
|
||||
const $ = load(detailResponse);
|
||||
|
||||
const content = $('.article-text');
|
||||
const res = [];
|
||||
|
|
@ -92,9 +92,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '5EPLAY',
|
||||
link: 'https://csgo.5eplay.com/article',
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id ?? 'chan1';
|
||||
const type = ctx.params.type ?? '';
|
||||
const keyword = ctx.params.keyword ?? '';
|
||||
const id = ctx.req.param('id') ?? 'chan1';
|
||||
const type = ctx.req.param('type') ?? '';
|
||||
const keyword = ctx.req.param('keyword') ?? '';
|
||||
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit) : 50;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 50;
|
||||
|
||||
const rootUrl = 'https://club.6parkbbs.com';
|
||||
const indexUrl = `${rootUrl}/${id}/index.php`;
|
||||
|
|
@ -19,7 +19,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('#d_list ul li, #thread_list li, .t_l .t_subject')
|
||||
.toArray()
|
||||
|
|
@ -42,7 +42,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.title = content('title').text().replace(' -6park.com', '');
|
||||
item.author = detailResponse.data.match(/送交者: .*>(.*)<.*\[/)[1];
|
||||
|
|
@ -57,9 +57,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const site = ctx.params.site ?? 'newspark';
|
||||
const id = ctx.params.id ?? '';
|
||||
const keyword = ctx.params.keyword ?? '';
|
||||
const site = ctx.req.param('site') ?? 'newspark';
|
||||
const id = ctx.req.param('id') ?? '';
|
||||
const keyword = ctx.req.param('keyword') ?? '';
|
||||
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit) : 50;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 50;
|
||||
|
||||
const isLocal = site === 'local';
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('#d_list ul li, #thread_list li, .t_l .t_subject')
|
||||
.toArray()
|
||||
|
|
@ -49,7 +49,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
const matches = detailResponse.data.match(/新闻来源:(.*?)于.*(\d{4}(?:-\d{2}){2} (?:\d{1,2}:){2}\d{1,2})/);
|
||||
|
||||
|
|
@ -66,9 +66,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ const baseURL = 'https://www.hao6v.cc/gvod/zx.html';
|
|||
module.exports = async (ctx) => {
|
||||
const item = await processItems(ctx, baseURL);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '6v电影-最新电影',
|
||||
link: baseURL,
|
||||
description: '6v最新电影RSS',
|
||||
item,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ const baseURL = 'https://www.hao6v.tv/gvod/dsj.html';
|
|||
module.exports = async (ctx) => {
|
||||
const item = await processItems(ctx, baseURL);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '6v电影-最新电影',
|
||||
link: baseURL,
|
||||
description: '6v最新电影RSS',
|
||||
item,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const got = require('@/utils/got');
|
||||
import got from '@/utils/got';
|
||||
const iconv = require('iconv-lite');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const utils = {
|
||||
loadDetailPage: async function loadDetailPage(link) {
|
||||
|
|
@ -11,7 +11,7 @@ const utils = {
|
|||
});
|
||||
response.data = iconv.decode(response.data, 'gb2312');
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
const detailInfo = {
|
||||
title: $('title')
|
||||
|
|
@ -34,7 +34,7 @@ const utils = {
|
|||
});
|
||||
response.data = iconv.decode(response.data, 'gb2312');
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const list = $('ul.list')[0].children;
|
||||
|
||||
const process = await Promise.all(
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -14,10 +14,10 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('.card-title')
|
||||
.slice(0, ctx.query.limit ? Number.parseInt(ctx.query.limit) : 30)
|
||||
.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 30)
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
|
@ -38,7 +38,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
content('.tag, .level').remove();
|
||||
content('.lazy').each(function () {
|
||||
|
|
@ -66,9 +66,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `78动漫 - ${$('title').text().split('_')[0]} - ${$('.actived').first().text()}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const language = ctx.params.language ?? 'en';
|
||||
const category = ctx.params.category ?? 'censored_list';
|
||||
const type = ctx.params.type ?? 'all';
|
||||
const language = ctx.req.param('language') ?? 'en';
|
||||
const category = ctx.req.param('category') ?? 'censored_list';
|
||||
const type = ctx.req.param('type') ?? 'all';
|
||||
|
||||
const rootUrl = 'https://7mmtv.sx';
|
||||
const currentUrl = `${rootUrl}/${language}/${category}/${type}/1.html`;
|
||||
|
|
@ -17,7 +17,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('.video')
|
||||
.toArray()
|
||||
|
|
@ -43,7 +43,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
||||
cover: content('.content_main_cover img').attr('src'),
|
||||
|
|
@ -67,12 +67,12 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title')
|
||||
.text()
|
||||
.replace(/ - Watch JAV Online/, ''),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
description: $('meta[name="description"]').attr('content'),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const thePath = ctx.path.replace(/^\/81rc/, '');
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit, 10) : 30;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
|
||||
|
||||
const rootUrl = 'https://81rc.81.cn';
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const { data: response } = await got(currentUrl);
|
||||
|
||||
const $ = cheerio.load(response);
|
||||
const $ = load(response);
|
||||
|
||||
let items = $('div.left-news ul li a')
|
||||
.slice(0, limit)
|
||||
|
|
@ -34,7 +34,7 @@ module.exports = async (ctx) => {
|
|||
ctx.cache.tryGet(item.link, async () => {
|
||||
const { data: detailResponse } = await got(item.link);
|
||||
|
||||
const content = cheerio.load(detailResponse);
|
||||
const content = load(detailResponse);
|
||||
|
||||
item.description = content('.txt').html();
|
||||
item.author = content('meta[name="reporter"]').prop('content') || content('meta[name="author"]').prop('content');
|
||||
|
|
@ -46,7 +46,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const icon = $('link[rel="icon"]').prop('href');
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
item: items,
|
||||
title: `军队人才网 - ${$('div.left-word')
|
||||
.find('a')
|
||||
|
|
@ -58,5 +58,5 @@ module.exports = async (ctx) => {
|
|||
language: 'zh-cn',
|
||||
icon,
|
||||
logo: icon,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const iconv = require('iconv-lite');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id = '751' } = ctx.params;
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit, 10) : 30;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
|
||||
|
||||
const rootUrl = 'https://www.8264.com';
|
||||
const currentUrl = new URL(`list/${id}`, rootUrl).href;
|
||||
|
|
@ -17,7 +17,7 @@ module.exports = async (ctx) => {
|
|||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const $ = cheerio.load(iconv.decode(response, 'gbk'));
|
||||
const $ = load(iconv.decode(response, 'gbk'));
|
||||
|
||||
$('div.newslist_info').remove();
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ module.exports = async (ctx) => {
|
|||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const content = cheerio.load(iconv.decode(detailResponse, 'gbk'));
|
||||
const content = load(iconv.decode(detailResponse, 'gbk'));
|
||||
|
||||
content('a.syq, a.xlsj, a.titleoverflow200, #fjump').remove();
|
||||
content('i.pstatus').remove();
|
||||
|
|
@ -78,7 +78,7 @@ module.exports = async (ctx) => {
|
|||
const description = $('meta[name="description"]').prop('content').trim();
|
||||
const icon = new URL('favicon', rootUrl).href;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
item: items,
|
||||
title: `${$('span.country, h2').text()} - ${description.split(',').pop()}`,
|
||||
link: currentUrl,
|
||||
|
|
@ -88,5 +88,5 @@ module.exports = async (ctx) => {
|
|||
logo: icon,
|
||||
subtitle: $('meta[name="keywords"]').prop('content').trim(),
|
||||
author: $('meta[name="author"]').prop('content'),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const Cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import { load } from 'cheerio';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
async function loadArticle(link) {
|
||||
const resp = await got(link);
|
||||
const article = Cheerio.load(resp.body);
|
||||
const article = load(resp.body);
|
||||
const entryChildren = article('div.entry-content').children();
|
||||
const imgs = entryChildren
|
||||
.find('noscript')
|
||||
|
|
@ -13,7 +13,7 @@ async function loadArticle(link) {
|
|||
const txt = entryChildren
|
||||
.slice(2)
|
||||
.toArray()
|
||||
.map((e) => Cheerio.load(e).html());
|
||||
.map((e) => load(e).html());
|
||||
return {
|
||||
title: article('.entry-title').text(),
|
||||
description: [...imgs, ...txt].join(''),
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
const got = require('@/utils/got');
|
||||
const Cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const { SUB_NAME_PREFIX, SUB_URL } = require('./const');
|
||||
const loadArticle = require('./article');
|
||||
module.exports = async (ctx) => {
|
||||
const limit = Number.parseInt(ctx.query.limit);
|
||||
const limit = Number.parseInt(ctx.req.query('limit'));
|
||||
const { cat = '8kasianidol' } = ctx.params;
|
||||
const url = `${SUB_URL}category/${cat}/`;
|
||||
const resp = await got(url);
|
||||
const $ = Cheerio.load(resp.body);
|
||||
const $ = load(resp.body);
|
||||
const itemRaw = $('li.item').toArray();
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${SUB_NAME_PREFIX}-${$('span[property=name]:not(.hide)').text()}`,
|
||||
link: url,
|
||||
item: await Promise.all(
|
||||
(limit ? itemRaw.slice(0, limit) : itemRaw).map((e) => {
|
||||
const { href } = Cheerio.load(e)('h2 > a')[0].attribs;
|
||||
const { href } = load(e)('h2 > a')[0].attribs;
|
||||
return ctx.cache.tryGet(href, () => loadArticle(href));
|
||||
})
|
||||
),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
const got = require('@/utils/got');
|
||||
const Cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const { SUB_NAME_PREFIX, SUB_URL } = require('./const');
|
||||
const loadArticle = require('./article');
|
||||
const url = SUB_URL;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const limit = Number.parseInt(ctx.query.limit);
|
||||
const limit = Number.parseInt(ctx.req.query('limit'));
|
||||
const response = await got(url);
|
||||
const itemRaw = Cheerio.load(response.body)('ul.post-loop li.item').toArray();
|
||||
ctx.state.data = {
|
||||
const itemRaw = load(response.body)('ul.post-loop li.item').toArray();
|
||||
ctx.set('data', {
|
||||
title: `${SUB_NAME_PREFIX}-最新`,
|
||||
link: url,
|
||||
item:
|
||||
response.body &&
|
||||
(await Promise.all(
|
||||
(limit ? itemRaw.slice(0, limit) : itemRaw).map((e) => {
|
||||
const { href } = Cheerio.load(e)('h2 > a')[0].attribs;
|
||||
const { href } = load(e)('h2 > a')[0].attribs;
|
||||
return ctx.cache.tryGet(href, () => loadArticle(href));
|
||||
})
|
||||
)),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
const got = require('@/utils/got');
|
||||
const Cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const { SUB_NAME_PREFIX, SUB_URL } = require('./const');
|
||||
const loadArticle = require('./article');
|
||||
module.exports = async (ctx) => {
|
||||
const limit = Number.parseInt(ctx.query.limit);
|
||||
const limit = Number.parseInt(ctx.req.query('limit'));
|
||||
const { tag } = ctx.params;
|
||||
const url = `${SUB_URL}tag/${tag}/`;
|
||||
const resp = await got(url);
|
||||
const $ = Cheerio.load(resp.body);
|
||||
const $ = load(resp.body);
|
||||
const itemRaw = $('li.item').toArray();
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${SUB_NAME_PREFIX}-${$('span[property=name]:not(.hide)').text()}`,
|
||||
link: url,
|
||||
item: await Promise.all(
|
||||
(limit ? itemRaw.slice(0, limit) : itemRaw).map((e) => {
|
||||
const { href } = Cheerio.load(e)('h2 > a')[0].attribs;
|
||||
const { href } = load(e)('h2 > a')[0].attribs;
|
||||
return ctx.cache.tryGet(href, () => loadArticle(href));
|
||||
})
|
||||
),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const path = ctx.path === '/' ? '/realtime' : ctx.path;
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('div[data-column="Two-Third"] .article-title .article-link')
|
||||
.toArray()
|
||||
|
|
@ -34,7 +34,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.description = content('.text-long').html();
|
||||
item.title = content('meta[name="cXenseParse:mdc-title"]').attr('content');
|
||||
|
|
@ -49,9 +49,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
const { domainValidation } = require('./utils');
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ module.exports = async (ctx) => {
|
|||
const { domain = '91porn.com' } = ctx.query;
|
||||
const { uid, lang = 'en_US' } = ctx.params;
|
||||
const siteUrl = `https://${domain}/uvideos.php?UID=${uid}&type=public`;
|
||||
domainValidation(domain, ctx);
|
||||
domainValidation(domain);
|
||||
|
||||
const response = await got.post(siteUrl, {
|
||||
form: {
|
||||
|
|
@ -20,7 +20,7 @@ module.exports = async (ctx) => {
|
|||
},
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('.row .well')
|
||||
.toArray()
|
||||
|
|
@ -37,7 +37,7 @@ module.exports = async (ctx) => {
|
|||
items.map((item) =>
|
||||
ctx.cache.tryGet(`91porn:${lang}:${new URL(item.link).searchParams.get('viewkey')}`, async () => {
|
||||
const { data } = await got(item.link);
|
||||
const $ = cheerio.load(data);
|
||||
const $ = load(data);
|
||||
|
||||
item.pubDate = parseDate($('.title-yakov').eq(0).text(), 'YYYY-MM-DD');
|
||||
item.description = art(path.join(__dirname, 'templates/index.art'), {
|
||||
|
|
@ -52,9 +52,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${$('.login_register_header').text()} - 91porn`,
|
||||
link: siteUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
const { domainValidation } = require('./utils');
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ module.exports = async (ctx) => {
|
|||
const { domain = '91porn.com' } = ctx.query;
|
||||
const siteUrl = `https://${domain}/index.php`;
|
||||
const { lang = 'en_US' } = ctx.params;
|
||||
domainValidation(domain, ctx);
|
||||
domainValidation(domain);
|
||||
|
||||
const response = await got.post(siteUrl, {
|
||||
form: {
|
||||
|
|
@ -20,7 +20,7 @@ module.exports = async (ctx) => {
|
|||
},
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('.row .well')
|
||||
.toArray()
|
||||
|
|
@ -37,7 +37,7 @@ module.exports = async (ctx) => {
|
|||
items.map((item) =>
|
||||
ctx.cache.tryGet(`91porn:${lang}:${new URL(item.link).searchParams.get('viewkey')}`, async () => {
|
||||
const { data } = await got(item.link);
|
||||
const $ = cheerio.load(data);
|
||||
const $ = load(data);
|
||||
|
||||
item.pubDate = parseDate($('.title-yakov').eq(0).text(), 'YYYY-MM-DD');
|
||||
item.description = art(path.join(__dirname, 'templates/index.art'), {
|
||||
|
|
@ -52,9 +52,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${$('.login_register_header').text()} - 91porn`,
|
||||
link: siteUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const config = require('@/config').value;
|
||||
import { config } from '@/config';
|
||||
const allowDomain = new Set(['91porn.com', 'www.91porn.com', '0122.91p30.com', 'www.91zuixindizhi.com', 'w1218.91p46.com']);
|
||||
|
||||
const domainValidation = (domain, ctx) => {
|
||||
const domainValidation = (domain) => {
|
||||
if (!config.feature.allow_user_supply_unsafe_domain && !allowDomain.has(domain)) {
|
||||
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
||||
throw new Error(`This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module.exports = async (ctx) => {
|
|||
11: '美女壁纸',
|
||||
};
|
||||
|
||||
const category = ctx.params.category;
|
||||
const category = ctx.req.param('category');
|
||||
|
||||
const currentUrl = `${rootUrl}/category-${category}/list-1/index.html?page=1`;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const { rootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const tab = ctx.params.tab ?? '最新';
|
||||
const tab = ctx.req.param('tab') ?? '最新';
|
||||
|
||||
const currentUrl = `${rootUrl}/home-ajax/index.html?tabcid=${tab}&page=1`;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const { rootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const tag = ctx.params.tag;
|
||||
const tag = ctx.req.param('tag');
|
||||
|
||||
const currentUrl = `${rootUrl}/tag-${tag}/page-1/index.html`;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
const rootUrl = 'https://www.95mm.vip';
|
||||
|
|
@ -16,7 +16,7 @@ module.exports = {
|
|||
},
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('div.list-body')
|
||||
.toArray()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const got = require('@/utils/got');
|
||||
import got from '@/utils/got';
|
||||
const parser = require('@/utils/rss-parser');
|
||||
const utils = require('./utils');
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ module.exports = async (ctx) => {
|
|||
link,
|
||||
description;
|
||||
|
||||
switch (ctx.params.subsite) {
|
||||
switch (ctx.req.param('subsite')) {
|
||||
case 'mac':
|
||||
link = 'https://9to5mac.com';
|
||||
title += 'Mac';
|
||||
|
|
@ -30,9 +30,9 @@ module.exports = async (ctx) => {
|
|||
break;
|
||||
}
|
||||
|
||||
if (ctx.params.tag) {
|
||||
link = `${link}/guides/${ctx.params.tag}/feed/`;
|
||||
title = `${ctx.params.tag} | ${title}`;
|
||||
if (ctx.req.param('tag')) {
|
||||
link = `${link}/guides/${ctx.req.param('tag')}/feed/`;
|
||||
title = `${ctx.req.param('tag')} | ${title}`;
|
||||
} else {
|
||||
link = `${link}/feed/`;
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ module.exports = async (ctx) => {
|
|||
const feed = await parser.parseURL(link);
|
||||
|
||||
const items = await Promise.all(
|
||||
feed.items.splice(0, ctx.query.limit ? Number.parseInt(ctx.query.limit) : 10).map((item) =>
|
||||
feed.items.splice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10).map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
@ -61,10 +61,10 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title,
|
||||
link,
|
||||
description,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const cheerio = require('cheerio');
|
||||
import { load } from 'cheerio';
|
||||
|
||||
const ProcessFeed = (data) => {
|
||||
const $ = cheerio.load(data);
|
||||
const $ = load(data);
|
||||
const content = $('div.post-content');
|
||||
|
||||
const cover = $('meta[property="og:image"]');
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category ?? 'topics';
|
||||
const id = ctx.params.id ?? '';
|
||||
const category = ctx.req.param('category') ?? 'topics';
|
||||
const id = ctx.req.param('id') ?? '';
|
||||
|
||||
const rootUrl = 'https://aamacau.com';
|
||||
const currentUrl = `${rootUrl}/${category === 'topics' ? 'topics/breakingnews' : `topics/${category}${id ? `/${id}` : ''}`}`;
|
||||
|
|
@ -14,7 +14,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
const list = $('post-title a')
|
||||
.map((_, item) => {
|
||||
|
|
@ -35,7 +35,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
content('.cat, .author, .date').remove();
|
||||
|
||||
|
|
@ -48,9 +48,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { category = 'news/justin' } = ctx.params;
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit, 10) : 30;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
|
||||
|
||||
const rootUrl = 'https://www.abc.net.au';
|
||||
const apiUrl = new URL('news-web/api/loader/channelrefetch', rootUrl).href;
|
||||
|
|
@ -26,7 +26,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const { data: currentResponse } = await got(currentUrl);
|
||||
|
||||
const $ = cheerio.load(currentResponse);
|
||||
const $ = load(currentResponse);
|
||||
|
||||
documentId = documentId ?? $('div[data-uri^="coremedia://collection/"]').first().prop('data-uri').split(/\//).pop();
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ module.exports = async (ctx) => {
|
|||
try {
|
||||
const { data: detailResponse } = await got(item.link);
|
||||
|
||||
const content = cheerio.load(detailResponse);
|
||||
const content = load(detailResponse);
|
||||
|
||||
content('aside, header, [data-print="inline-media"], [data-component="EmbedBlock"]').remove();
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const icon = new URL($('link[rel="apple-touch-icon"]').prop('href'), rootUrl).href;
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
item: items,
|
||||
title: $('title').first().text(),
|
||||
link: currentUrl,
|
||||
|
|
@ -157,5 +157,5 @@ module.exports = async (ctx) => {
|
|||
subtitle: $('meta[property="og:title"]').prop('content'),
|
||||
author: $('meta[name="generator"]').prop('content'),
|
||||
allowEmpty: true,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const rootUrl = 'https://www.abmedia.io';
|
||||
const cateAPIUrl = `${rootUrl}/wp-json/wp/v2/categories`;
|
||||
|
|
@ -8,8 +8,8 @@ const postsAPIUrl = `${rootUrl}/wp-json/wp/v2/posts`;
|
|||
const getCategoryId = (category) => got.get(`${cateAPIUrl}?slug=${category}`).then((res) => res.data[0].id);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category ?? 'technology-development';
|
||||
const limit = ctx.params.limit ?? 25;
|
||||
const category = ctx.req.param('category') ?? 'technology-development';
|
||||
const limit = ctx.req.param('limit') ?? 25;
|
||||
const categoryId = await getCategoryId(category);
|
||||
|
||||
const response = await got.get(`${postsAPIUrl}?categories=${categoryId}&page=1&per_page=${limit}`);
|
||||
|
|
@ -22,9 +22,9 @@ module.exports = async (ctx) => {
|
|||
pubDate: parseDate(item.date),
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `abmedia - ${category}`,
|
||||
link: `${rootUrl}/category/${category}`,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const rootUrl = 'https://www.abmedia.io';
|
||||
const postsAPIUrl = `${rootUrl}/wp-json/wp/v2/posts`;
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const limit = ctx.params.limit ?? 10;
|
||||
const limit = ctx.req.param('limit') ?? 10;
|
||||
const url = `${postsAPIUrl}?per_page=${limit}`;
|
||||
|
||||
const response = await got.get(url);
|
||||
|
|
@ -18,9 +18,9 @@ module.exports = async (ctx) => {
|
|||
pubDate: parseDate(item.date),
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: 'ABMedia - 最新消息',
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://www.ahhhhfs.com/wp-json/wp/v2/posts',
|
||||
searchParams: {
|
||||
per_page: ctx.query.limit ? Number.parseInt(ctx.query.limit) : 10,
|
||||
per_page: ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10,
|
||||
_embed: '',
|
||||
},
|
||||
});
|
||||
|
|
@ -24,7 +24,7 @@ module.exports = async (ctx) => {
|
|||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({ method: 'get', url: item.link });
|
||||
const $detail = cheerio.load(detailResponse.data);
|
||||
const $detail = load(detailResponse.data);
|
||||
$detail('article.post-content').find('.lwptoc').remove();
|
||||
$detail('article.post-content').find('#related_posts').remove();
|
||||
$detail('article.post-content').find('.entry-copyright').remove();
|
||||
|
|
@ -37,11 +37,11 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: 'ahhhhfs-A姐分享',
|
||||
link: 'https://www.ahhhhfs.com',
|
||||
description:
|
||||
'A姐分享,分享各种网络云盘资源、BT种子、高清电影电视剧和羊毛福利,收集各种有趣实用的软件和APP的下载、安装、使用方法,发现一些稀奇古怪的的网站,折腾一些有趣实用的教程,关注谷歌苹果等互联网最新的资讯动态,探索新领域,发现新美好,分享小快乐。',
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://nsfw.abskoop.com/wp-json/wp/v2/posts',
|
||||
searchParams: {
|
||||
per_page: ctx.query.limit ? Number.parseInt(ctx.query.limit) : 10,
|
||||
per_page: ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10,
|
||||
_embed: '',
|
||||
},
|
||||
});
|
||||
|
|
@ -21,11 +21,11 @@ module.exports = async (ctx) => {
|
|||
category: [...new Set(item._embedded['wp:term'].flatMap((i) => i.map((j) => j.name)))],
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: 'ahhhhfs-A姐分享NSFW',
|
||||
link: 'https://nsfw.ahhhhfs.com/articles-archive',
|
||||
description:
|
||||
'A姐分享NSFW,分享各种网络云盘资源、BT种子、磁力链接、高清电影电视剧和羊毛福利,收集各种有趣实用的软件和APP的下载、安装、使用方法,发现一些稀奇古怪的的网站,折腾一些有趣实用的教程,关注谷歌苹果等互联网最新的资讯动态,探索新领域,发现新美好,分享小快乐。',
|
||||
item: list,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const baseUrl = 'https://www.acfun.cn';
|
||||
const categoryMap = {
|
||||
|
|
@ -76,7 +76,7 @@ module.exports = async (ctx) => {
|
|||
referer: url,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const articleInfo = $('.main script')
|
||||
.text()
|
||||
.match(/window.articleInfo = (.*);\n\s*window.likeDomain/)[1];
|
||||
|
|
@ -92,9 +92,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: categoryMap[categoryId].title,
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
const bangumiData = JSON.parse(bangumiPage.data.match(/window.bangumiData = (.*?);\n/)[1]);
|
||||
const bangumiList = JSON.parse(bangumiPage.data.match(/window.bangumiList = (.*?);\n/)[1]);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: bangumiData.bangumiTitle,
|
||||
link: url,
|
||||
description: bangumiData.bangumiIntro,
|
||||
|
|
@ -24,5 +24,5 @@ module.exports = async (ctx) => {
|
|||
link: `http://www.acfun.cn/bangumi/aa${id}_36188_${item.itemId}`,
|
||||
pubDate: parseDate(item.updateTime, 'x'),
|
||||
})),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const uid = ctx.req.param('uid');
|
||||
const url = `https://www.acfun.cn/u/${uid}`;
|
||||
const host = 'https://www.acfun.cn';
|
||||
const response = await got(url, {
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
});
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const $ = load(data);
|
||||
const title = $('title').text();
|
||||
const description = $('.signature .complete').text();
|
||||
const list = $('#ac-space-video-list a').get();
|
||||
|
|
@ -21,7 +21,7 @@ module.exports = async (ctx) => {
|
|||
.text()
|
||||
.match(/.user-photo{\n\s*background:url\((.*)\) 0% 0% \/ 100% no-repeat;/)[1];
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title,
|
||||
link: url,
|
||||
description,
|
||||
|
|
@ -41,5 +41,5 @@ module.exports = async (ctx) => {
|
|||
pubDate: parseDate(itemDate, 'YYYY/MM/DD'),
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const host = 'http://acg17.com';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got(`${host}/wp-json/wp/v2/posts?per_page=30`);
|
||||
const list = response.data;
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `ACG17 - 全部文章`,
|
||||
link: `${host}/blog`,
|
||||
description: 'ACG17 - 全部文章',
|
||||
|
|
@ -16,5 +16,5 @@ module.exports = async (ctx) => {
|
|||
pubDate: parseDate(item.date_gmt),
|
||||
description: item.content.rendered,
|
||||
})),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id = '1', name = '重要通知' } = ctx.params;
|
||||
const limit = ctx.query.limit ? Number.parseInt(ctx.query.limit, 10) : 30;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
|
||||
|
||||
const rootUrl = 'http://www.acpaa.cn';
|
||||
const currentUrl = new URL(`article/taglist.jhtml?tagIds=${id}&tagname=${name}`, rootUrl).href;
|
||||
|
||||
const { data: response } = await got(currentUrl);
|
||||
|
||||
const $ = cheerio.load(response);
|
||||
const $ = load(response);
|
||||
|
||||
let items = $('div.text01 ul li a[title]')
|
||||
.slice(0, limit)
|
||||
|
|
@ -32,7 +32,7 @@ module.exports = async (ctx) => {
|
|||
ctx.cache.tryGet(item.link, async () => {
|
||||
const { data: detailResponse } = await got(item.link);
|
||||
|
||||
const content = cheerio.load(detailResponse);
|
||||
const content = load(detailResponse);
|
||||
|
||||
item.title = content('div.xhjj_head01').text();
|
||||
item.description = content('div.text01').html();
|
||||
|
|
@ -45,7 +45,7 @@ module.exports = async (ctx) => {
|
|||
const author = $('title').text().replaceAll('-', '');
|
||||
const subtitle = $('span.myTitle').text().trim();
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
item: items,
|
||||
title: `${author} - ${subtitle}`,
|
||||
link: currentUrl,
|
||||
|
|
@ -53,5 +53,5 @@ module.exports = async (ctx) => {
|
|||
language: 'zh',
|
||||
subtitle,
|
||||
author,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,18 +1,19 @@
|
|||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
const config = require('@/config').value;
|
||||
import { config } from '@/config';
|
||||
import puppeteer from '@/utils/puppeteer';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id ?? '';
|
||||
const id = ctx.req.param('id') ?? '';
|
||||
|
||||
const rootUrl = 'https://pubs.acs.org';
|
||||
const currentUrl = `${rootUrl}/toc/${id}/0/0`;
|
||||
|
||||
let title = '';
|
||||
|
||||
const browser = await require('@/utils/puppeteer')();
|
||||
const browser = await puppeteer();
|
||||
const items = await ctx.cache.tryGet(
|
||||
currentUrl,
|
||||
async () => {
|
||||
|
|
@ -29,7 +30,7 @@ module.exports = async (ctx) => {
|
|||
const html = await page.evaluate(() => document.documentElement.innerHTML);
|
||||
await page.close();
|
||||
|
||||
const $ = cheerio.load(html);
|
||||
const $ = load(html);
|
||||
|
||||
title = $('meta[property="og:title"]').attr('content');
|
||||
|
||||
|
|
@ -65,9 +66,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
await browser.close();
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let id = ctx.params.id;
|
||||
let id = ctx.req.param('id');
|
||||
|
||||
const rootUrl = 'https://www.aeaweb.org';
|
||||
const currentUrl = `${rootUrl}/journals/${id}`;
|
||||
|
|
@ -15,7 +15,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
let $ = cheerio.load(response.data);
|
||||
let $ = load(response.data);
|
||||
|
||||
$('.read-more').remove();
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ module.exports = async (ctx) => {
|
|||
url: searchUrl,
|
||||
});
|
||||
|
||||
$ = cheerio.load(response.data);
|
||||
$ = load(response.data);
|
||||
|
||||
let items = $('h4.title a')
|
||||
.toArray()
|
||||
|
|
@ -50,7 +50,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.doi = content('meta[name="citation_doi"]').attr('content');
|
||||
|
||||
|
|
@ -72,10 +72,10 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title,
|
||||
description,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
import { load } from 'cheerio';
|
||||
import got from '@/utils/got';
|
||||
const { getData } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `https://aeon.co/${ctx.params.category}`;
|
||||
const url = `https://aeon.co/${ctx.req.param('category')}`;
|
||||
const { data: response } = await got(url);
|
||||
const $ = cheerio.load(response);
|
||||
const $ = load(response);
|
||||
|
||||
const data = JSON.parse($('script#__NEXT_DATA__').text());
|
||||
|
||||
|
|
@ -18,10 +18,10 @@ module.exports = async (ctx) => {
|
|||
|
||||
const items = await getData(ctx, list);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `AEON | ${data.props.pageProps.section.title}`,
|
||||
link: url,
|
||||
description: data.props.pageProps.section.metaDescription,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
import { load } from 'cheerio';
|
||||
import got from '@/utils/got';
|
||||
const { getData } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type;
|
||||
const type = ctx.req.param('type');
|
||||
const binaryType = type === 'videos' ? 'videos' : 'essays';
|
||||
const capitalizedType = type.charAt(0).toUpperCase() + type.slice(1);
|
||||
|
||||
const url = `https://aeon.co/${type}`;
|
||||
const { data: response } = await got(url);
|
||||
const $ = cheerio.load(response);
|
||||
const $ = load(response);
|
||||
|
||||
const data = JSON.parse($('script#__NEXT_DATA__').text());
|
||||
|
||||
|
|
@ -21,9 +21,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
const items = await getData(ctx, list);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `AEON | ${capitalizedType}`,
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue