refactor: rename axios to got
This commit is contained in:
parent
c4bf4fcdb4
commit
a56c0b5a39
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ module.exports = async (ctx) => {
|
|||
link = `https://www.12306.cn/mormhweb/1/${id}/index_fl.html`;
|
||||
}
|
||||
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const name = $('div.nav_center > a:nth-child(4)').text();
|
||||
|
|
@ -46,7 +46,7 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios.get(itemUrl);
|
||||
const response = await got.get(itemUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
let description = $('.article-box').html();
|
||||
if (description) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
||||
const { posts } = (await axios.get(`https://instant.1point3acres.com/v2/api/user/post?pg=1&ps=10&user_id=${id}`)).data;
|
||||
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 = {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
||||
const { threads } = (await axios.get(`https://instant.1point3acres.com/v2/api/user/thread?pg=1&ps=10&user_id=${id}`)).data;
|
||||
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 = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const date = require('@/utils/date');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
|
|
@ -6,7 +6,7 @@ module.exports = async (ctx) => {
|
|||
const channel = ctx.params.name;
|
||||
const pageUrl = `https://m.21jingji.com/channel/${channel}`;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: pageUrl,
|
||||
});
|
||||
|
|
@ -25,7 +25,7 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { keyword = '' } = ctx.params;
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://36kr.com/pp/api/search/entity-search?page=1&per_page=20&sort=date&entity_type=post&keyword=${encodeURIComponent(keyword)}`,
|
||||
});
|
||||
|
||||
const load = async (link) => {
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
const description = response.data.data.content;
|
||||
return { description };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -6,7 +6,7 @@ module.exports = async (ctx) => {
|
|||
const type = ctx.params.type;
|
||||
const url = `http://www.3dmgame.com/games/${name}/${type}`;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: url,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const sourceTimezoneOffset = -8;
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'http://www.3dmgame.com/news/';
|
||||
const res = await axios({
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: url,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
|
||||
|
|
@ -6,7 +6,7 @@ const host = 'https://99percentinvisible.org/';
|
|||
|
||||
module.exports = async (ctx) => {
|
||||
const link = url.resolve(host, 'archives/');
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios.get(itemUrl);
|
||||
const response = await got.get(itemUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const single = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const parser = require('@/utils/rss-parser');
|
||||
const utils = require('./utils');
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const items = await Promise.all(
|
||||
feed.items.splice(0, 10).map(async (item) => {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'http://www.a9vg.com/list/news',
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const url = `http://www.acfun.cn/bangumi/aa${id}`;
|
||||
|
||||
const bangumiPage = await axios({
|
||||
const bangumiPage = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
headers: {
|
||||
|
|
@ -14,7 +14,7 @@ module.exports = async (ctx) => {
|
|||
const albumInfo = JSON.parse(bangumiPage.data.match(/<script>var albumInfo = (.*)<\/script>/)[1]) || {};
|
||||
const api = `http://www.acfun.cn/album/abm/bangumis/video?albumId=${id}&num=1&size=${albumInfo.contentsCount || 9999}`;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: api,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const host = `http://www.aisixiang.com/data/search.php?lanmu=${id}`;
|
||||
|
||||
const response = await axios.get(host, {
|
||||
const response = await got.get(host, {
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const host = `http://www.aisixiang.com/toplist/index.php?id=${type}&period=${range}`;
|
||||
|
||||
const response = await axios.get(host, {
|
||||
const response = await got.get(host, {
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const date = require('@/utils/date');
|
||||
|
||||
const ProcessFeed = async (link) => {
|
||||
|
|
@ -9,13 +9,13 @@ const ProcessFeed = async (link) => {
|
|||
.pop()
|
||||
.split('.')[0];
|
||||
|
||||
let response = await axios.get(`http://www.aisixiang.com/data/view_json.php?id=${id}`, {
|
||||
let response = await got.get(`http://www.aisixiang.com/data/view_json.php?id=${id}`, {
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
const description = JSON.parse(iconv.decode(response.data, 'gbk')).content;
|
||||
link = `http://www.aisixiang.com${link}`;
|
||||
response = await axios.get(link, {
|
||||
response = await got.get(link, {
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const getCacheParsed = async (ctx, key) => {
|
||||
|
|
@ -46,7 +46,7 @@ const makeFull = async (ctx, infos) => {
|
|||
info = item;
|
||||
}
|
||||
// 抓取详细信息
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: info.link,
|
||||
});
|
||||
|
|
@ -68,7 +68,7 @@ const makeFull = async (ctx, infos) => {
|
|||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'http://algocasts.io/episodes',
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ module.exports = async (ctx) => {
|
|||
const link = `https://allpoetry.com/poems/about/spotlight-oldpoem?order=${order}}`;
|
||||
const host = 'https://allpoetry.com/';
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { anime } = await axios.get(`https://api.gamer.com.tw/mobile_app/anime/v1/video.php?sn=0&anime_sn=${ctx.params.sn}`).then((r) => r.data);
|
||||
const { anime } = await got.get(`https://api.gamer.com.tw/mobile_app/anime/v1/video.php?sn=0&anime_sn=${ctx.params.sn}`).then((r) => r.data);
|
||||
ctx.state.data = {
|
||||
title: anime.title,
|
||||
link: `https://ani.gamer.com.tw/animeRef.php?sn=${anime.anime_sn}`,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { new_anime } = await axios.get('https://api.gamer.com.tw/mobile_app/anime/v1/index.php').then((r) => r.data);
|
||||
const { new_anime } = await got.get('https://api.gamer.com.tw/mobile_app/anime/v1/index.php').then((r) => r.data);
|
||||
ctx.state.data = {
|
||||
title: '動畫瘋最後更新',
|
||||
link: 'https://ani.gamer.com.tw/',
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { time, name } = ctx.params;
|
||||
const $ = await axios.get(`https://anime1.me/category/${encodeURIComponent(time)}/${encodeURIComponent(name)}`).then((r) => cheerio.load(r.data));
|
||||
const $ = await got.get(`https://anime1.me/category/${encodeURIComponent(time)}/${encodeURIComponent(name)}`).then((r) => cheerio.load(r.data));
|
||||
const title = $('.page-title')
|
||||
.text()
|
||||
.trim();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { keyword } = ctx.params;
|
||||
const $ = await axios.get(`https://anime1.me/?s=${encodeURIComponent(keyword)}`).then((r) => cheerio.load(r.data));
|
||||
const $ = await got.get(`https://anime1.me/?s=${encodeURIComponent(keyword)}`).then((r) => cheerio.load(r.data));
|
||||
const title = $('.page-title')
|
||||
.text()
|
||||
.trim();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
const news_api_origin = 'https://www.animen.com.tw/animen_web/api/getNews?page=1&perPage=10';
|
||||
const link_origin = 'https://www.animen.com.tw/animen_web/web/news_index?';
|
||||
|
|
@ -36,7 +36,7 @@ module.exports = async (ctx) => {
|
|||
link = link_origin + '&news_category_id=' + map.get(type).id;
|
||||
}
|
||||
|
||||
const response = await axios.get(news_api);
|
||||
const response = await got.get(news_api);
|
||||
const newsList = response.data.news.NewsList;
|
||||
|
||||
const out = await Promise.all(
|
||||
|
|
@ -47,7 +47,7 @@ module.exports = async (ctx) => {
|
|||
const itemLink = `https://www.animen.com.tw/animen_web/web/news_inside?news_id=${news_id}`;
|
||||
|
||||
const news_detail_api = `https://www.animen.com.tw/animen_web/api/getNewsDetail?news_id=${news_id}`;
|
||||
const response = await axios.get(news_detail_api);
|
||||
const response = await got.get(news_detail_api);
|
||||
const details = response.data.news_content.slice(1);
|
||||
|
||||
const descriptions = details.map(function(detail) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = 'http://www.anitama.cn';
|
||||
const url = 'http://www.anitama.cn/channel/' + (ctx.params.channel ? ctx.params.channel : '');
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: url,
|
||||
});
|
||||
|
|
@ -30,7 +30,7 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const content = $('#area-content-article');
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
// params:
|
||||
// count? : count of new-books
|
||||
|
||||
const axios = require('@/utils/axios'); // get web content
|
||||
const got = require('@/utils/got'); // get web content
|
||||
const cheerio = require('cheerio'); // html parser
|
||||
const he = require('he');
|
||||
|
||||
const base_url = 'https://www.aozora.gr.jp/index_pages/';
|
||||
module.exports = async (ctx) => {
|
||||
// get the update list
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: base_url + 'whatsnew1.html',
|
||||
});
|
||||
|
|
@ -40,7 +40,7 @@ module.exports = async (ctx) => {
|
|||
}
|
||||
|
||||
// get book-cards
|
||||
const responses = await Promise.all(detail_urls.map((url) => axios(url)));
|
||||
const responses = await Promise.all(detail_urls.map((url) => got(url)));
|
||||
const cards = responses.map(({ data }) => data);
|
||||
|
||||
// get real data to feed
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { DateTime } = require('luxon');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { region, pkg } = ctx.params;
|
||||
const prefix = region === 'en' ? 'https://apkpure.com' : `https://apkpure.com/${region}`;
|
||||
let $ = await axios.get(`${prefix}/search?q=${pkg}`).then((r) => cheerio.load(r.data));
|
||||
let $ = await got.get(`${prefix}/search?q=${pkg}`).then((r) => cheerio.load(r.data));
|
||||
const apppage = $('.search-title:nth-child(1)>a').attr('href');
|
||||
const link = `https://apkpure.com${apppage}/versions`;
|
||||
|
||||
$ = await axios.get(link).then((r) => cheerio.load(r.data));
|
||||
$ = await got.get(link).then((r) => cheerio.load(r.data));
|
||||
const img = new URL($('.ver-top img').attr('src'));
|
||||
img.searchParams.delete('w'); // get full resolution icon
|
||||
ctx.state.data = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
ctx.params.country === 'us' ? (link = url.resolve(host, '/support/exchange_repair/')) : (link = url.resolve(host, `${ctx.params.country}/support/exchange_repair/`));
|
||||
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios.get(itemUrl);
|
||||
const response = await got.get(itemUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
const description = $('#welcome').html()
|
||||
? $('#welcome')
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const url = require('url');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const prefix = 'https://gofans.cn/app/';
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://api.gofans.cn/v1/m/app_records?page=1&limit=20',
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const url = require('url');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ module.exports = async (ctx) => {
|
|||
const link = `https://itunes.apple.com/${country}/app/${id}`;
|
||||
const target = url.resolve(link, '?mt=8#see-all/in-app-purchases');
|
||||
|
||||
const res = await axios.get(target);
|
||||
const res = await got.get(target);
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
const data = JSON.parse($('#shoebox-ember-data-store')[0].firstChild.data);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const currency = require('currency-symbol-map');
|
||||
module.exports = async (ctx) => {
|
||||
const country = ctx.params.country;
|
||||
|
|
@ -7,7 +7,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const url = `https://buster.cheapcharts.de/v1/DetailData.php?&store=itunes&country=${country}&itemType=${type}&idInStore=${id}`;
|
||||
|
||||
const res = await axios({
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: url,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -6,7 +6,7 @@ module.exports = async (ctx) => {
|
|||
const country = ctx.params.country;
|
||||
const url = `https://itunes.apple.com/${country}/app/${id}`;
|
||||
|
||||
const res = await axios.get(url);
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
const titleTags = $('h1').attr('class', 'product-header__title');
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const {
|
||||
data: { objects: data },
|
||||
} = await axios.get('http://app.so/api/v5/appso/discount/?platform=web&limit=10');
|
||||
} = await got.get('http://app.so/api/v5/appso/discount/?platform=web&limit=10');
|
||||
|
||||
ctx.state.data = {
|
||||
title: '每日精品限免 / 促销应用',
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const city = ctx.params.city;
|
||||
const area = isNaN(city) ? city : `@${city}`;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `http://aqicn.org/aqicn/json/android/${area}/json`,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const api = 'https://api.anquanke.com/data/v1/posts?size=10&page=1&category=';
|
||||
const type = ctx.params.category;
|
||||
const host = 'https://www.anquanke.com';
|
||||
const res = await axios.get(`${api}${type}`);
|
||||
const res = await got.get(`${api}${type}`);
|
||||
const dataArray = res.data.data;
|
||||
|
||||
const items = dataArray.map((item) => ({
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://www.anquanke.com';
|
||||
|
||||
const response = await axios.get(`${url}/vul`);
|
||||
const response = await got.get(`${url}/vul`);
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('table>tbody>tr').get();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const logger = require('@/utils/logger');
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ module.exports = async (ctx) => {
|
|||
iTitle = iTitle + '-' + categoryCodes.get(category).types[type];
|
||||
}
|
||||
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios.get(itemUrl);
|
||||
const response = await got.get(itemUrl);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const description = $('div.ArticleText')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const logger = require('@/utils/logger');
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ module.exports = async (ctx) => {
|
|||
iTitle = iTitle + '-' + categoryCodes.get(category).types[type];
|
||||
}
|
||||
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios.get(itemUrl);
|
||||
const response = await got.get(itemUrl);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const description = $('div.ArticleText')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -21,7 +21,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
url = url.slice(0, -1) + `]&includeNearbyOrigins=${nearby}`;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `https://www.autotrader.co.uk/results-car-search?${ctx.params.query}`;
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
|
||||
const $ = cheerio.load(response.data.html);
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
let keyFacts = '<table><tr>';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ module.exports = async (ctx) => {
|
|||
link += '&filter=heat&orderby=heats';
|
||||
}
|
||||
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const title = $('h1.xs2 a').text();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'http://logo.baidu.com/main/show_data/0/0/0/0',
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { boardId = 1 } = ctx.params;
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `http://top.baidu.com/mobile_v2/buzz?b=${boardId}`,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const bgmCalendarUrl = 'https://api.bgm.tv/calendar';
|
||||
|
|
@ -12,7 +12,7 @@ module.exports = async (ctx) => {
|
|||
if (c) {
|
||||
return Promise.resolve(JSON.parse(c));
|
||||
} else {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: url[i],
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
// bangumi.tv未提供获取小组话题的API,因此仍需要通过抓取网页来获取
|
||||
const topicID = ctx.params.id;
|
||||
const link = `https://bgm.tv/group/topic/${topicID}`;
|
||||
const html = (await axios.get(link)).data;
|
||||
const html = (await got.get(link)).data;
|
||||
const $ = cheerio.load(html);
|
||||
const title = $('#pageHeader h1').text();
|
||||
const latestReplies = $('.row_reply')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const resolve_url = require('url').resolve;
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ const base_url = 'https://bgm.tv/';
|
|||
module.exports = async (ctx) => {
|
||||
const groupID = ctx.params.id;
|
||||
const link = 'https://bgm.tv/group/' + groupID + '/forum';
|
||||
const html = (await axios.get(link)).data;
|
||||
const html = (await got.get(link)).data;
|
||||
const $ = cheerio.load(html);
|
||||
const title = 'Bangumi - ' + $('.SecondaryNavTitle').text();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
// bangumi.tv未提供获取“人物信息”的API,因此仍需要通过抓取网页来获取
|
||||
const personID = ctx.params.id;
|
||||
const link = `https://bgm.tv/person/${personID}/works?sort=date`;
|
||||
const html = (await axios.get(link)).data;
|
||||
const html = (await got.get(link)).data;
|
||||
const $ = cheerio.load(html);
|
||||
const personName = $('.nameSingle a').text();
|
||||
const works = $('.item')
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const DateTime = require('luxon').DateTime;
|
||||
|
||||
module.exports = async (subjectID, minLength) => {
|
||||
// bangumi.tv未提供获取“吐槽(comments)”的API,因此仍需要通过抓取网页来获取
|
||||
const link = `https://bgm.tv/subject/${subjectID}/comments`;
|
||||
const html = (await axios.get(link)).data;
|
||||
const html = (await got.get(link)).data;
|
||||
const $ = cheerio.load(html);
|
||||
const title = $('.nameSingle')
|
||||
.find('a')
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (subjectID) => {
|
||||
const url = `https://api.bgm.tv/subject/${subjectID}?responseGroup=large`;
|
||||
const epsInfo = (await axios.get(url)).data;
|
||||
const epsInfo = (await got.get(url)).data;
|
||||
const activeEps = [];
|
||||
|
||||
epsInfo.eps.forEach((e) => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const DateTime = require('luxon').DateTime;
|
||||
|
||||
module.exports = (type) => {
|
||||
|
|
@ -16,7 +16,7 @@ module.exports = (type) => {
|
|||
return async (subjectID) => {
|
||||
// 官方提供的条目API文档见https://github.com/bangumi/api/blob/master/docs-raw/Subject-API.md
|
||||
const url = `https://api.bgm.tv/subject/${subjectID}?responseGroup=large`;
|
||||
const subjectInfo = (await axios.get(url)).data;
|
||||
const subjectInfo = (await got.get(url)).data;
|
||||
return {
|
||||
title: `${subjectInfo.name_cn || subjectInfo.name}的Bangumi${mapping[type].cn}`,
|
||||
link: `https://bgm.tv/subject/${subjectInfo.id}/${mapping[type].en}`,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const name = ctx.params.name;
|
||||
|
||||
const link = `http://www.banyuetan.org/byt/${name}/index.html`;
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios.get(itemUrl);
|
||||
const response = await got.get(itemUrl);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const description = $('div.detail_content')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const parser = require('@/utils/rss-parser');
|
||||
const cheerio = require('cheerio');
|
||||
const utils = require('./utils');
|
||||
|
|
@ -35,7 +35,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const items = await Promise.all(
|
||||
feed.items.splice(0, 10).map(async (item) => {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const url = require('url');
|
||||
|
||||
const api = 'https://be02.bihu.com/bihube-pc/bihu/user/getUserContentList/';
|
||||
|
|
@ -11,7 +11,7 @@ module.exports = async (ctx) => {
|
|||
const id = ctx.params.id;
|
||||
|
||||
const link = url.resolve(host, id);
|
||||
const response = await axios.post(api, {
|
||||
const response = await got.post(api, {
|
||||
queryUserId: id,
|
||||
pageNum: 1,
|
||||
});
|
||||
|
|
@ -44,14 +44,14 @@ module.exports = async (ctx) => {
|
|||
const contentId = item.contentId;
|
||||
itemLink = url.resolve(articleHost, contentId.toString());
|
||||
|
||||
const getArticleApiResponse = await axios.post(getArticleApi, {
|
||||
const getArticleApiResponse = await got.post(getArticleApi, {
|
||||
artId: contentId,
|
||||
});
|
||||
|
||||
const articleContentPath = getArticleApiResponse.data.data.content;
|
||||
|
||||
const link = url.resolve(articleContent, articleContentPath);
|
||||
const articleContentResponse = await axios.get(link);
|
||||
const articleContentResponse = await got.get(link);
|
||||
description = articleContentResponse.data;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/space/article?mid=${uid}&pn=1&ps=10&sort=publish_time&jsonp=jsonp`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
const audio = 'https://www.bilibili.com/audio/au';
|
||||
|
||||
|
|
@ -7,13 +7,13 @@ module.exports = async (ctx) => {
|
|||
const link = `https://www.bilibili.com/audio/am${id}`;
|
||||
|
||||
const apiMenuUrl = `https://www.bilibili.com/audio/music-service-c/web/menu/info?sid=${id}`;
|
||||
const menuResponse = await axios.get(apiMenuUrl);
|
||||
const menuResponse = await got.get(apiMenuUrl);
|
||||
const menuData = menuResponse.data.data;
|
||||
const introduction = menuData.intro;
|
||||
const title = menuData.title;
|
||||
|
||||
const apiUrl = `https://www.bilibili.com/audio/music-service-c/web/song/of-menu?sid=${id}&pn=1&ps=100`;
|
||||
const response = await axios.get(apiUrl);
|
||||
const response = await got.get(apiUrl);
|
||||
const data = response.data.data.data;
|
||||
|
||||
const out = data.map((item) => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const seasonid = ctx.params.seasonid;
|
||||
|
|
@ -6,13 +6,13 @@ module.exports = async (ctx) => {
|
|||
|
||||
let data;
|
||||
if (mediaid) {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://www.bilibili.com/bangumi/media/md${mediaid}`,
|
||||
});
|
||||
data = JSON.parse(response.data.match(/window\.__INITIAL_STATE__=([\s\S]+);\(function\(\)/)[1]) || {};
|
||||
} else if (seasonid) {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://bangumi.bilibili.com/anime/${seasonid}`,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://www.bilibili.com/activity/page/list?plat=1,2,3&mold=1&http=3&page=1&tid=0',
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const qs = require('querystring');
|
||||
const iconv = require('iconv-lite');
|
||||
const cheerio = require('cheerio');
|
||||
|
|
@ -8,7 +8,7 @@ module.exports = {
|
|||
const key = 'bili-username-from-uid-' + uid;
|
||||
let name = await ctx.cache.get(key);
|
||||
if (!name) {
|
||||
const nameResponse = await axios({
|
||||
const nameResponse = await got({
|
||||
method: 'post',
|
||||
url: 'https://space.bilibili.com/ajax/member/GetInfo',
|
||||
headers: {
|
||||
|
|
@ -28,7 +28,7 @@ module.exports = {
|
|||
const key = `bili-liveID-from-shortID-${shortID}`;
|
||||
let liveID = await ctx.cache.get(key);
|
||||
if (!liveID) {
|
||||
const liveIDResponse = await axios({
|
||||
const liveIDResponse = await got({
|
||||
method: 'get',
|
||||
url: `https://api.live.bilibili.com/room/v1/Room/room_init?id=${shortID}`,
|
||||
headers: {
|
||||
|
|
@ -45,7 +45,7 @@ module.exports = {
|
|||
let name = await ctx.cache.get(key);
|
||||
|
||||
if (!name) {
|
||||
const nameResponse = await axios({
|
||||
const nameResponse = await got({
|
||||
method: 'get',
|
||||
url: `https://api.live.bilibili.com/live_user/v1/UserInfo/get_anchor_in_room?roomid=${liveID}`,
|
||||
headers: {
|
||||
|
|
@ -62,7 +62,7 @@ module.exports = {
|
|||
let name = await ctx.cache.get(key);
|
||||
|
||||
if (!name) {
|
||||
const nameResponse = await axios({
|
||||
const nameResponse = await got({
|
||||
method: 'get',
|
||||
url: `https://www.bilibili.com/video/av${aid}`,
|
||||
responseType: 'buffer',
|
||||
|
|
@ -80,7 +80,7 @@ module.exports = {
|
|||
let name = await ctx.cache.get(key);
|
||||
|
||||
if (!name) {
|
||||
const nameResponse = await axios({
|
||||
const nameResponse = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/space/fav/nav?mid=${uid}`,
|
||||
headers: {
|
||||
|
|
@ -106,7 +106,7 @@ module.exports = {
|
|||
const key = `bili-Cid-from-Aid-${aid}-${pid}`;
|
||||
let cid = await ctx.cache.get(key);
|
||||
if (!cid) {
|
||||
const cidResponse = await axios({
|
||||
const cidResponse = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/web-interface/view?aid=${aid}`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -6,7 +6,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/space/coin/video?vmid=${uid}&jsonp=jsonp`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const JSONbig = require('json-bigint');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history?host_uid=${uid}`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const fid = ctx.params.fid;
|
||||
const uid = ctx.params.uid;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/v2/fav/video?vmid=${uid}&fid=${fid}`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -6,7 +6,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
const countResponse = await axios({
|
||||
const countResponse = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/relation/stat?vmid=${uid}`,
|
||||
headers: {
|
||||
|
|
@ -15,7 +15,7 @@ module.exports = async (ctx) => {
|
|||
});
|
||||
const count = countResponse.data.data.follower;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/relation/followers?vmid=${uid}`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
const countResponse = await axios({
|
||||
const countResponse = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/relation/stat?vmid=${uid}`,
|
||||
headers: {
|
||||
|
|
@ -14,7 +14,7 @@ module.exports = async (ctx) => {
|
|||
});
|
||||
const count = countResponse.data.data.following;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/relation/followings?vmid=${uid}`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
const config = require('@/config');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
async function get_bilibili_article_contain(url) {
|
||||
const result = await axios.get(url);
|
||||
const result = await got.get(url);
|
||||
|
||||
const $ = cheerio.load(result.data);
|
||||
$('img').each(function(i, e) {
|
||||
|
|
@ -23,7 +23,7 @@ module.exports = async (ctx) => {
|
|||
throw Error('缺少对应uid的b站用户登录后的Cookie值');
|
||||
}
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=${uid}&type=64`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
const config = require('@/config');
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ module.exports = async (ctx) => {
|
|||
throw Error('缺少对应uid的b站用户登录后的Cookie值');
|
||||
}
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=${uid}&type=8`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const product = ctx.params.product;
|
||||
|
|
@ -17,7 +17,7 @@ module.exports = async (ctx) => {
|
|||
break;
|
||||
}
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.vc.bilibili.com/news/v1/notice/list?platform=pc&product=${product}&category=all&page_no=1&page_size=20`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const areaID = ctx.params.areaID;
|
||||
|
|
@ -14,7 +14,7 @@ module.exports = async (ctx) => {
|
|||
break;
|
||||
}
|
||||
|
||||
const nameResponse = await axios({
|
||||
const nameResponse = await got({
|
||||
method: 'get',
|
||||
url: 'https://api.live.bilibili.com/room/v1/Area/getList',
|
||||
headers: {
|
||||
|
|
@ -50,7 +50,7 @@ module.exports = async (ctx) => {
|
|||
}
|
||||
}
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.live.bilibili.com/room/v1/area/getRoomList?area_id=${areaID}&sort_type=${order}&page_size=30&page_no=1`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -10,7 +10,7 @@ module.exports = async (ctx) => {
|
|||
}
|
||||
const name = await cache.getUsernameFromLiveID(ctx, roomID);
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.live.bilibili.com/room/v1/Room/get_info?room_id=${roomID}&from=room`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const key = ctx.params.key;
|
||||
|
|
@ -16,7 +16,7 @@ module.exports = async (ctx) => {
|
|||
break;
|
||||
}
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/web-interface/search/type?search_type=live_room&keyword=${urlEncodedKey}&order=${order}&coverType=user_cover&page=1`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://mall.bilibili.com/mall-c/search/category?keyword=&filters=&priceFlow=&priceCeil=&sortType=recommend&sortOrder=&pageIndex=1&state=&type=ip&id=${id}`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://mall.bilibili.com/mall-c/home/calendar/list?page=new&startWeekNO=0&limitWeekSize=3',
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const aid = ctx.params.aid;
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/web-interface/view?aid=${aid}`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const axios_ins = axios.extend({
|
||||
const got = require('@/utils/got');
|
||||
const got_ins = got.extend({
|
||||
headers: {
|
||||
Referer: 'https://www.bilibili.com/',
|
||||
},
|
||||
|
|
@ -19,7 +19,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const responseApi = `https://api.bilibili.com/x/web-interface/newlist?ps=15&rid=${tid}&_=${+new Date()}`;
|
||||
|
||||
const response = await axios_ins.get(responseApi);
|
||||
const response = await got_ins.get(responseApi);
|
||||
const items = [];
|
||||
let name = '未知';
|
||||
let list = {};
|
||||
|
|
@ -32,7 +32,7 @@ module.exports = async (ctx) => {
|
|||
const time_from = formatDate(new Date(new Date().getTime() - 1000 * 60 * 60 * 24 * days)); // n天前的日期
|
||||
const time_to = formatDate(new Date()); // 今天的日期
|
||||
const HotRankResponseApi = `https://s.search.bilibili.com/cate/search?main_ver=v3&search_type=video&view_type=hot_rank&cate_id=${tid}&time_from=${time_from}&time_to=${time_to}&_=${+new Date()}`;
|
||||
const HotRankResponse = await axios_ins.get(HotRankResponseApi);
|
||||
const HotRankResponse = await got_ins.get(HotRankResponseApi);
|
||||
const hotlist = HotRankResponse.data.result;
|
||||
|
||||
for (let i = 0; i < hotlist.length; i++) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const tid = ctx.params.tid;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/web-interface/newlist?ps=15&rid=${tid}&_=${+new Date()}`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rid = ctx.params.rid || '0';
|
||||
|
|
@ -9,7 +9,7 @@ module.exports = async (ctx) => {
|
|||
const rid_2 = ['全站', '动画', '国创相关', '音乐', '舞蹈', '游戏', '科技', '生活', '鬼畜', '时尚', '娱乐', '影视'];
|
||||
const rid_i = rid_1.indexOf(arc_type);
|
||||
const rid_type = rid_2[rid_i];
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/web-interface/ranking?jsonp=jsonp&rid=${rid}&day=${day}&type=1&arc_type=${arc_type}&callback=__jp0`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const aid = ctx.params.aid;
|
||||
const name = await cache.getVideoNameFromAid(ctx, aid);
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/v2/reply?type=1&oid=${aid}&sort=0`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const JSONbig = require('json-bigint');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const topic = ctx.params.topic;
|
||||
const urlEncodedTopic = encodeURIComponent(topic);
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_new?topic_name=${urlEncodedTopic}`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -7,7 +7,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const userName = await cache.getUsernameFromUID(ctx, uid);
|
||||
const host = `https://api.bilibili.com/x/space/channel/video?mid=${uid}&cid=${cid}&pn=1&ps=10&order=0`;
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: host,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/v2/fav/video?vmid=${uid}&ps=30&tid=0&keyword=&pn=1&order=fav_time`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://space.bilibili.com/ajax/member/getSubmitVideos?mid=${uid}`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const kw = ctx.params.kw;
|
||||
const order = ctx.params.order || 'pubdate';
|
||||
const kw_url = encodeURIComponent(kw);
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/web-interface/search/type?jsonp=jsonp&search_type=video&highlight=1&keyword=${kw_url}&order=${order}&duration=0&single_column=0&tids=0`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
baseURL: 'https://cn.bing.com',
|
||||
url: '/HPImageArchive.aspx',
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const cheerio = require('cheerio');
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `http://www.bjnews.com.cn/${ctx.params.cat}`;
|
||||
const res = await axios.get(url);
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
const list = $('#news_ul li').get();
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const responses = await axios.get(itemUrl);
|
||||
const responses = await got.get(itemUrl);
|
||||
const $d = cheerio.load(responses.data);
|
||||
|
||||
const single = {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const cheerio = require('cheerio');
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = 'http://www.bjp.org.cn';
|
||||
const indexUrl = baseUrl + '/col/col89/index.html';
|
||||
|
||||
const res = await axios.get(indexUrl);
|
||||
const res = await got.get(indexUrl);
|
||||
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ module.exports = async (ctx) => {
|
|||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const data = await axios.get(link);
|
||||
const data = await got.get(link);
|
||||
const $ = cheerio.load(data.data);
|
||||
|
||||
const content = $($('body > table')[1]);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'http://blogread.cn/news/newest.php';
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = 'https://jingwei.link/';
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'http://www.boc.cn/sourcedb/whpj/';
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const format = ctx.params.format;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const parser = require('@/utils/rss-parser');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
async function load(link, need_feed_description) {
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const article = $('.blog_content').removeAttr('style');
|
||||
article.find('img').removeAttr('style');
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
|
|
@ -6,7 +6,7 @@ module.exports = async (ctx) => {
|
|||
const column = ctx.params.column;
|
||||
const url = `http://${column}.caixin.com/${category}`;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: url,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const { resolve } = require('url');
|
||||
const cheerio = require('cheerio');
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
const load = ($, baseUrl) => {
|
||||
|
|
@ -44,7 +44,7 @@ const getChapters = async (id, $, caches) => {
|
|||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
||||
const { data } = await axios.get(`https://www.cartoonmad.com/comic/${id}`, {
|
||||
const { data } = await got.get(`https://www.cartoonmad.com/comic/${id}`, {
|
||||
responseType: 'buffer',
|
||||
headers: {
|
||||
Host: 'www.cartoonmad.com',
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async () => {
|
||||
const url = 'http://api.cntv.cn/video/videolistById?serviceId=cbox&vsid=C10354&em=01&p=1&n=50';
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: url,
|
||||
});
|
||||
|
|
@ -19,7 +19,7 @@ module.exports = async () => {
|
|||
link: video.url,
|
||||
pubDate: new Date(video.ptime).toUTCString(),
|
||||
};
|
||||
const { data: videoDetail } = await axios({
|
||||
const { data: videoDetail } = await got({
|
||||
method: 'get',
|
||||
url: url,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (category, ctx) => {
|
||||
const url = `http://news.cctv.com/${category}/data/index.json`;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: url,
|
||||
headers: {
|
||||
|
|
@ -52,7 +52,7 @@ module.exports = async (category, ctx) => {
|
|||
}
|
||||
|
||||
if (api) {
|
||||
const { data } = await axios({
|
||||
const { data } = await got({
|
||||
method: 'get',
|
||||
url: api,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
const date = require('@/utils/date');
|
||||
|
|
@ -9,7 +9,7 @@ module.exports = async (ctx) => {
|
|||
const dispdate = ctx.params.dispdate;
|
||||
|
||||
const link = `https://www.checkee.info/main.php?dispdate=${dispdate}`;
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $(':nth-child(11) tbody tr')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
let { subject = '' } = ctx.params;
|
||||
|
|
@ -8,7 +8,7 @@ module.exports = async (ctx) => {
|
|||
subject = '';
|
||||
}
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `${host}/m/link/more.do?type=hot&subject=${subject}&limit=recent`,
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `http://www.ciweimao.com/chapter-list/${id}/book_detail`,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const util = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://www.cnbeta.com/',
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
|
||||
// 加载文章页
|
||||
async function load(link) {
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
// 解析日期
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://coolbuy.com/api/v1.4/product_preview/?order_by=-id&limit=20&page=0&offset=0',
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const BASE_URL = 'https://minecraft.curseforge.com/';
|
||||
|
|
@ -6,7 +6,7 @@ const BASE_URL = 'https://minecraft.curseforge.com/';
|
|||
module.exports = async (ctx) => {
|
||||
const { project } = ctx.params;
|
||||
const projectLink = `${BASE_URL}/projects/${project}/files`;
|
||||
const projectFilesReq = await axios.get(projectLink);
|
||||
const projectFilesReq = await got.get(projectLink);
|
||||
const { data } = projectFilesReq;
|
||||
const $ = cheerio.load(data);
|
||||
const projectName = $('.project-title span').text();
|
||||
|
|
@ -23,7 +23,7 @@ module.exports = async (ctx) => {
|
|||
return JSON.parse(cache);
|
||||
}
|
||||
|
||||
const itemReq = await axios.get(document.link);
|
||||
const itemReq = await got.get(document.link);
|
||||
const $item = cheerio.load(itemReq.data);
|
||||
const supportVersions = $item('.details-versions li')
|
||||
.get()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const host = 'https://www.curseforge.com';
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ module.exports = async (ctx) => {
|
|||
const catagoryid = ctx.params.catagoryid;
|
||||
const projectid = ctx.params.projectid;
|
||||
const filePage = host + `/${gameid}/${catagoryid}/${projectid}/files`;
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: filePage,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const cheerio = require('cheerio');
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const url = `https://www.cyzone.cn/author/${id}`;
|
||||
const res = await axios.get(url);
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
const list = $('.article-item');
|
||||
|
|
@ -26,7 +26,7 @@ module.exports = async (ctx) => {
|
|||
if (value) {
|
||||
item.description = value;
|
||||
} else {
|
||||
const storyDetail = await axios.get(item.link);
|
||||
const storyDetail = await got.get(item.link);
|
||||
const data = storyDetail.data;
|
||||
const $ = cheerio.load(data);
|
||||
$('.article-content img').each(function() {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
const cheerio = require('cheerio');
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const name = ctx.params.name;
|
||||
const url = `https://www.cyzone.cn/label/${encodeURIComponent(name)}/`;
|
||||
const res = await axios.get(url);
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
|
||||
const list = $('.article-item');
|
||||
|
|
@ -25,7 +25,7 @@ module.exports = async (ctx) => {
|
|||
if (value) {
|
||||
item.description = value;
|
||||
} else {
|
||||
const storyDetail = await axios.get(item.link);
|
||||
const storyDetail = await got.get(item.link);
|
||||
const data = storyDetail.data;
|
||||
const $ = cheerio.load(data);
|
||||
$('.article-content img').each(function() {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
const sanitizeHtml = require('sanitize-html');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const indexLink = 'https://daily.fairyever.com/';
|
||||
const { data } = await axios.get(indexLink);
|
||||
const { data } = await got.get(indexLink);
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
// 修改 slice 可以获取更多天的内容,暂时最新的一天就够了
|
||||
|
|
@ -27,7 +27,7 @@ module.exports = async (ctx) => {
|
|||
if (cache) {
|
||||
return cache;
|
||||
}
|
||||
const { data } = await axios.get(link);
|
||||
const { data } = await got.get(link);
|
||||
const $$ = cheerio.load(data);
|
||||
// 去除锚点
|
||||
$$('a')
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue