mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 23:59:56 +08:00
refactor: rename axios to got
This commit is contained in:
@@ -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