mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 20:27:52 +08:00
refactor: rename axios to got
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const platform = ctx.params.platform;
|
||||
@@ -18,7 +18,7 @@ module.exports = async (ctx) => {
|
||||
title = '腾讯 Bugly iOS SDK 更新日志';
|
||||
}
|
||||
|
||||
const res = await axios({
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: APIUrl,
|
||||
headers: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -6,12 +6,12 @@ module.exports = async (ctx) => {
|
||||
const link = `http://dajia.qq.com/author_personal.htm#!/${uid}`;
|
||||
|
||||
const info_api = `http://i.match.qq.com/ninjayc/dajiazuozheye?action=zuojia&authorid=${uid}`;
|
||||
const info_response = await axios.get(info_api);
|
||||
const info_response = await got.get(info_api);
|
||||
const author_name = info_response.data.data.author.name;
|
||||
const description = info_response.data.data.author.description;
|
||||
|
||||
const article_api = `http://i.match.qq.com/ninjayc/dajiawenzhanglist?action=wz&authorid=${uid}`;
|
||||
const response = await axios.get(article_api);
|
||||
const response = await got.get(article_api);
|
||||
const list = response.data.data;
|
||||
|
||||
const out = await Promise.all(
|
||||
@@ -25,7 +25,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 = $('#articleContent')
|
||||
.html()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const listRes = await axios({
|
||||
const listRes = await got({
|
||||
method: 'get',
|
||||
url: 'http://i.match.qq.com/ninjayc/dajia?action=getwenz&p=0&num=20&callback=',
|
||||
headers: {
|
||||
@@ -30,7 +30,7 @@ module.exports = async (ctx) => {
|
||||
if (value) {
|
||||
item.description = value;
|
||||
} else {
|
||||
const storyDetail = await axios({
|
||||
const storyDetail = await got({
|
||||
method: 'get',
|
||||
url: pcUrl,
|
||||
headers: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -6,12 +6,12 @@ module.exports = async (ctx) => {
|
||||
const link = `http://dajia.qq.com/tanzi_diceng.htm#!/${uid}`;
|
||||
|
||||
const info_api = `http://i.match.qq.com/ninjayc/dajialanmu?action=lanmu&channelid=${uid}`;
|
||||
const info_response = await axios.get(info_api);
|
||||
const info_response = await got.get(info_api);
|
||||
const name = info_response.data.data.channel.n_cname;
|
||||
const description = info_response.data.data.channel.n_describe;
|
||||
|
||||
const article_api = `http://i.match.qq.com/ninjayc/dajiawenzhanglist?action=wz&channelid=${uid}`;
|
||||
const response = await axios.get(article_api);
|
||||
const response = await got.get(article_api);
|
||||
const list = response.data.data;
|
||||
|
||||
const out = await Promise.all(
|
||||
@@ -26,7 +26,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 = $('#articleContent')
|
||||
.html()
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { tag = 'hot' } = ctx.params;
|
||||
|
||||
const listRes = await axios({
|
||||
const listRes = await got({
|
||||
method: 'get',
|
||||
url: `http://gameinstitute.qq.com/community/${tag}/new?p=1&ps=20&ob=new&cid=0&tag=${tag}`,
|
||||
headers: {
|
||||
@@ -29,7 +29,7 @@ module.exports = async (ctx) => {
|
||||
if (value) {
|
||||
item.description = value;
|
||||
} else {
|
||||
const storyDetail = await axios({
|
||||
const storyDetail = 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 iconv = require('iconv-lite');
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = async (ctx) => {
|
||||
const link = map.get(type).link;
|
||||
|
||||
const api = `https://i.match.qq.com/ninjayc/guyu?action=guyu&channelid=${channelid}&p=0&num=10`;
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: api,
|
||||
headers: { Referer: link },
|
||||
@@ -35,7 +35,7 @@ module.exports = async (ctx) => {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const response = await axios.get(itemUrl, {
|
||||
const response = await got.get(itemUrl, {
|
||||
responseType: 'buffer',
|
||||
});
|
||||
|
||||
|
||||
@@ -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://cloud.tencent.com/document/product/454/7878';
|
||||
|
||||
const res = await axios({
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: url,
|
||||
});
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const md5 = require('@/utils/md5');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const projectID = ctx.params.project;
|
||||
const key = ctx.params.key;
|
||||
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://support.qq.com/api/v1/${projectID}/posts`,
|
||||
headers: {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
const link = `https://v.qq.com/detail/${id[0]}/${id}.html`;
|
||||
const page = await axios.get(link);
|
||||
const page = await got.get(link);
|
||||
const $ = cheerio.load(page.data);
|
||||
const episodes = await axios.get(`https://s.video.qq.com/get_playsource?id=${id}&plat=2&type=4&data_type=2&video_type=3&range=1&plname=qq&otype=json&num_mod_cnt=20&callback=a&_t=${Date.now()}`);
|
||||
const episodes = await got.get(`https://s.video.qq.com/get_playsource?id=${id}&plat=2&type=4&data_type=2&video_type=3&range=1&plname=qq&otype=json&num_mod_cnt=20&callback=a&_t=${Date.now()}`);
|
||||
const playList = JSON.parse(episodes.data.slice(2, -1)).PlaylistItem.videoPlayList;
|
||||
const items = playList.map((video) => ({
|
||||
title: video.title,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { data: htmlString } = await axios({
|
||||
const { data: htmlString } = await got({
|
||||
method: 'get',
|
||||
url: 'https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncementlist&lang=zh_CN',
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const date = require('@/utils/date');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
@@ -7,7 +7,7 @@ module.exports = async (ctx) => {
|
||||
|
||||
const link = `https://chuansongme.com/account/${id}`;
|
||||
|
||||
const response = await axios.get(link);
|
||||
const response = await got.get(link);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
@@ -28,7 +28,7 @@ module.exports = async (ctx) => {
|
||||
.find('.question_link')
|
||||
.attr('href')}`;
|
||||
|
||||
const response = await ctx.cache.tryGet(link, async () => (await axios.get(link)).data);
|
||||
const response = await ctx.cache.tryGet(link, async () => (await got.get(link)).data);
|
||||
|
||||
const article = cheerio.load(response);
|
||||
|
||||
|
||||
@@ -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://developers.weixin.qq.com/community/plugins';
|
||||
const response = await axios({
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: `https://developers.weixin.qq.com/community/ngi/plugins/cases?random=${Math.random()}`,
|
||||
headers: {
|
||||
@@ -28,7 +28,7 @@ module.exports = async (ctx) => {
|
||||
if (value) {
|
||||
item.description = value;
|
||||
} else {
|
||||
const pluginDetail = await axios({
|
||||
const pluginDetail = await got({
|
||||
method: 'get',
|
||||
url: `${url}?random=${Math.random()}`,
|
||||
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 { data } = await axios.get(`https://t.me/s/${id}`);
|
||||
const { data } = await got.get(`https://t.me/s/${id}`);
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.tgme_widget_message_wrap').slice(-10);
|
||||
|
||||
@@ -38,7 +38,7 @@ module.exports = async (ctx) => {
|
||||
single.description = value;
|
||||
} else {
|
||||
try {
|
||||
const reponse = await axios.get(link);
|
||||
const reponse = await got.get(link);
|
||||
const $ = cheerio.load(reponse.data);
|
||||
|
||||
single.description = $('.rich_media_content')
|
||||
|
||||
@@ -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: `https://wx.qnmlgb.tech/authors/${id}`,
|
||||
});
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
const axios = require('@/utils/axios');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const date = require('@/utils/date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
||||
const response = await axios.get(`https://wemp.app/accounts/${id}`);
|
||||
const response = await got.get(`https://wemp.app/accounts/${id}`);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const meta = $('.mp-info__list .mp-info__value');
|
||||
@@ -37,7 +37,7 @@ module.exports = async (ctx) => {
|
||||
.find('.post-item__title')
|
||||
.attr('href')}`;
|
||||
|
||||
const response = await ctx.cache.tryGet(link, async () => (await axios.get(link)).data);
|
||||
const response = await ctx.cache.tryGet(link, async () => (await got.get(link)).data);
|
||||
|
||||
const article = cheerio.load(response);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user