refactor: rename axios to got

This commit is contained in:
DIYgod
2019-06-03 18:03:05 +08:00
parent c4bf4fcdb4
commit a56c0b5a39
629 changed files with 1552 additions and 1552 deletions

View File

@@ -1,5 +1,5 @@
const cheerio = require('cheerio');
const axios = require('@/utils/axios');
const got = require('@/utils/got');
// 分类标题
const categoryTitle = new Map([
@@ -14,7 +14,7 @@ const categoryTitle = new Map([
module.exports = async (ctx) => {
const category = ctx.params.category;
const link = `https://www.digitaling.com/projects/${category}`;
const res = await axios.get(link);
const res = await got.get(link);
const $ = cheerio.load(res.data);
// 标题
const title = categoryTitle.get(category).name;
@@ -31,7 +31,7 @@ module.exports = async (ctx) => {
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const res = await axios.get(itemUrl);
const res = await got.get(itemUrl);
const $ = cheerio.load(res.data);
const item = {