feat: v3 migration - 3/n
This commit is contained in:
parent
185b5d1441
commit
fdf3fcac57
|
|
@ -10,5 +10,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const currentUrl = `${rootUrl}/albums${category === 'all' ? '' : `/${category}`}${keyword ? `?screen=${keyword}` : '?'}${time === 'a' ? '' : `&t=${time}`}${order === 'mr' ? '' : `&o=${order}`}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(ctx, currentUrl, rootUrl);
|
||||
ctx.set('data', await ProcessItems(ctx, currentUrl, rootUrl));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const currentUrl = `${rootUrl}/search/${option}${category === 'all' ? '' : `/${category}`}${keyword ? `?search_query=${keyword}` : '?'}${time === 'a' ? '' : `&t=${time}`}${order === 'mr' ? '' : `&o=${order}`}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(ctx, currentUrl, rootUrl);
|
||||
ctx.set('data', await ProcessItems(ctx, currentUrl, rootUrl));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const currentUrl = new URL(`class/${category}.html`, rootUrl).href;
|
||||
|
||||
ctx.state.data = await fetchItems(limit, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await fetchItems(limit, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const currentUrl = new URL(`top/${category.split(/_/)[0]}_1.html`, rootUrl).href;
|
||||
|
||||
ctx.state.data = await fetchItems(limit, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await fetchItems(limit, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const currentUrl = `${rootUrl}/category-${category}/list-1/index.html?page=1`;
|
||||
|
||||
ctx.state.data = await ProcessItems(ctx, categories[category], currentUrl);
|
||||
ctx.set('data', await ProcessItems(ctx, categories[category], currentUrl));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const currentUrl = `${rootUrl}/home-ajax/index.html?tabcid=${tab}&page=1`;
|
||||
|
||||
ctx.state.data = await ProcessItems(ctx, tab, currentUrl);
|
||||
ctx.set('data', await ProcessItems(ctx, tab, currentUrl));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const currentUrl = `${rootUrl}/tag-${tag}/page-1/index.html`;
|
||||
|
||||
ctx.state.data = await ProcessItems(ctx, tag, currentUrl);
|
||||
ctx.set('data', await ProcessItems(ctx, tag, currentUrl));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,5 +24,5 @@ module.exports = async (ctx) => {
|
|||
default:
|
||||
throw new Error(`暂不支持对${type}的订阅`);
|
||||
}
|
||||
ctx.state.data = response;
|
||||
ctx.set('data', response);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ module.exports = async (ctx) => {
|
|||
});
|
||||
|
||||
if (!channelInfo) {
|
||||
ctx.state.data = notFoundData;
|
||||
ctx.set('data', notFoundData);
|
||||
return;
|
||||
}
|
||||
const [userName, face] = await cache.getUsernameAndFaceFromUID(ctx, uid);
|
||||
|
|
@ -42,7 +42,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const data = response.data.data;
|
||||
if (!data.archives) {
|
||||
ctx.state.data = notFoundData;
|
||||
ctx.set('data', notFoundData);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const data = response.data.data;
|
||||
if (!data.archives) {
|
||||
ctx.state.data = notFoundData;
|
||||
ctx.set('data', notFoundData);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ module.exports = async (ctx) => {
|
|||
responseData = await getNews(category, ctx);
|
||||
}
|
||||
|
||||
ctx.state.data = responseData;
|
||||
ctx.set('data', responseData);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const currentUrl = `onlyfans/user/${id}`;
|
||||
|
||||
ctx.state.data = await fetchItems(ctx, currentUrl);
|
||||
ctx.set('data', await fetchItems(ctx, currentUrl));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ const fetchItems = require('./utils');
|
|||
module.exports = async (ctx) => {
|
||||
const currentUrl = 'posts';
|
||||
|
||||
ctx.state.data = await fetchItems(ctx, currentUrl);
|
||||
ctx.set('data', await fetchItems(ctx, currentUrl));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
ctx.state.data = await utils.parseFeed({ subjectid: ctx.req.param('id') }, ctx);
|
||||
ctx.set('data', await utils.parseFeed({ subjectid: ctx.req.param('id') }, ctx));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
ctx.state.data = await utils.parseFeed({ subjectid: 70 }, ctx);
|
||||
ctx.set('data', await utils.parseFeed({ subjectid: 70 }, ctx));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,5 +21,5 @@ module.exports = async (ctx) => {
|
|||
...e,
|
||||
}));
|
||||
|
||||
ctx.state.data = { item: feed.items, ...feed };
|
||||
ctx.set('data', { item: feed.items, ...feed });
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const { ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
ctx.state.data = await ProcessItems(ctx);
|
||||
ctx.set('data', await ProcessItems(ctx));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ module.exports = async (ctx) => {
|
|||
const slcProvince = $(`select#searchprovince option:contains('${province}')`);
|
||||
|
||||
if (!slcProvince.length) {
|
||||
ctx.state.data = result;
|
||||
ctx.set('data', result);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ module.exports = async (ctx) => {
|
|||
const slcOffice = $(`select#searchoffice option:contains('${office}')`);
|
||||
|
||||
if (!slcOffice.length) {
|
||||
ctx.state.data = result;
|
||||
ctx.set('data', result);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -88,5 +88,5 @@ module.exports = async (ctx) => {
|
|||
};
|
||||
});
|
||||
|
||||
ctx.state.data = result;
|
||||
ctx.set('data', result);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -70,5 +70,5 @@ module.exports = async (ctx) => {
|
|||
};
|
||||
}
|
||||
|
||||
ctx.state.data = data;
|
||||
ctx.set('data', data);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const title = `Dribbble - keyword ${keyword}`;
|
||||
|
||||
ctx.state.data = await utils.getData(ctx, url, title);
|
||||
ctx.set('data', await utils.getData(ctx, url, title));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const title = 'Dribbble - Popular Shots';
|
||||
|
||||
ctx.state.data = await utils.getData(ctx, url, title);
|
||||
ctx.set('data', await utils.getData(ctx, url, title));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const title = `Dribbble - user ${name}`;
|
||||
|
||||
ctx.state.data = await utils.getData(ctx, url, title);
|
||||
ctx.set('data', await utils.getData(ctx, url, title));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ module.exports = async (ctx) => {
|
|||
const { site = 'beijing' } = ctx.params;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 3;
|
||||
|
||||
ctx.state.data = await processZxfkItems(site, 'ywzx', limit);
|
||||
ctx.set('data', await processZxfkItems(site, 'ywzx', limit));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ module.exports = async (ctx) => {
|
|||
const { site = 'beijing' } = ctx.params;
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 5;
|
||||
|
||||
ctx.state.data = await processZxfkItems(site, 'tsjy', limit);
|
||||
ctx.set('data', await processZxfkItems(site, 'tsjy', limit));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ module.exports = async (ctx) => {
|
|||
const title = `Grub Street`;
|
||||
const description = `New York Magazine's Food and Restaurant Blog`;
|
||||
|
||||
ctx.state.data = await utils.getData(ctx, url, title, description);
|
||||
ctx.set('data', await utils.getData(ctx, url, title, description));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
const { ProcessFeed } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => (ctx.state.data = await ProcessFeed('all', 0, ctx.req.param('order')));
|
||||
module.exports = async (ctx) => ctx.set('data', await ProcessFeed('all', 0, ctx.req.param('order')));
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
const { ProcessFeed } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => (ctx.state.data = await ProcessFeed('character', ctx.req.param('id'), ctx.req.param('order')));
|
||||
module.exports = async (ctx) => ctx.set('data', await ProcessFeed('character', ctx.req.param('id'), ctx.req.param('order')));
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
const { ProcessFeed } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => (ctx.state.data = await ProcessFeed('work', ctx.req.param('id'), ctx.req.param('order')));
|
||||
module.exports = async (ctx) => ctx.set('data', await ProcessFeed('work', ctx.req.param('id'), ctx.req.param('order')));
|
||||
|
|
|
|||
|
|
@ -50,5 +50,5 @@ module.exports = async (ctx) => {
|
|||
);
|
||||
browser.close();
|
||||
|
||||
ctx.state.data = data;
|
||||
ctx.set('data', data);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const title = `JavDB${filters[filter] === '' ? '' : ` - ${filters[filter]}`} `;
|
||||
|
||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||
ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,5 +28,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const title = `${categories[category]} - JavDB - ${filters[filter] === '' ? '|' : `${filters[filter]} | `}${sorts[sort]}`;
|
||||
|
||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||
ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,5 +24,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const title = `JavDB${filters[filter] === '' ? '' : ` - ${filters[filter]}`} ${sortOptions[sort]}`;
|
||||
|
||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||
ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const title = `JavDB${filters[filter] === '' ? '' : ` - ${filters[filter]}`} `;
|
||||
|
||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||
ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const title = 'JavDB';
|
||||
|
||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||
ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,5 +29,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const title = `關鍵字 ${keyword} ${filters[filter] === '' ? '' : `+ ${filters[filter]}`} ${sorts[sort]} 搜索結果 - JavDB`;
|
||||
|
||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||
ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const title = `JavDB${filters[filter] === '' ? '' : ` - ${filter[filter]}`} `;
|
||||
|
||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||
ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const title = `JavDB${query === '' ? '' : ` - ${query}`} `;
|
||||
|
||||
ctx.state.data = await utils.ProcessItems(ctx, currentUrl, title);
|
||||
ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ module.exports = async (ctx) => {
|
|||
const language = ctx.req.param('language') ?? defaultLanguage;
|
||||
const currentUrl = `${rootUrl}/${language}/vl_bestrated.php?list&mode=${mode}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(language, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await ProcessItems(language, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ module.exports = async (ctx) => {
|
|||
const language = ctx.req.param('language') ?? defaultLanguage;
|
||||
const currentUrl = `${rootUrl}/${language}/tl_bestreviews.php?list&mode=${mode}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(language, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await ProcessItems(language, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ module.exports = async (ctx) => {
|
|||
const language = ctx.req.param('language') ?? defaultLanguage;
|
||||
const currentUrl = `${rootUrl}/${language}/vl_genre.php?list&g=${genre}&mode=${mode}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(language, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await ProcessItems(language, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ module.exports = async (ctx) => {
|
|||
const language = ctx.req.param('language') ?? defaultLanguage;
|
||||
const currentUrl = `${rootUrl}/${language}/vl_maker.php?list&m=${maker}&mode=${mode}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(language, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await ProcessItems(language, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ module.exports = async (ctx) => {
|
|||
const language = ctx.req.param('language') ?? defaultLanguage;
|
||||
const currentUrl = `${rootUrl}/${language}/vl_mostwanted.php?list&mode=${mode}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(language, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await ProcessItems(language, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ module.exports = async (ctx) => {
|
|||
const language = ctx.req.param('language') ?? defaultLanguage;
|
||||
const currentUrl = `${rootUrl}/${language}/vl_newentries.php?list`;
|
||||
|
||||
ctx.state.data = await ProcessItems(language, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await ProcessItems(language, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ module.exports = async (ctx) => {
|
|||
const language = ctx.req.param('language') ?? defaultLanguage;
|
||||
const currentUrl = `${rootUrl}/${language}/vl_newrelease.php?list&mode=${mode}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(language, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await ProcessItems(language, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ module.exports = async (ctx) => {
|
|||
const language = ctx.req.param('language') ?? defaultLanguage;
|
||||
const currentUrl = `${rootUrl}/${language}/vl_star.php?list&s=${id}&mode=${mode}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(language, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await ProcessItems(language, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ module.exports = async (ctx) => {
|
|||
const language = ctx.req.param('language') ?? defaultLanguage;
|
||||
const currentUrl = `${rootUrl}/${language}/vl_update.php?list`;
|
||||
|
||||
ctx.state.data = await ProcessItems(language, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await ProcessItems(language, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ module.exports = async (ctx) => {
|
|||
const language = ctx.req.param('language') ?? defaultLanguage;
|
||||
const currentUrl = `${rootUrl}/${language}/${type}.php?list&u=${id}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(language, currentUrl, ctx.cache.tryGet);
|
||||
ctx.set('data', await ProcessItems(language, currentUrl, ctx.cache.tryGet));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -46,5 +46,5 @@ module.exports = async (ctx) => {
|
|||
link,
|
||||
item: items,
|
||||
};
|
||||
ctx.state.data = data;
|
||||
ctx.set('data', data);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -77,5 +77,5 @@ module.exports = async (ctx) => {
|
|||
link: url,
|
||||
item: items,
|
||||
};
|
||||
ctx.state.data = data;
|
||||
ctx.set('data', data);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,5 +42,5 @@ module.exports = async (ctx) => {
|
|||
item: items,
|
||||
};
|
||||
|
||||
ctx.state.data = data;
|
||||
ctx.set('data', data);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -37,5 +37,5 @@ module.exports = async (ctx) => {
|
|||
link,
|
||||
item: items,
|
||||
};
|
||||
ctx.state.data = data;
|
||||
ctx.set('data', data);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,5 +28,5 @@ module.exports = async (ctx) => {
|
|||
link,
|
||||
item: items,
|
||||
};
|
||||
ctx.state.data = data;
|
||||
ctx.set('data', data);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -157,5 +157,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
result.item = actListFull;
|
||||
|
||||
ctx.state.data = result;
|
||||
ctx.set('data', result);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -230,5 +230,5 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = feed;
|
||||
ctx.set('data', feed);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ module.exports = async (ctx) => {
|
|||
|
||||
const currentUrl = `${rootUrl}/Rank/comicRank/type/${type}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(ctx, currentUrl, time, titles[type]);
|
||||
ctx.set('data', await ProcessItems(ctx, currentUrl, time, titles[type]));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ module.exports = async (ctx) => {
|
|||
const category = ctx.req.param('category');
|
||||
const currentUrl = `/cat/${category}`;
|
||||
|
||||
ctx.state.data = await fetchFeed(ctx, currentUrl);
|
||||
ctx.set('data', await fetchFeed(ctx, currentUrl));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ const fetchFeed = require('./utils');
|
|||
module.exports = async (ctx) => {
|
||||
const currentUrl = '';
|
||||
|
||||
ctx.state.data = await fetchFeed(ctx, currentUrl);
|
||||
ctx.set('data', await fetchFeed(ctx, currentUrl));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ module.exports = async (ctx) => {
|
|||
const keyword = ctx.req.param('keyword');
|
||||
const currentUrl = `/?s=${keyword}`;
|
||||
|
||||
ctx.state.data = await fetchFeed(ctx, currentUrl);
|
||||
ctx.set('data', await fetchFeed(ctx, currentUrl));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ module.exports = async (ctx) => {
|
|||
const id = ctx.req.param('id');
|
||||
const currentUrl = `/i/${id}`;
|
||||
|
||||
ctx.state.data = await fetchFeed(ctx, currentUrl);
|
||||
ctx.set('data', await fetchFeed(ctx, currentUrl));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
||||
function load_detail(list, cache) {
|
||||
return Promise.all(
|
||||
list.map((item) => {
|
||||
const notice_item = cheerio.load(item);
|
||||
const notice_item = load(item);
|
||||
const href = notice_item('a').attr('href');
|
||||
const url = 'http://www.shmeea.edu.cn' + href;
|
||||
if (href[0] !== '/') {
|
||||
|
|
@ -25,7 +25,7 @@ function load_detail(list, cache) {
|
|||
Host: 'www.shmeea.edu.cn',
|
||||
},
|
||||
});
|
||||
const detail = cheerio.load(detail_response.data);
|
||||
const detail = load(detail_response.data);
|
||||
return {
|
||||
title: notice_item('a').attr('title'),
|
||||
description: detail('.Article_content').html(),
|
||||
|
|
@ -48,14 +48,14 @@ module.exports = async (ctx) => {
|
|||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const $ = load(data);
|
||||
const list = $('#main > div.container > div > div.span9 > div.page-he > div > ul > li').get();
|
||||
|
||||
const detail = await load_detail(list, ctx.cache);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '上海自学考试 - 通知公告',
|
||||
link: 'http://www.shmeea.edu.cn/page/04000/index.html',
|
||||
item: detail,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 host = 'https://jwc.shmtu.edu.cn';
|
||||
|
||||
async function load(link) {
|
||||
async function loadContent(link) {
|
||||
const response = await got(link, { https: { rejectUnauthorized: false } });
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
return $('.wp_articlecontent').html();
|
||||
}
|
||||
|
|
@ -15,14 +15,14 @@ const ProcessFeed = (list, caches) =>
|
|||
Promise.all(
|
||||
list.map((item) =>
|
||||
caches.tryGet(item.link, async () => {
|
||||
item.description = await load(item.link);
|
||||
item.description = await loadContent(item.link);
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type;
|
||||
const type = ctx.req.param('type');
|
||||
const info = type === 'jwgg' ? '教务公告' : '教务新闻';
|
||||
|
||||
const response = await got(`${host}/${type}/list.htm`, {
|
||||
|
|
@ -32,7 +32,7 @@ module.exports = async (ctx) => {
|
|||
https: { rejectUnauthorized: false },
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const list = $('tbody tr')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
|
|
@ -48,10 +48,10 @@ module.exports = async (ctx) => {
|
|||
|
||||
const result = await ProcessFeed(list, ctx.cache);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `上海海事大学 ${info}`,
|
||||
link: `${host}/${type}`,
|
||||
description: '上海海事大学 教务信息',
|
||||
item: result,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
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 path = require('path');
|
||||
const { art } = require('@/utils/render');
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
const bootstrapHost = 'https://weixin.shmtu.edu.cn/dynamic/shmtuHttps';
|
||||
const host = 'https://portal.shmtu.edu.cn/api';
|
||||
|
|
@ -38,7 +38,7 @@ const processFeed = (list, caches) =>
|
|||
);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type;
|
||||
const type = ctx.req.param('type');
|
||||
let info;
|
||||
switch (type) {
|
||||
case 'bmtzgg':
|
||||
|
|
@ -63,7 +63,7 @@ module.exports = async (ctx) => {
|
|||
});
|
||||
|
||||
const list = JSON.parse(response.data).map((item) => ({
|
||||
title: cheerio.load(item.title).text(),
|
||||
title: load(item.title).text(),
|
||||
link: `${host}/node/${item.nid}.json`,
|
||||
pubDate: timezone(parseDate(item.created), 8),
|
||||
category: item.field_department[0],
|
||||
|
|
@ -72,10 +72,10 @@ module.exports = async (ctx) => {
|
|||
|
||||
const result = await processFeed(list, ctx.cache);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `上海海事大学 ${info}`,
|
||||
link: 'https://portal.shmtu.edu.cn/bumentongzhigonggao',
|
||||
description: '上海海事大学 数字平台',
|
||||
item: result,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
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 host = 'https://www.shmtu.edu.cn';
|
||||
|
||||
async function load(link) {
|
||||
async function loadContent(link) {
|
||||
const response = await got.get(link, { https: { rejectUnauthorized: false } });
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
return $('article').html();
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ const ProcessFeed = (list, caches) =>
|
|||
Promise.all(
|
||||
list.map((item) =>
|
||||
caches.tryGet(item.link, async () => {
|
||||
item.description = await load(item.link);
|
||||
item.description = await loadContent(item.link);
|
||||
|
||||
return item;
|
||||
})
|
||||
|
|
@ -22,7 +22,7 @@ const ProcessFeed = (list, caches) =>
|
|||
);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type;
|
||||
const type = ctx.req.param('type');
|
||||
const info = type === 'notes' ? '通知公告' : '学术讲座';
|
||||
|
||||
const response = await got(`${host}/${type}`, {
|
||||
|
|
@ -32,7 +32,7 @@ module.exports = async (ctx) => {
|
|||
https: { rejectUnauthorized: false },
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const list = $('tbody tr')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
|
|
@ -49,10 +49,10 @@ module.exports = async (ctx) => {
|
|||
|
||||
const result = await ProcessFeed(list, ctx.cache);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `上海海事大学 ${info}`,
|
||||
link: `${host}/${type}`,
|
||||
description: '上海海事大学 官网信息',
|
||||
item: result,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = 'https://www.shoac.com.cn';
|
||||
|
|
@ -64,9 +64,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '演出月历 - 上海东方艺术中心管理有限公司',
|
||||
link: baseUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const store = ctx.params.store;
|
||||
const store = ctx.req.param('store');
|
||||
|
||||
const rootUrl = 'https://www.shopback.com.tw';
|
||||
const currentUrl = `${rootUrl}/${store}`;
|
||||
|
|
@ -12,7 +12,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
$('table').remove();
|
||||
|
||||
|
|
@ -29,9 +29,9 @@ module.exports = async (ctx) => {
|
|||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${$('h1').text()} - ShopBack`,
|
||||
link: currentUrl,
|
||||
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';
|
||||
const asyncPool = require('tiny-async-pool');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
// sn_f parameter is required to prevent redirection
|
||||
const currentUrl = 'https://www.shoppingdesign.com.tw/post?sn_f=1';
|
||||
const response = await got(currentUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const items = [];
|
||||
// maximum parallel requests on the target website are limited to 11.
|
||||
for await (const data of asyncPool(10, $('article-item'), (item) => {
|
||||
|
|
@ -15,7 +15,7 @@ module.exports = async (ctx) => {
|
|||
const link = item.attr('url');
|
||||
return ctx.cache.tryGet(link, async () => {
|
||||
const response = await got(`${link}?sn_f=1`);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const article = $('.left article .htmlview');
|
||||
article.find('d-image').each(function () {
|
||||
$(this).replaceWith(`<img src="${$(this).attr('lg')}">`);
|
||||
|
|
@ -34,10 +34,10 @@ module.exports = async (ctx) => {
|
|||
items.push(data);
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('meta[property="og:title"]').attr('content'),
|
||||
link: currentUrl,
|
||||
description: $('meta[property="og:description"]').attr('content'),
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ const { TITLE, HOST } = require('./const');
|
|||
const { fetchPerformerInfo } = require('./service');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const id = ctx.req.param('id');
|
||||
const artist = await fetchPerformerInfo({
|
||||
performerId: id,
|
||||
});
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${TITLE} - ${artist.name}`,
|
||||
description: artist.content,
|
||||
link: `${HOST}/artist/${artist.id}`,
|
||||
item: artist.activityList,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ const { TITLE, HOST } = require('./const');
|
|||
const { fetchBrandInfo } = require('./service');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const id = ctx.req.param('id');
|
||||
const brand = await fetchBrandInfo({
|
||||
brandId: id,
|
||||
});
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${TITLE} - ${brand.name}`,
|
||||
description: brand.content,
|
||||
link: `${HOST}/host/${brand.id}`,
|
||||
item: brand.activityList,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@ const { TITLE, HOST } = require('./const');
|
|||
const { fetchActivityList, fetchDictionary } = require('./service');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const cityCode = Number.parseInt(ctx.params.cityCode);
|
||||
const showStyle = Number.parseInt(ctx.params.showStyle);
|
||||
const cityCode = Number.parseInt(ctx.req.param('cityCode'));
|
||||
const showStyle = Number.parseInt(ctx.req.param('showStyle'));
|
||||
const items = await fetchActivityList({
|
||||
cityCode,
|
||||
showStyle,
|
||||
});
|
||||
const { cityName, showName } = await fetchDictionary(cityCode, showStyle);
|
||||
const tags = [cityName, showName].filter(Boolean).join(' - ');
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${TITLE} - ${tags}`,
|
||||
link: HOST,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ const { TITLE, HOST } = require('./const');
|
|||
const { fetchActivityList, fetchPerformerList, fetchBrandList, fetchCityList, fetchStyleList } = require('./service');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type || '';
|
||||
const keyword = ctx.params.keyword || '';
|
||||
const type = ctx.req.param('type') || '';
|
||||
const keyword = ctx.req.param('keyword') || '';
|
||||
|
||||
switch (type) {
|
||||
case 'event':
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const got = require('@/utils/got');
|
||||
const md5 = require('@/utils/md5');
|
||||
import got from '@/utils/got';
|
||||
import md5 from '@/utils/md5';
|
||||
|
||||
const uuid = (length = 20) => {
|
||||
const e = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' + Date.now();
|
||||
|
|
|
|||
|
|
@ -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 host = 'https://www.shu.edu.cn/';
|
||||
const alias = new Map([
|
||||
|
|
@ -12,10 +12,10 @@ const alias = new Map([
|
|||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type || 'news';
|
||||
const type = ctx.req.param('type') || 'news';
|
||||
const link = `https://www.shu.edu.cn/${alias.get(type) || type}.htm`;
|
||||
const respond = await got.get(link);
|
||||
const $ = cheerio.load(respond.data);
|
||||
const $ = load(respond.data);
|
||||
const title = $('title').text();
|
||||
const list = $('.ej_main .list')
|
||||
.find('li')
|
||||
|
|
@ -31,7 +31,7 @@ module.exports = async (ctx) => {
|
|||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const response = await got.get(item.link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
item.author = $('.xx>:nth-child(2)').text().trim().slice(3); // 投稿:xxx
|
||||
item.pubDate = parseDate(item.date, 'YYYY.MM.DD');
|
||||
item.description = $('.v_news_content').html() || item.title;
|
||||
|
|
@ -40,9 +40,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title,
|
||||
link,
|
||||
item: all,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 host = 'https://jwb.shu.edu.cn/';
|
||||
const alias = new Map([
|
||||
|
|
@ -10,10 +10,10 @@ const alias = new Map([
|
|||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type || 'notice';
|
||||
const type = ctx.req.param('type') || 'notice';
|
||||
const link = `https://jwb.shu.edu.cn/index/${alias.get(type) || type}.htm`;
|
||||
const respond = await got.get(link);
|
||||
const $ = cheerio.load(respond.data);
|
||||
const $ = load(respond.data);
|
||||
const title = $('title').text();
|
||||
const list = $('.only-list')
|
||||
.find('li')
|
||||
|
|
@ -29,7 +29,7 @@ module.exports = async (ctx) => {
|
|||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const response = await got.get(item.link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
item.author = $('[id$=_lblUser]').text().trim();
|
||||
item.pubDate = parseDate(item.date, 'YYYY年MM月DD日');
|
||||
item.description = $('.v_news_content').html() || item.title;
|
||||
|
|
@ -37,9 +37,9 @@ module.exports = async (ctx) => {
|
|||
})
|
||||
)
|
||||
);
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title,
|
||||
link,
|
||||
item: 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) => {
|
||||
|
|
@ -11,7 +11,7 @@ module.exports = async (ctx) => {
|
|||
const listUrl = `${apiRootUrl}/v1_2/homePage`;
|
||||
const filmUrl = `${apiRootUrl}/v1_2/filmInfo`;
|
||||
|
||||
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 response = await got({
|
||||
method: 'post',
|
||||
|
|
@ -43,7 +43,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
content('iframe').remove();
|
||||
|
||||
let videos;
|
||||
|
|
@ -78,9 +78,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '水果派',
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
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 category = ctx.params.category ?? 'tzgg';
|
||||
const category = ctx.req.param('category') ?? 'tzgg';
|
||||
|
||||
const rootUrl = 'https://dky.sicau.edu.cn';
|
||||
const currentUrl = `${rootUrl}/${category}.htm`;
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
const list = $('a.tit')
|
||||
.slice(0, 10)
|
||||
|
|
@ -35,7 +35,7 @@ module.exports = async (ctx) => {
|
|||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.description = content('.v_news_content').html();
|
||||
|
||||
|
|
@ -44,9 +44,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
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 category = ctx.params.category ?? 'xwgg';
|
||||
const category = ctx.req.param('category') ?? 'xwgg';
|
||||
|
||||
const rootUrl = 'https://yan.sicau.edu.cn';
|
||||
const currentUrl = `${rootUrl}/index/${category}.htm`;
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
const list = $('.list-4 a[title]')
|
||||
.slice(0, 10)
|
||||
|
|
@ -34,7 +34,7 @@ module.exports = async (ctx) => {
|
|||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.description = content('.v_news_content').html();
|
||||
item.pubDate = timezone(parseDate(detailResponse.data.match(/发布时间: (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/)[1], 'YYYY-MM-DD HH:mm:ss'), +8);
|
||||
|
|
@ -44,9 +44,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 category = ctx.params.category ?? 'bkszs';
|
||||
const category = ctx.req.param('category') ?? 'bkszs';
|
||||
|
||||
const rootUrl = 'https://dky.sicau.edu.cn';
|
||||
const currentUrl = `${rootUrl}/zsjy/${category}.htm`;
|
||||
|
|
@ -12,7 +12,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
const list = $('a.tit')
|
||||
.map((_, item) => {
|
||||
|
|
@ -34,7 +34,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
content('.v_news_content p').slice(0, 2).remove();
|
||||
|
||||
|
|
@ -45,9 +45,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');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const url = 'https://www.sigsac.org/';
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
// https://www.sigsac.org/ccs/CCS2022/program/accepted-papers.html
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -10,14 +10,14 @@ module.exports = async (ctx) => {
|
|||
const yearResponses = await got.all(yearList.map((url) => got(url)));
|
||||
|
||||
const urlList = yearResponses.map((response) => {
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
return new URL($('a:contains("Accepted Papers")').attr('href'), response.url).href;
|
||||
});
|
||||
|
||||
const responses = await got.all(urlList.map((url) => got(url)));
|
||||
|
||||
const items = responses.map((response) => {
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const link = response.url;
|
||||
const paperSection = $('div.papers-item')
|
||||
.toArray()
|
||||
|
|
@ -47,11 +47,11 @@ module.exports = async (ctx) => {
|
|||
return paperSection.length ? paperSection : paperTable;
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: 'ACM CCS',
|
||||
link: url,
|
||||
description: 'The ACM Conference on Computer and Communications Security (CCS) Accepted Papers',
|
||||
allowEmpty: true,
|
||||
item: items.flat(),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const timezone = require('@/utils/timezone');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
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';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { category } = ctx.params;
|
||||
const rootUrl = 'https://blog.simpleinfo.cc';
|
||||
const link = `${rootUrl}${category ? (category === 'work' || category === 'talk' ? `/blog/${category}` : `/shasha77?category=${category}`) : '/shasha77'}`;
|
||||
const response = await got(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const title = `${$('.-active').text()} - 簡訊設計`;
|
||||
$('.-ad').remove();
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ module.exports = async (ctx) => {
|
|||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const result = await got(item.link);
|
||||
const content = cheerio.load(result.data);
|
||||
const content = load(result.data);
|
||||
item.author = content('meta[property="article:author"]').attr('content');
|
||||
item.pubDate = timezone(parseDate(content('meta[property="article:published_time"]').attr('content')), +8);
|
||||
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
||||
|
|
@ -41,10 +41,10 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title,
|
||||
link,
|
||||
language: 'zh-tw',
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
const out = await Promise.all(list.map((item) => parseArticle(item, ctx.cache.tryGet)));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '新浪专栏-创事记',
|
||||
link: 'https://tech.sina.com.cn/chuangshiji',
|
||||
item: out,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const map = new Map([
|
|||
]);
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type;
|
||||
const type = ctx.req.param('type');
|
||||
const lid = map.get(type).id;
|
||||
const title = map.get(type).title;
|
||||
const pageid = '207';
|
||||
|
|
@ -24,9 +24,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
const out = await Promise.all(list.map((item) => parseArticle(item, ctx.cache.tryGet)));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${title}-新浪科技科学探索`,
|
||||
link,
|
||||
item: out,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
const out = await Promise.all(list.map((item) => parseArticle(item, ctx.cache.tryGet)));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `新浪财经-${map[lid]}`,
|
||||
link: 'http://finance.sina.com.cn/china/',
|
||||
item: out,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 { parseArticle } = require('../../utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -29,9 +29,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
const items = await Promise.all(list.map((item) => parseArticle(item, ctx.cache.tryGet)));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '美股|美股行情|美股新闻 - 新浪财经',
|
||||
link: 'https://finance.sina.com.cn/stock/usstock/',
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
const out = await Promise.all(list.map((item) => parseArticle(item, ctx.cache.tryGet)));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `新浪${map[lid]}滚动新闻`,
|
||||
link: `https://news.sina.com.cn/roll/#pageid=${pageid}&lid=${lid}&k=&num=${limit}&page=1`,
|
||||
item: out,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const { parseArticle } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -21,7 +21,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const list = $(query)
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
|
|
@ -34,10 +34,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: `${$('title').text().split('_')[0]} - 新浪体育`,
|
||||
description: $('meta[name="description"]').attr('content'),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { art } = require('@/utils/render');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { art } from '@/utils/render';
|
||||
const path = require('path');
|
||||
|
||||
const getRollNewsList = (pageid, lid, limit) =>
|
||||
|
|
@ -34,7 +34,7 @@ const parseRollNewsList = (data) =>
|
|||
const parseArticle = (item, tryGet) =>
|
||||
tryGet(item.link, async () => {
|
||||
const detailResponse = await got(item.link);
|
||||
const $ = cheerio.load(detailResponse.data);
|
||||
const $ = load(detailResponse.data);
|
||||
$('#left_hzh_ad, .appendQr_wrap, .app-kaihu-qr, .tech-quotation').remove();
|
||||
|
||||
const metaPublishTime = $('meta[property="article:published_time"]');
|
||||
|
|
|
|||
|
|
@ -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 = $('.title .internalLink')
|
||||
.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);
|
||||
|
|
@ -39,7 +39,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
content('.ads-frame, .read-more-msg').remove();
|
||||
|
||||
|
|
@ -60,9 +60,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 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 baseUrl = 'https://www.sis001.com';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -10,7 +10,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const response = await got(url);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('form table')
|
||||
.last()
|
||||
|
|
@ -31,7 +31,7 @@ module.exports = async (ctx) => {
|
|||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const response = await got(item.link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
item.category = $('.posttags a')
|
||||
.toArray()
|
||||
|
|
@ -53,10 +53,10 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('head title').text(),
|
||||
description: $('meta[name=description]').attr('content'),
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 { fetchArticle } = require('@/utils/wechat-mp');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type;
|
||||
const num = ctx.params.num ?? '';
|
||||
const type = ctx.req.param('type');
|
||||
const num = ctx.req.param('num') ?? '';
|
||||
|
||||
const rootUrl = 'https://www.gs.sjtu.edu.cn';
|
||||
const currentUrl = `${rootUrl}/announcement/${type}/${num}`;
|
||||
|
|
@ -15,7 +15,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
const list = $('a.announcement-item')
|
||||
.map((_, item) => {
|
||||
|
|
@ -42,7 +42,7 @@ module.exports = async (ctx) => {
|
|||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
item.description = content('.page-content').html();
|
||||
}
|
||||
|
|
@ -52,9 +52,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${num === '' ? '' : `${$('.category-nav-block .active').text().trim()} - `}${$('div.inner-banner-text .title').text().trim()} - ${$('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');
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const urlRoot = 'https://jwc.sjtu.edu.cn/xwtg';
|
||||
|
||||
async function getFullArticle(link) {
|
||||
const response = await got(link);
|
||||
const $ = cheerio.load(response.body);
|
||||
const $ = load(response.body);
|
||||
const content = $('.content-con');
|
||||
if (content.length === 0) {
|
||||
return null;
|
||||
|
|
@ -26,7 +26,7 @@ async function getFullArticle(link) {
|
|||
}
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type ?? 'notice';
|
||||
const type = ctx.req.param('type') ?? 'notice';
|
||||
const config = {
|
||||
all: {
|
||||
section: '通知通告',
|
||||
|
|
@ -81,7 +81,7 @@ module.exports = async (ctx) => {
|
|||
url: sectionLink,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.body);
|
||||
const $ = load(response.body);
|
||||
|
||||
const out = await Promise.all(
|
||||
$('body > div.list-box > div.container > div > div.ny_right > div > div.ny_right_con > div > ul')
|
||||
|
|
@ -108,9 +108,9 @@ module.exports = async (ctx) => {
|
|||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '上海交通大学教务处 ' + config[type].section,
|
||||
link: sectionLink,
|
||||
item: out,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module.exports = workerFactory(
|
|||
},
|
||||
};
|
||||
|
||||
const type = ctx.params.type;
|
||||
const type = ctx.req.param('type');
|
||||
|
||||
return {
|
||||
title: '上海交通大学电子信息与电气工程学院学生办 -- ' + config[type].title,
|
||||
|
|
|
|||
|
|
@ -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 host = 'https://bjwb.seiee.sjtu.edu.cn';
|
||||
|
||||
|
|
@ -11,14 +11,14 @@ module.exports = function (meta, extract) {
|
|||
const link = new URL(local, host).href;
|
||||
const response = await got(link);
|
||||
|
||||
const list = extract(cheerio.load(response.data));
|
||||
const list = extract(load(response.data));
|
||||
|
||||
const out = await Promise.all(
|
||||
list.map((item) => {
|
||||
const itemUrl = new URL(item.link, host).href;
|
||||
return ctx.cache.tryGet(itemUrl, async () => {
|
||||
const response = await got(itemUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
return {
|
||||
title: item.title,
|
||||
|
|
@ -31,10 +31,10 @@ module.exports = function (meta, extract) {
|
|||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title,
|
||||
link,
|
||||
item: out,
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ module.exports = workerFactory(
|
|||
},
|
||||
};
|
||||
|
||||
const type = ctx.params.type || 'all';
|
||||
const type = ctx.req.param('type') || 'all';
|
||||
|
||||
return {
|
||||
title: '上海交通大学电子信息与电气工程学院学生办 -- ' + config[type].title,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
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 urlRoot = 'https://tongqu.sjtu.edu.cn';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type || 'all';
|
||||
const type = ctx.req.param('type') || 'all';
|
||||
const config = {
|
||||
all: 0,
|
||||
newest: -1,
|
||||
|
|
@ -36,9 +36,9 @@ module.exports = async (ctx) => {
|
|||
description: art(path.join(__dirname, '../templates/activity.art'), { e }),
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: '同去网活动',
|
||||
link,
|
||||
item: feeds,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
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 baseTitle = '上海交通大学研究生招生网招考信息';
|
||||
const baseUrl = 'https://yzb.sjtu.edu.cn/index/zkxx/';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const pageUrl = `${baseUrl}${ctx.params.type}.htm`;
|
||||
const pageUrl = `${baseUrl}${ctx.req.param('type')}.htm`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
@ -16,9 +16,9 @@ module.exports = async (ctx) => {
|
|||
},
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
link: pageUrl,
|
||||
title: `${baseTitle} -- ${$('title').text().split('-')[0]}`,
|
||||
item: $('li[id^="line"] a')
|
||||
|
|
@ -28,5 +28,5 @@ module.exports = async (ctx) => {
|
|||
title: elem.attribs.title,
|
||||
pubDate: parseDate($(elem.next).text().trim()),
|
||||
})),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 team = ctx.params.team;
|
||||
const team = ctx.req.param('team');
|
||||
|
||||
const rootUrl = 'https://www.skysports.com';
|
||||
const currentUrl = `${rootUrl}/${team}-news`;
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
|
||||
let items = $('.news-list__headline-link')
|
||||
.toArray()
|
||||
|
|
@ -34,7 +34,7 @@ module.exports = async (ctx) => {
|
|||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
const content = load(detailResponse.data);
|
||||
|
||||
content('.roadblock').remove();
|
||||
content('.sdc-article-widget, .sdc-site-layout-sticky-region').remove();
|
||||
|
|
@ -47,9 +47,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const baseUrl = 'https://www.slowmist.com';
|
||||
const { finishArticleItem } = require('@/utils/wechat-mp');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let type = ctx.params.type;
|
||||
let type = ctx.req.param('type');
|
||||
|
||||
let title = '慢雾科技 - ';
|
||||
switch (type) {
|
||||
|
|
@ -41,9 +41,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
items = await Promise.all(items.map((item) => finishArticleItem(item)));
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title,
|
||||
link: url,
|
||||
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 { category } = ctx.params;
|
||||
const baseUrl = 'https://www.smashingmagazine.com';
|
||||
const route = category ? `/category/${category}` : '/articles';
|
||||
const { data: response } = await got(`${baseUrl}${route}`);
|
||||
const $ = cheerio.load(response);
|
||||
const $ = load(response);
|
||||
|
||||
const listItems = $('article.article--post')
|
||||
.toArray()
|
||||
|
|
@ -31,7 +31,7 @@ module.exports = async (ctx) => {
|
|||
listItems.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const { data: response } = await got(item.link);
|
||||
const $ = cheerio.load(response);
|
||||
const $ = load(response);
|
||||
item.category = $('li.meta-box--tags a')
|
||||
.toArray()
|
||||
.map((item) => $(item).text());
|
||||
|
|
@ -51,7 +51,7 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: 'Smashing Magazine Articles',
|
||||
link: `${baseUrl}${route}`,
|
||||
item: items,
|
||||
|
|
@ -59,5 +59,5 @@ module.exports = async (ctx) => {
|
|||
logo: 'https://www.smashingmagazine.com/images/favicon/apple-touch-icon.png',
|
||||
icon: 'https://www.smashingmagazine.com/images/favicon/favicon.svg',
|
||||
language: 'en-us',
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
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 link = `https://zhiyou.smzdm.com/member/${ctx.params.uid}/article/`;
|
||||
const link = `https://zhiyou.smzdm.com/member/${ctx.req.param('uid')}/article/`;
|
||||
|
||||
const response = await got(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const title = $('.info-stuff-nickname').text();
|
||||
|
||||
const list = $('.pandect-content-stuff')
|
||||
|
|
@ -25,7 +25,7 @@ module.exports = async (ctx) => {
|
|||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const response = await got(item.link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
item.description = $('.m-contant article').html();
|
||||
item.pubDate = timezone(parseDate($('meta[property="og:release_date"]').attr('content'), 'YYYY-MM-DD HH:mm:ss'), 8);
|
||||
item.author = $('meta[property="og:author"]').attr('content');
|
||||
|
|
@ -35,9 +35,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${title}-什么值得买`,
|
||||
link,
|
||||
item: out,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
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 link = `https://zhiyou.smzdm.com/member/${ctx.params.uid}/baoliao/`;
|
||||
const link = `https://zhiyou.smzdm.com/member/${ctx.req.param('uid')}/baoliao/`;
|
||||
|
||||
const response = await got(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
const title = $('.info-stuff-nickname').text();
|
||||
|
||||
const list = $('.pandect-content-stuff')
|
||||
|
|
@ -25,7 +25,7 @@ module.exports = async (ctx) => {
|
|||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const response = await got(item.link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const $ = load(response.data);
|
||||
item.description = $('article.txt-detail').html();
|
||||
item.pubDate = timezone(parseDate($('.time').first().text().trim().replace('更新时间:', '')), 8);
|
||||
item.author = title;
|
||||
|
|
@ -35,9 +35,9 @@ module.exports = async (ctx) => {
|
|||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
ctx.set('data', {
|
||||
title: `${title}的爆料 - 什么值得买`,
|
||||
link,
|
||||
item: out,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue