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,9 +1,9 @@
const cheerio = require('cheerio');
const axios = require('@/utils/axios');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = `http://${ctx.params.url}`;
const res = await axios.get(`${url}/archives`);
const res = await got.get(`${url}/archives`);
const $ = cheerio.load(res.data);
const list = $('.post-header');
@@ -26,7 +26,7 @@ module.exports = async (ctx) => {
if (value) {
item.description = value;
} else {
const storyDeatil = await axios.get(item.link);
const storyDeatil = await got.get(item.link);
const data = storyDeatil.data;
const $ = cheerio.load(data);
item.pubDate = $('time').attr('datetime');