refactor(router/sexinsex): simple sexinsex url (#1836)

This commit is contained in:
cnzgray
2019-03-27 17:31:33 +08:00
committed by DIYgod
parent 95aad8f5ce
commit 6cf68e6044
+5 -5
View File
@@ -15,7 +15,7 @@ const axios_ins = axios.create({
const sourceTimezoneOffset = -8;
module.exports = async (ctx) => {
const typefilter = ctx.params.type ? `&filter=type&typeid=${ctx.params.type}` : '';
const location = `${section}${ctx.params.id}${typefilter}&orderby=dateline&ascdesc=DESC`;
const location = `${section}${ctx.params.id}${typefilter}`;
let title = '';
let out = [];
@@ -51,11 +51,11 @@ module.exports = async (ctx) => {
const result = await Promise.all(
list.map(async (item) => {
const $ = cheerio.load(item);
const guid = $('span').attr('id'); // thread_7836473
let title = $('span a');
const catalog = $('em').text();
const path = title.attr('href');
const catalog = $('em').text(); // http://sexinsex.net/bbs/thread-7988706-1-1.html
title = title.text();
const link = url.resolve(base, `/bbs/${path}`);
const link = url.resolve(base, `/bbs/${guid.replace('_', '-')}-1-1.html`);
// Check cache
const cache = await ctx.cache.get(link);
@@ -66,7 +66,7 @@ module.exports = async (ctx) => {
const single = {
title: `${catalog} ${title}`,
link: link,
guid: path,
guid: guid,
};
try {