From 7d70671cc211f40872122e27dfca0b5dca6b4156 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Tue, 21 Aug 2018 00:17:12 +0800 Subject: [PATCH] app: remove custom user-agent header --- routes/3dm/download.js | 4 ---- routes/3dm/news.js | 4 ---- routes/3dm/news_center.js | 4 ---- routes/appstore/price.js | 2 -- routes/appstore/update.js | 4 ---- routes/atfd/index.js | 2 -- routes/bangumi/calendar/_base.js | 4 ---- routes/bilibili/bangumi.js | 2 -- routes/bilibili/blackboard.js | 2 -- routes/bilibili/cache.js | 8 -------- routes/bilibili/coin.js | 2 -- routes/bilibili/dynamic.js | 2 -- routes/bilibili/fav.js | 2 -- routes/bilibili/followers.js | 3 --- routes/bilibili/followings.js | 3 --- routes/bilibili/linkNews.js | 2 -- routes/bilibili/liveArea.js | 3 --- routes/bilibili/liveRoom.js | 2 -- routes/bilibili/liveSearch.js | 2 -- routes/bilibili/mallIP.js | 2 -- routes/bilibili/mallNew.js | 2 -- routes/bilibili/partion.js | 2 -- routes/bilibili/ranking.js | 2 -- routes/bilibili/reply.js | 2 -- routes/bilibili/topic.js | 2 -- routes/bilibili/userChannel.js | 2 -- routes/bilibili/userFav.js | 2 -- routes/bilibili/video.js | 2 -- routes/biquge/chapter.js | 2 -- routes/bjnews/news.js | 10 ++-------- routes/bugly/changelog.js | 2 -- routes/caixin/weekly.js | 2 -- routes/cctv/category.js | 2 -- routes/dapenti/tugua.js | 3 --- routes/disqus/posts.js | 2 -- routes/dockone/weekly.js | 2 -- routes/dongqiudi/index.js | 11 ++--------- routes/douyu/room.js | 2 -- routes/dribbble/utils.js | 2 -- routes/express/express.js | 2 -- routes/eztv/imdb.js | 2 -- routes/fir/update.js | 2 -- routes/firefox/release.js | 9 +-------- routes/gcores/category.js | 7 ------- routes/geektime/column.js | 3 --- routes/github/issue.js | 3 --- routes/github/repos.js | 3 --- routes/github/trending.js | 2 -- routes/google/scholar.js | 4 ---- routes/greasyfork/scripts.js | 4 ---- routes/hexo/next.js | 11 ++--------- routes/hopper/index.js | 4 ---- routes/imuseum/index.js | 2 -- routes/infzm/news.js | 2 -- routes/instagram/user.js | 2 -- routes/iqiyi/dongman.js | 2 -- routes/jandan/pic.js | 2 -- routes/jianshu/collection.js | 2 -- routes/jianshu/home.js | 2 -- routes/jianshu/monthly.js | 2 -- routes/jianshu/user.js | 2 -- routes/jianshu/weekly.js | 2 -- routes/jike/topic.js | 2 -- routes/jike/topicSquare.js | 2 -- routes/jike/user.js | 2 -- routes/jinritoutiao/keyword.js | 2 -- routes/juejin/category.js | 4 ---- routes/keep/user.js | 2 -- routes/kejixingqiu/home.js | 4 ---- routes/konachan/post_popular_recent.js | 4 ---- routes/linkedkeeper/index.js | 4 ---- routes/mafengwo/note.js | 2 -- routes/mi/crowdfunding.js | 5 ----- routes/mihoyo/bh2.js | 2 -- routes/mihoyo/bh3.js | 2 -- routes/miui/index.js | 4 ---- routes/mzitu/category.js | 2 -- routes/mzitu/post.js | 2 -- routes/mzitu/tag.js | 2 -- routes/mzitu/tags.js | 2 -- routes/namoc/announcement.js | 11 ++--------- routes/namoc/exhibition.js | 11 ++--------- routes/namoc/media.js | 11 ++--------- routes/namoc/news.js | 11 ++--------- routes/namoc/specials.js | 9 +-------- routes/natgeo/natgeo.js | 12 ++---------- routes/ncm/artist.js | 2 -- routes/ncm/djradio.js | 2 -- routes/ncm/playlist.js | 2 -- routes/ncm/userplaylist.js | 2 -- routes/one/index.js | 3 --- routes/oschina/news.js | 3 --- routes/panda/room.js | 2 -- routes/pigtails/index.js | 2 -- routes/pku/eecs.js | 2 -- routes/qcloud/mlvb/changelog.js | 4 ---- routes/qidian/chapter.js | 7 ------- routes/qidian/forum.js | 2 -- routes/readhub/category.js | 4 ---- routes/rsshub/rss.js | 2 -- routes/scnu/cs/match.js | 2 -- routes/scnu/jw.js | 2 -- routes/scnu/library.js | 2 -- routes/shmtu/events.js | 2 -- routes/shmtu/jwc.js | 2 -- routes/shmtu/notes.js | 2 -- routes/smzdm/keyword.js | 2 -- routes/smzdm/ranking.js | 2 -- routes/swust/cs.js | 2 -- routes/swust/jwc.js | 2 -- routes/t66y/index.js | 2 -- routes/tieba/forum.js | 2 -- routes/tingshuitz/dalian.js | 4 ---- routes/tingshuitz/hangzhou.js | 4 ---- routes/tingshuitz/xiaoshan.js | 4 ---- routes/toutiao/today.js | 2 -- routes/toutiao/user.js | 2 -- routes/tucaoqq/post.js | 2 -- routes/tuicool/mags.js | 7 ------- routes/uukanshu/chapter.js | 2 -- routes/v2ex/topics.js | 4 ---- routes/wechat/wasi.js | 2 -- routes/weibo/keyword.js | 2 -- routes/weibo/user.js | 3 --- routes/weibo/user2.js | 2 -- routes/wikipedia/mainland.js | 4 ---- routes/ximalaya/album.js | 3 --- routes/xueqiu/favorite.js | 5 ----- routes/xueqiu/user.js | 5 ----- routes/yande.re/post_popular_recent.js | 4 ---- routes/zhihu/daily.js | 2 -- routes/zhihu/utils.js | 3 --- routes/ziroom/room.js | 2 -- 133 files changed, 18 insertions(+), 418 deletions(-) diff --git a/routes/3dm/download.js b/routes/3dm/download.js index 5e2ff02a8a..a7ee293c49 100644 --- a/routes/3dm/download.js +++ b/routes/3dm/download.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const name = ctx.params.name; @@ -10,9 +9,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: url, - headers: { - 'User-Agent': config.ua, - }, }); const data = response.data; diff --git a/routes/3dm/news.js b/routes/3dm/news.js index 0f0ee265b7..4d583a002d 100644 --- a/routes/3dm/news.js +++ b/routes/3dm/news.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const name = ctx.params.name; @@ -10,9 +9,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: url, - headers: { - 'User-Agent': config.ua, - }, }); const data = response.data; diff --git a/routes/3dm/news_center.js b/routes/3dm/news_center.js index 4aff11de52..d6e101075c 100644 --- a/routes/3dm/news_center.js +++ b/routes/3dm/news_center.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const sourceTimezoneOffset = -8; module.exports = async (ctx) => { @@ -8,9 +7,6 @@ module.exports = async (ctx) => { const res = await axios({ method: 'get', url: url, - headers: { - 'User-Agent': config.ua, - }, }); const data = res.data; const $ = cheerio.load(data); diff --git a/routes/appstore/price.js b/routes/appstore/price.js index c3719be851..0c7ba59a9e 100644 --- a/routes/appstore/price.js +++ b/routes/appstore/price.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const currency = require('currency-symbol-map'); -const config = require('../../config'); module.exports = async (ctx) => { const country = ctx.params.country; @@ -13,7 +12,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: `http://www.cheapcharts.info/itunes/${country}/apps/detail-view/${id}`, }, }); diff --git a/routes/appstore/update.js b/routes/appstore/update.js index dadf708d97..a30dc4e751 100644 --- a/routes/appstore/update.js +++ b/routes/appstore/update.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -10,9 +9,6 @@ module.exports = async (ctx) => { const res = await axios({ method: 'get', url, - headers: { - 'User-Agent': config.ua, - }, }); const data = res.data; const $ = cheerio.load(data); diff --git a/routes/atfd/index.js b/routes/atfd/index.js index 7b0422f30e..ceede5ba8b 100644 --- a/routes/atfd/index.js +++ b/routes/atfd/index.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const locations = ctx.params.locations; @@ -26,7 +25,6 @@ module.exports = async (ctx) => { method: 'get', url, headers: { - 'User-Agent': config.ua, Referer: host, }, }); diff --git a/routes/bangumi/calendar/_base.js b/routes/bangumi/calendar/_base.js index 9850825580..06f4040f1e 100644 --- a/routes/bangumi/calendar/_base.js +++ b/routes/bangumi/calendar/_base.js @@ -1,5 +1,4 @@ const axios = require('../../../utils/axios'); -const config = require('../../../config'); module.exports = async (ctx) => { const bgmCalendarUrl = 'https://api.bgm.tv/calendar'; @@ -16,9 +15,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: url[i], - headers: { - 'User-Agent': config.ua, - }, }); const data = response.data; diff --git a/routes/bilibili/bangumi.js b/routes/bilibili/bangumi.js index c8d92f9fa7..5954dd1105 100644 --- a/routes/bilibili/bangumi.js +++ b/routes/bilibili/bangumi.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const seasonid = ctx.params.seasonid; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://bangumi.bilibili.com/jsonp/seasoninfo/${seasonid}.ver?callback=seasonListCallback&jsonp=jsonp&_=${+new Date()}`, headers: { - 'User-Agent': config.ua, Referer: `https://bangumi.bilibili.com/anime/${seasonid}/`, }, }); diff --git a/routes/bilibili/blackboard.js b/routes/bilibili/blackboard.js index 9442521fc8..46edbe93be 100644 --- a/routes/bilibili/blackboard.js +++ b/routes/bilibili/blackboard.js @@ -1,12 +1,10 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const response = await axios({ method: 'get', url: 'https://www.bilibili.com/activity/page/list?plat=1,2,3&mold=1&http=3&page=1&tid=0', headers: { - 'User-Agent': config.ua, Referer: 'https://www.bilibili.com/blackboard/topic_list.html', }, }); diff --git a/routes/bilibili/cache.js b/routes/bilibili/cache.js index c5491d1805..b53f5db0c0 100644 --- a/routes/bilibili/cache.js +++ b/routes/bilibili/cache.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const qs = require('querystring'); -const config = require('../../config'); const iconv = require('iconv-lite'); const cheerio = require('cheerio'); @@ -13,7 +12,6 @@ module.exports = { method: 'post', url: 'https://space.bilibili.com/ajax/member/GetInfo', headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/`, 'Content-Type': 'application/x-www-form-urlencoded', }, @@ -34,7 +32,6 @@ module.exports = { method: 'get', url: `https://api.live.bilibili.com/room/v1/Room/room_init?id=${shortID}`, headers: { - 'User-Agent': config.ua, Referer: `https://live.bilibili.com/${shortID}`, }, }); @@ -52,7 +49,6 @@ module.exports = { method: 'get', url: `https://api.live.bilibili.com/live_user/v1/UserInfo/get_anchor_in_room?roomid=${liveID}`, headers: { - 'User-Agent': config.ua, Referer: `https://live.bilibili.com/${liveID}`, }, }); @@ -69,9 +65,6 @@ module.exports = { const nameResponse = await axios({ method: 'get', url: `https://www.bilibili.com/video/av${aid}`, - headers: { - 'User-Agent': config.ua, - }, responseType: 'arraybuffer', }); const responseHtml = iconv.decode(nameResponse.data, 'UTF-8'); @@ -91,7 +84,6 @@ module.exports = { method: 'get', url: `https://api.bilibili.com/x/space/fav/nav?mid=${uid}`, headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/#/favlist`, }, }); diff --git a/routes/bilibili/coin.js b/routes/bilibili/coin.js index 9a2f015162..07e8be1086 100644 --- a/routes/bilibili/coin.js +++ b/routes/bilibili/coin.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cache = require('./cache'); module.exports = async (ctx) => { @@ -11,7 +10,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://space.bilibili.com/ajax/member/getCoinVideos?mid=${uid}`, headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/`, }, }); diff --git a/routes/bilibili/dynamic.js b/routes/bilibili/dynamic.js index d707e1eed2..f478186680 100644 --- a/routes/bilibili/dynamic.js +++ b/routes/bilibili/dynamic.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const JSONbig = require('json-bigint'); -const config = require('../../config'); module.exports = async (ctx) => { const uid = ctx.params.uid; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history?host_uid=${uid}`, headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/`, }, transformResponse: [(data) => data], diff --git a/routes/bilibili/fav.js b/routes/bilibili/fav.js index 0074e728e9..92360dfc2f 100644 --- a/routes/bilibili/fav.js +++ b/routes/bilibili/fav.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cache = require('./cache'); module.exports = async (ctx) => { @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.bilibili.com/x/v2/fav/video?vmid=${uid}&fid=${fid}`, headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/`, }, }); diff --git a/routes/bilibili/followers.js b/routes/bilibili/followers.js index 98a6bc2c0e..601735fa2b 100644 --- a/routes/bilibili/followers.js +++ b/routes/bilibili/followers.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cache = require('./cache'); module.exports = async (ctx) => { @@ -11,7 +10,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.bilibili.com/x/relation/stat?vmid=${uid}`, headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/`, }, }); @@ -21,7 +19,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.bilibili.com/x/relation/followers?vmid=${uid}`, headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/`, }, }); diff --git a/routes/bilibili/followings.js b/routes/bilibili/followings.js index 82859c8289..83017133f1 100644 --- a/routes/bilibili/followings.js +++ b/routes/bilibili/followings.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cache = require('./cache'); module.exports = async (ctx) => { @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.bilibili.com/x/relation/stat?vmid=${uid}`, headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/`, }, }); @@ -20,7 +18,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.bilibili.com/x/relation/followings?vmid=${uid}`, headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/`, }, }); diff --git a/routes/bilibili/linkNews.js b/routes/bilibili/linkNews.js index 08d75d5cd4..0fab04a80c 100644 --- a/routes/bilibili/linkNews.js +++ b/routes/bilibili/linkNews.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const product = ctx.params.product; @@ -22,7 +21,6 @@ module.exports = async (ctx) => { 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: { - 'User-Agent': config.ua, Referer: 'https://link.bilibili.com/p/eden/news', }, }); diff --git a/routes/bilibili/liveArea.js b/routes/bilibili/liveArea.js index 72f93e20ab..7f3b6f95af 100644 --- a/routes/bilibili/liveArea.js +++ b/routes/bilibili/liveArea.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const areaID = ctx.params.areaID; @@ -19,7 +18,6 @@ module.exports = async (ctx) => { method: 'get', url: 'https://api.live.bilibili.com/room/v1/Area/getList', headers: { - 'User-Agent': config.ua, Referer: 'https://link.bilibili.com/p/center/index', }, }); @@ -56,7 +54,6 @@ module.exports = async (ctx) => { 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: { - 'User-Agent': config.ua, Referer: 'https://live.bilibili.com/p/eden/area-tags', }, }); diff --git a/routes/bilibili/liveRoom.js b/routes/bilibili/liveRoom.js index 0e5d6aec4c..035ae4843a 100644 --- a/routes/bilibili/liveRoom.js +++ b/routes/bilibili/liveRoom.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cache = require('./cache'); module.exports = async (ctx) => { @@ -15,7 +14,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.live.bilibili.com/room/v1/Room/get_info?room_id=${roomID}&from=room`, headers: { - 'User-Agent': config.ua, Referer: `https://live.bilibili.com/${roomID}`, }, }); diff --git a/routes/bilibili/liveSearch.js b/routes/bilibili/liveSearch.js index 23b24edfdf..100ebb9c36 100644 --- a/routes/bilibili/liveSearch.js +++ b/routes/bilibili/liveSearch.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const key = ctx.params.key; @@ -21,7 +20,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://search.bilibili.com/api/search?search_type=live_room&keyword=${urlEncodedKey}&order=${order}&coverType=user_cover&page=1`, headers: { - 'User-Agent': config.ua, Referer: `https://search.bilibili.com/live?keyword=${urlEncodedKey}&order=${order}&coverType=user_cover&page=1&search_type=live`, }, }); diff --git a/routes/bilibili/mallIP.js b/routes/bilibili/mallIP.js index 0d07bc0e5e..120b270482 100644 --- a/routes/bilibili/mallIP.js +++ b/routes/bilibili/mallIP.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { 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: { - 'User-Agent': config.ua, Referer: `https://mall.bilibili.com/list.html?ip=${id}`, }, }); diff --git a/routes/bilibili/mallNew.js b/routes/bilibili/mallNew.js index 4ebfe873de..762ba34e5c 100644 --- a/routes/bilibili/mallNew.js +++ b/routes/bilibili/mallNew.js @@ -1,12 +1,10 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const response = await axios({ method: 'get', url: 'https://mall.bilibili.com/mall-c/home/calendar/list?page=new&startWeekNO=0&limitWeekSize=3', headers: { - 'User-Agent': config.ua, Referer: 'https://mall.bilibili.com/date.html?page=new', }, }); diff --git a/routes/bilibili/partion.js b/routes/bilibili/partion.js index abfbf9681e..37c3d2d1c2 100644 --- a/routes/bilibili/partion.js +++ b/routes/bilibili/partion.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const tid = ctx.params.tid; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.bilibili.com/x/web-interface/newlist?ps=15&rid=${tid}&_=${+new Date()}`, headers: { - 'User-Agent': config.ua, Referer: 'https://www.bilibili.com/', }, }); diff --git a/routes/bilibili/ranking.js b/routes/bilibili/ranking.js index f48d4e5ea5..0c20a322dd 100644 --- a/routes/bilibili/ranking.js +++ b/routes/bilibili/ranking.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const rid = ctx.params.rid || '0'; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.bilibili.com/x/web-interface/ranking?jsonp=jsonp&rid=${rid}&day=${day}&type=1&arc_type=0&callback=__jp0`, headers: { - 'User-Agent': config.ua, Referer: `https://www.bilibili.com/ranking/all/${rid}/0/${day}`, }, }); diff --git a/routes/bilibili/reply.js b/routes/bilibili/reply.js index b28c6a5d51..919100825c 100644 --- a/routes/bilibili/reply.js +++ b/routes/bilibili/reply.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cache = require('./cache'); module.exports = async (ctx) => { @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.bilibili.com/x/v2/reply?type=1&oid=${aid}&sort=0`, headers: { - 'User-Agent': config.ua, Referer: `https://www.bilibili.com/video/av${aid}`, }, }); diff --git a/routes/bilibili/topic.js b/routes/bilibili/topic.js index 00eb1c5703..f1689e7e9b 100644 --- a/routes/bilibili/topic.js +++ b/routes/bilibili/topic.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const JSONbig = require('json-bigint'); -const config = require('../../config'); module.exports = async (ctx) => { const topic = ctx.params.topic; @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_new?topic_name=${urlEncodedTopic}`, headers: { - 'User-Agent': config.ua, Referer: `https://www.bilibili.com/tag/${urlEncodedTopic}/feed`, }, transformResponse: [(data) => data], diff --git a/routes/bilibili/userChannel.js b/routes/bilibili/userChannel.js index 35f6f8691f..639b93c334 100644 --- a/routes/bilibili/userChannel.js +++ b/routes/bilibili/userChannel.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cache = require('./cache'); module.exports = async (ctx) => { @@ -13,7 +12,6 @@ module.exports = async (ctx) => { method: 'get', url: host, headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/`, }, }); diff --git a/routes/bilibili/userFav.js b/routes/bilibili/userFav.js index 71dce9090c..d07283016c 100644 --- a/routes/bilibili/userFav.js +++ b/routes/bilibili/userFav.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cache = require('./cache'); module.exports = async (ctx) => { @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://api.bilibili.com/x/v2/fav/video?vmid=${uid}&ps=30&tid=0&keyword=&pn=1&order=fav_time`, headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/#/favlist`, }, }); diff --git a/routes/bilibili/video.js b/routes/bilibili/video.js index 88440e6832..a5ff8bd70c 100644 --- a/routes/bilibili/video.js +++ b/routes/bilibili/video.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cache = require('./cache'); module.exports = async (ctx) => { @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://space.bilibili.com/ajax/member/getSubmitVideos?mid=${uid}`, headers: { - 'User-Agent': config.ua, Referer: `https://space.bilibili.com/${uid}/`, }, }); diff --git a/routes/biquge/chapter.js b/routes/biquge/chapter.js index c1ff1c2726..ca91d08d49 100644 --- a/routes/biquge/chapter.js +++ b/routes/biquge/chapter.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const iconv = require('iconv-lite'); const baseUrl = 'https://www.biquge5200.com/'; @@ -12,7 +11,6 @@ module.exports = async (ctx) => { method: 'get', url: `${baseUrl}${id}/`, headers: { - 'User-Agent': config.ua, Host: 'www.biquge5200.com', Referer: `${baseUrl}${id}/`, }, diff --git a/routes/bjnews/news.js b/routes/bjnews/news.js index 92f63f5296..0f180e8383 100644 --- a/routes/bjnews/news.js +++ b/routes/bjnews/news.js @@ -1,15 +1,9 @@ const cheerio = require('cheerio'); -const config = require('../../config'); const axios = require('../../utils/axios'); -const axios_ins = axios.create({ - headers: { - 'User-Agent': config.ua, - }, -}); module.exports = async (ctx) => { const url = `http://www.bjnews.com.cn/${ctx.params.cat}`; - const res = await axios_ins.get(url); + const res = await axios.get(url); const data = res.data; const $ = cheerio.load(data); const list = $('#news_ul li'); @@ -34,7 +28,7 @@ module.exports = async (ctx) => { guid: itemUrl, }; out.push(single); - proList.push(axios_ins.get(itemUrl)); + proList.push(axios.get(itemUrl)); indexList.push(i); } const responses = await axios.all(proList); diff --git a/routes/bugly/changelog.js b/routes/bugly/changelog.js index 1c089bc92a..6d9f349b1b 100644 --- a/routes/bugly/changelog.js +++ b/routes/bugly/changelog.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const platform = ctx.params.platform; @@ -23,7 +22,6 @@ module.exports = async (ctx) => { method: 'get', url: APIUrl, headers: { - 'User-Agent': config.ua, Referer: webUrl, }, }); diff --git a/routes/caixin/weekly.js b/routes/caixin/weekly.js index cf599b26a6..8b23642ede 100644 --- a/routes/caixin/weekly.js +++ b/routes/caixin/weekly.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const category = ctx.params.category; @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/cctv/category.js b/routes/cctv/category.js index d55a550a13..01697c7c4b 100644 --- a/routes/cctv/category.js +++ b/routes/cctv/category.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const category = ctx.params.category; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/dapenti/tugua.js b/routes/dapenti/tugua.js index 379f08dd57..940f711ee4 100644 --- a/routes/dapenti/tugua.js +++ b/routes/dapenti/tugua.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const iconv = require('iconv-lite'); module.exports = async (ctx) => { @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: 'https://www.dapenti.com/blog/blog.asp?name=xilei&subjectid=70', headers: { - 'User-Agent': config.ua, Referer: 'https://www.dapenti.com/blog/blog.asp?name=xilei&subjectid=70', }, // 喷嚏网编码为GBK,需要转码 @@ -30,7 +28,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, responseType: 'arraybuffer', diff --git a/routes/disqus/posts.js b/routes/disqus/posts.js index 664ff32ad7..8b9116ec24 100644 --- a/routes/disqus/posts.js +++ b/routes/disqus/posts.js @@ -8,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://disqus.com/api/3.0/forums/listPosts.json?api_key=${config.disqus.api_key}&forum=${forum}`, headers: { - 'User-Agent': config.ua, Referer: 'https://disqus.com/', }, }); @@ -28,7 +27,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://disqus.com/api/3.0/forums/listThreads.json?api_key=${config.disqus.api_key}&forum=${forum}${threadsQuery}`, headers: { - 'User-Agent': config.ua, Referer: 'https://disqus.com/', }, }); diff --git a/routes/dockone/weekly.js b/routes/dockone/weekly.js index 1e702c7871..c0aa3af728 100644 --- a/routes/dockone/weekly.js +++ b/routes/dockone/weekly.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); function replaceEmpty(str) { return str.replace(' ', ''); @@ -15,7 +14,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/dongqiudi/index.js b/routes/dongqiudi/index.js index d38f3a2798..e7ec1aa09e 100644 --- a/routes/dongqiudi/index.js +++ b/routes/dongqiudi/index.js @@ -1,15 +1,8 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cheerio = require('cheerio'); -const _axios_client = axios.create({ - headers: { - 'User-Agent': config.ua, - }, -}); - module.exports = async (ctx) => { - const response = await _axios_client.get('http://www.dongqiudi.com/special/48'); + const response = await axios.get('http://www.dongqiudi.com/special/48'); const $ = cheerio.load(response.data); @@ -35,7 +28,7 @@ module.exports = async (ctx) => { }; try { - const es = _axios_client.get(itemUrl); + const es = axios.get(itemUrl); proList.push(es); out.push(single); } catch (err) { diff --git a/routes/douyu/room.js b/routes/douyu/room.js index 1451bab6aa..649a320c98 100644 --- a/routes/douyu/room.js +++ b/routes/douyu/room.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: `http://open.douyucdn.cn/api/RoomApi/room/${id}`, headers: { - 'User-Agent': config.ua, Referer: `https://www.douyu.com/${id}`, }, }); diff --git a/routes/dribbble/utils.js b/routes/dribbble/utils.js index f38ac4e186..78c3603061 100644 --- a/routes/dribbble/utils.js +++ b/routes/dribbble/utils.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = { getData: async (name, url) => { @@ -8,7 +7,6 @@ module.exports = { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/express/express.js b/routes/express/express.js index f5ab596da8..c414f0d984 100644 --- a/routes/express/express.js +++ b/routes/express/express.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const company = ctx.params.company; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://www.kuaidi100.com/query?type=${company}&postid=${number}`, headers: { - 'User-Agent': config.ua, Referer: 'https://www.kuaidi100.com', }, }); diff --git a/routes/eztv/imdb.js b/routes/eztv/imdb.js index 64f715b4ba..6e7a355535 100644 --- a/routes/eztv/imdb.js +++ b/routes/eztv/imdb.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const { imdb_id } = ctx.params; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://eztv.ag/api/get-torrents?imdb_id=${imdb_id}`, headers: { - 'User-Agent': config.ua, Referer: 'https://eztv.ag', }, }); diff --git a/routes/fir/update.js b/routes/fir/update.js index 7d4984af7d..52b9ee5c30 100644 --- a/routes/fir/update.js +++ b/routes/fir/update.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -11,7 +10,6 @@ module.exports = async (ctx) => { method: 'get', url: APIUrl, headers: { - 'User-Agent': config.ua, Referer: webUrl, }, }); diff --git a/routes/firefox/release.js b/routes/firefox/release.js index be04d0e78e..9846f58c40 100644 --- a/routes/firefox/release.js +++ b/routes/firefox/release.js @@ -1,12 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); - -const axios_ins = axios.create({ - headers: { - 'User-Agent': config.ua, - }, -}); module.exports = async (ctx) => { if (ctx.params.platform === 'desktop') { @@ -15,7 +8,7 @@ module.exports = async (ctx) => { if (ctx.params.platform === 'android-beta') { ctx.params.platform = 'android/beta'; } - const response = await axios_ins.get(`https://www.mozilla.org/en-US/firefox/${ctx.params.platform}/notes/`); + const response = await axios.get(`https://www.mozilla.org/en-US/firefox/${ctx.params.platform}/notes/`); const data = response.data; const $ = cheerio.load(data); diff --git a/routes/gcores/category.js b/routes/gcores/category.js index 2f80a4587a..f7ee13103c 100644 --- a/routes/gcores/category.js +++ b/routes/gcores/category.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const sourceTimezoneOffset = -8; module.exports = async (ctx) => { @@ -9,9 +8,6 @@ module.exports = async (ctx) => { const res = await axios({ method: 'get', url: url, - headers: { - 'User-Agent': config.ua, - }, }); const data = res.data; let $ = cheerio.load(data); @@ -42,9 +38,6 @@ module.exports = async (ctx) => { itemRes = await axios({ method: 'get', url: itemUrl, - headers: { - 'User-Agent': config.ua, - }, }); } catch (e) { return Promise.resolve(); diff --git a/routes/geektime/column.js b/routes/geektime/column.js index c89b0e430f..816a84ec55 100644 --- a/routes/geektime/column.js +++ b/routes/geektime/column.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const column_id = ctx.params.cid; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'post', url: 'https://time.geekbang.org/serv/v1/column/intro', headers: { - 'User-Agent': config.ua, Referer: 'https://time.geekbang.org/', 'Content-Type': 'application/json', }, @@ -25,7 +23,6 @@ module.exports = async (ctx) => { method: 'post', url: 'https://time.geekbang.org/serv/v1/column/articles/latest', headers: { - 'User-Agent': config.ua, Referer: 'https://time.geekbang.org/', 'Content-Type': 'application/json', }, diff --git a/routes/github/issue.js b/routes/github/issue.js index 5070478288..6783d1117c 100644 --- a/routes/github/issue.js +++ b/routes/github/issue.js @@ -12,9 +12,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url, - headers: { - 'User-Agent': config.ua, - }, params: { sort: 'created', access_token: config.github.access_token, diff --git a/routes/github/repos.js b/routes/github/repos.js index 8e8f803498..2497b7086a 100644 --- a/routes/github/repos.js +++ b/routes/github/repos.js @@ -7,9 +7,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: `https://api.github.com/users/${user}/repos`, - headers: { - 'User-Agent': config.ua, - }, params: { sort: 'created', access_token: config.github.access_token, diff --git a/routes/github/trending.js b/routes/github/trending.js index 8c87f59bf0..b265239ae8 100644 --- a/routes/github/trending.js +++ b/routes/github/trending.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const since = ctx.params.since; @@ -11,7 +10,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/google/scholar.js b/routes/google/scholar.js index 8fbe02a15a..7011888498 100644 --- a/routes/google/scholar.js +++ b/routes/google/scholar.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cheerio = require('cheerio'); module.exports = async (ctx) => { @@ -20,9 +19,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url, - headers: { - 'User-Agent': config.ua, - }, }); const $ = cheerio.load(response.data); diff --git a/routes/greasyfork/scripts.js b/routes/greasyfork/scripts.js index 03c75b1bef..e5521e26cb 100644 --- a/routes/greasyfork/scripts.js +++ b/routes/greasyfork/scripts.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const language = ctx.params.language === 'all' ? 'zh-CN' : ctx.params.language; @@ -15,9 +14,6 @@ module.exports = async (ctx) => { filter_locale: filter_locale, sort: 'updated', }, - headers: { - 'User-Agent': config.ua, - }, }); const data = res.data; const $ = cheerio.load(data); diff --git a/routes/hexo/next.js b/routes/hexo/next.js index 9a11d4f9f0..0ad394ef8a 100644 --- a/routes/hexo/next.js +++ b/routes/hexo/next.js @@ -1,16 +1,9 @@ const cheerio = require('cheerio'); -const config = require('../../config'); const axios = require('../../utils/axios'); -const axios_ins = axios.create({ - headers: { - 'User-Agent': config.ua, - }, -}); - module.exports = async (ctx) => { const url = `http://${ctx.params.url}`; - const res = await axios_ins.get(`${url}/archives`); + const res = await axios.get(`${url}/archives`); const data = res.data; const $ = cheerio.load(data); @@ -34,7 +27,7 @@ module.exports = async (ctx) => { if (value) { item.description = value; } else { - const storyDeatil = await axios_ins.get(item.link); + const storyDeatil = await axios.get(item.link); const data = storyDeatil.data; const $ = cheerio.load(data); item.pubDate = $('time').attr('datetime'); diff --git a/routes/hopper/index.js b/routes/hopper/index.js index 3d0da5b673..0d466256c9 100644 --- a/routes/hopper/index.js +++ b/routes/hopper/index.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cheerio = require('cheerio'); module.exports = async (ctx) => { @@ -14,9 +13,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url, - headers: { - 'User-Agent': config.ua, - }, params: { pid: 'website', c: 'flexweb', diff --git a/routes/imuseum/index.js b/routes/imuseum/index.js index 2d6881b962..fe662db2a5 100644 --- a/routes/imuseum/index.js +++ b/routes/imuseum/index.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const baseUrl = 'https://art.icity.ly'; @@ -16,7 +15,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/infzm/news.js b/routes/infzm/news.js index 70db8c42ad..2ea2343f0d 100644 --- a/routes/infzm/news.js +++ b/routes/infzm/news.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const baseUrl = 'http://www.infzm.com/contents/'; @@ -11,7 +10,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/instagram/user.js b/routes/instagram/user.js index 8f241d2a61..49879ea193 100644 --- a/routes/instagram/user.js +++ b/routes/instagram/user.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://www.instagram.com/${id}/`, headers: { - 'User-Agent': config.ua, Referer: `https://www.instagram.com/${id}/`, }, }); diff --git a/routes/iqiyi/dongman.js b/routes/iqiyi/dongman.js index 295c9dea6c..72cbc61457 100644 --- a/routes/iqiyi/dongman.js +++ b/routes/iqiyi/dongman.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: `http://www.iqiyi.com/${id}.html`, headers: { - 'User-Agent': config.ua, Host: 'www.iqiyi.com', Referer: `http://www.iqiyi.com/${id}.html`, }, diff --git a/routes/jandan/pic.js b/routes/jandan/pic.js index fdc3875eac..e953bc882d 100644 --- a/routes/jandan/pic.js +++ b/routes/jandan/pic.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const base64_decode = (i) => Buffer.from(i, 'base64').toString('binary'); @@ -15,7 +14,6 @@ module.exports = async (ctx) => { method: 'get', url: `${baseUrl}${sub_model}/`, headers: { - 'User-Agent': config.ua, Referer: 'http://jandan.net', }, }); diff --git a/routes/jianshu/collection.js b/routes/jianshu/collection.js index 73bf75cf2a..35419053e4 100644 --- a/routes/jianshu/collection.js +++ b/routes/jianshu/collection.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://www.jianshu.com/c/${id}`, headers: { - 'User-Agent': config.ua, Referer: `https://www.jianshu.com/c/${id}`, }, }); diff --git a/routes/jianshu/home.js b/routes/jianshu/home.js index 70f2257c16..7a4417355f 100644 --- a/routes/jianshu/home.js +++ b/routes/jianshu/home.js @@ -1,13 +1,11 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const response = await axios({ method: 'get', url: 'https://www.jianshu.com', headers: { - 'User-Agent': config.ua, Referer: 'https://www.jianshu.com', }, }); diff --git a/routes/jianshu/monthly.js b/routes/jianshu/monthly.js index 0ede451c39..1defe1bcd2 100644 --- a/routes/jianshu/monthly.js +++ b/routes/jianshu/monthly.js @@ -1,13 +1,11 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const response = await axios({ method: 'get', url: 'https://www.jianshu.com/trending/monthly', headers: { - 'User-Agent': config.ua, Referer: 'https://www.jianshu.com/trending/monthly', }, }); diff --git a/routes/jianshu/user.js b/routes/jianshu/user.js index 6d91722faa..ad5e947a13 100644 --- a/routes/jianshu/user.js +++ b/routes/jianshu/user.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://www.jianshu.com/u/${id}`, headers: { - 'User-Agent': config.ua, Referer: `https://www.jianshu.com/u/${id}`, }, }); diff --git a/routes/jianshu/weekly.js b/routes/jianshu/weekly.js index ce053b2dc9..7b6bc1b139 100644 --- a/routes/jianshu/weekly.js +++ b/routes/jianshu/weekly.js @@ -1,13 +1,11 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const response = await axios({ method: 'get', url: 'https://www.jianshu.com/trending/weekly', headers: { - 'User-Agent': config.ua, Referer: 'https://www.jianshu.com/trending/weekly', }, }); diff --git a/routes/jike/topic.js b/routes/jike/topic.js index 5eff748979..1d40aa4416 100644 --- a/routes/jike/topic.js +++ b/routes/jike/topic.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'post', url: 'https://app.jike.ruguoapp.com/1.0/messages/history', headers: { - 'User-Agent': config.ua, Referer: `https://m.okjike.com/topics/${id}`, 'App-Version': '4.1.0', }, diff --git a/routes/jike/topicSquare.js b/routes/jike/topicSquare.js index 35973afebb..7a2b17c3cf 100644 --- a/routes/jike/topicSquare.js +++ b/routes/jike/topicSquare.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'post', url: 'https://app.jike.ruguoapp.com/1.0/squarePosts/list', headers: { - 'User-Agent': config.ua, Referer: `https://m.okjike.com/topics/${id}`, 'App-Version': '4.1.0', }, diff --git a/routes/jike/user.js b/routes/jike/user.js index 1ae3a9fc28..20f40fdcee 100644 --- a/routes/jike/user.js +++ b/routes/jike/user.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'post', url: 'https://app.jike.ruguoapp.com/1.0/personalUpdate/single', headers: { - 'User-Agent': config.ua, Referer: `https://web.okjike.com/user/${id}/post`, 'App-Version': '4.1.0', platform: 'web', diff --git a/routes/jinritoutiao/keyword.js b/routes/jinritoutiao/keyword.js index d471df6723..bae0e6ba9c 100644 --- a/routes/jinritoutiao/keyword.js +++ b/routes/jinritoutiao/keyword.js @@ -1,5 +1,4 @@ const axios = require('axios'); -const config = require('../../config'); module.exports = async (ctx) => { const keyword = ctx.params.keyword; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://www.toutiao.com/search_content/?offset=0&format=json&keyword=${encodeURIComponent(keyword)}&autoload=true&count=20&cur_tab=1&from=search_tab`, headers: { - 'User-Agent': config.ua, Referer: `https://www.toutiao.com/search/?keyword=${encodeURIComponent(keyword)}`, }, }); diff --git a/routes/juejin/category.js b/routes/juejin/category.js index c51f727191..969070245f 100644 --- a/routes/juejin/category.js +++ b/routes/juejin/category.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const category = ctx.params.category; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: 'https://gold-tag-ms.juejin.im/v1/categories', headers: { - 'User-Agent': config.ua, Referer: `https://juejin.im/welcome/${category}`, 'X-Juejin-Client': '', 'X-Juejin-Src': 'web', @@ -25,7 +23,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://timeline-merger-ms.juejin.im/v1/get_entry_by_timeline?src=web&limit=20&category=${id}`, headers: { - 'User-Agent': config.ua, Referer: `https://juejin.im/welcome/${category}`, }, }); @@ -54,7 +51,6 @@ module.exports = async (ctx) => { method: 'get', url: item.originalUrl, headers: { - 'User-Agent': config.ua, Referer: item.originalUrl, }, }); diff --git a/routes/keep/user.js b/routes/keep/user.js index 311b2e9dff..a83df4f561 100644 --- a/routes/keep/user.js +++ b/routes/keep/user.js @@ -1,6 +1,5 @@ const axios = require('axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const keep_project_and_duration = (text) => { const project = text @@ -53,7 +52,6 @@ module.exports = async (ctx) => { method: 'get', url: requestUrl, headers: { - 'User-Agent': config.ua, Host: 'show.gotokeep.com', }, }); diff --git a/routes/kejixingqiu/home.js b/routes/kejixingqiu/home.js index 78ac259ad9..361e835ca6 100644 --- a/routes/kejixingqiu/home.js +++ b/routes/kejixingqiu/home.js @@ -1,14 +1,10 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const response = await axios({ method: 'get', url: 'http://www.xincheng.tv', - headers: { - 'User-Agent': config.ua, - }, }); const data = response.data; diff --git a/routes/konachan/post_popular_recent.js b/routes/konachan/post_popular_recent.js index 50cedc0cb2..1a1a5399c9 100644 --- a/routes/konachan/post_popular_recent.js +++ b/routes/konachan/post_popular_recent.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const { period = '1d' } = ctx.params; @@ -10,9 +9,6 @@ module.exports = async (ctx) => { method: 'get', baseURL, url: '/post/popular_recent.json', - headers: { - 'User-Agent': config.ua, - }, params: { period, }, diff --git a/routes/linkedkeeper/index.js b/routes/linkedkeeper/index.js index e9f3b8c564..7a6829f97f 100644 --- a/routes/linkedkeeper/index.js +++ b/routes/linkedkeeper/index.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const type = ctx.params.type; @@ -13,9 +12,6 @@ module.exports = async (ctx) => { sid: id, tid: id, }, - headers: { - 'User-Agent': config.ua, - }, }); const data = res.data; const $ = cheerio.load(data); diff --git a/routes/mafengwo/note.js b/routes/mafengwo/note.js index 0f991f06e1..a836fccaf4 100644 --- a/routes/mafengwo/note.js +++ b/routes/mafengwo/note.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const baseApiUrl = 'http://pagelet.mafengwo.cn/note/pagelet/recommendNoteApi'; const baseUrl = 'http://www.mafengwo.cn'; @@ -27,7 +26,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/mi/crowdfunding.js b/routes/mi/crowdfunding.js index 8928a5bce1..c7a2a5d9d2 100644 --- a/routes/mi/crowdfunding.js +++ b/routes/mi/crowdfunding.js @@ -1,14 +1,10 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const baseUrl = 'https://home.mi.com/app/shop/content?id=s8939d03918810635'; const response = await axios({ method: 'get', url: baseUrl, - headers: { - 'User-Agent': config.ua, - }, }); const data = response.data.match(/,gid:(\d*),src:"(.+?)"/g).map((item) => ({ @@ -28,7 +24,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://home.mi.com/app/shop/jsonp?k=test&m=Product&a=GetDetail&p={%22gid%22:${item.gid}}&_=${+new Date()}&callback=Zepto1532846359142`, headers: { - 'User-Agent': config.ua, Referer: baseUrl, }, }); diff --git a/routes/mihoyo/bh2.js b/routes/mihoyo/bh2.js index 161c37ad0f..ec2f32b34c 100644 --- a/routes/mihoyo/bh2.js +++ b/routes/mihoyo/bh2.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const url = 'http://www.mihoyo.com/news/getNotice'; @@ -17,7 +16,6 @@ module.exports = async (ctx) => { method: 'post', url: url, headers: { - 'User-Agent': config.ua, Referer: url, 'x-requested-with': 'XMLHttpRequest', }, diff --git a/routes/mihoyo/bh3.js b/routes/mihoyo/bh3.js index c0f6bf5858..d5fcb31d33 100644 --- a/routes/mihoyo/bh3.js +++ b/routes/mihoyo/bh3.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const url = 'https://www.bh3.com/index.php/news/_more'; @@ -19,7 +18,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, 'x-requested-with': 'XMLHttpRequest', }, diff --git a/routes/miui/index.js b/routes/miui/index.js index 1e95d1b665..a9dae307d4 100644 --- a/routes/miui/index.js +++ b/routes/miui/index.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cacheLength = 5; const cacheDays = 30; @@ -14,9 +13,6 @@ module.exports = async (ctx) => { method: 'get', baseURL: 'http://update.miui.com', url: '/updates/miota-fullrom.php', - headers: { - 'User-Agent': config.ua, - }, params: { d: device, b: releaseType, diff --git a/routes/mzitu/category.js b/routes/mzitu/category.js index 9d9a56c427..f838c5845d 100644 --- a/routes/mzitu/category.js +++ b/routes/mzitu/category.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { let category = ctx.params.category; @@ -13,7 +12,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/mzitu/post.js b/routes/mzitu/post.js index 25b956d659..9084345e6c 100644 --- a/routes/mzitu/post.js +++ b/routes/mzitu/post.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -11,7 +10,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/mzitu/tag.js b/routes/mzitu/tag.js index f5c2e48f28..3ac562e219 100644 --- a/routes/mzitu/tag.js +++ b/routes/mzitu/tag.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { let tag = ctx.params.tag; @@ -12,7 +11,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/mzitu/tags.js b/routes/mzitu/tags.js index bff38c9508..5724189894 100644 --- a/routes/mzitu/tags.js +++ b/routes/mzitu/tags.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const url = 'http://www.mzitu.com/zhuanti'; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/namoc/announcement.js b/routes/namoc/announcement.js index e63f119b09..883e85293a 100644 --- a/routes/namoc/announcement.js +++ b/routes/namoc/announcement.js @@ -1,18 +1,11 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cheerio = require('cheerio'); const url = require('url'); -const _axios_client = axios.create({ - headers: { - 'User-Agent': config.ua, - }, -}); - const host = 'http://www.namoc.org/xwzx/tzgg/2017gonggao/'; module.exports = async (ctx) => { - const response = await _axios_client.get(host); + const response = await axios.get(host); const $ = cheerio.load(response.data); @@ -36,7 +29,7 @@ module.exports = async (ctx) => { }; try { - const es = _axios_client.get(itemUrl); + const es = axios.get(itemUrl); proList.push(es); out.push(single); } catch (err) { diff --git a/routes/namoc/exhibition.js b/routes/namoc/exhibition.js index 186a24a0c9..6a6b905325 100644 --- a/routes/namoc/exhibition.js +++ b/routes/namoc/exhibition.js @@ -1,18 +1,11 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cheerio = require('cheerio'); const url = require('url'); -const _axios_client = axios.create({ - headers: { - 'User-Agent': config.ua, - }, -}); - const host = 'http://www.namoc.org/zsjs/zlzx/'; module.exports = async (ctx) => { - const response = await _axios_client.get(host); + const response = await axios.get(host); const $ = cheerio.load(response.data); @@ -36,7 +29,7 @@ module.exports = async (ctx) => { }; try { - const es = _axios_client.get(itemUrl); + const es = axios.get(itemUrl); proList.push(es); out.push(single); } catch (err) { diff --git a/routes/namoc/media.js b/routes/namoc/media.js index 9064045a0e..56c2004c2b 100644 --- a/routes/namoc/media.js +++ b/routes/namoc/media.js @@ -1,18 +1,11 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cheerio = require('cheerio'); const url = require('url'); -const _axios_client = axios.create({ - headers: { - 'User-Agent': config.ua, - }, -}); - const host = 'http://www.namoc.org/xwzx/mtry/2018/'; module.exports = async (ctx) => { - const response = await _axios_client.get(host); + const response = await axios.get(host); const $ = cheerio.load(response.data); @@ -36,7 +29,7 @@ module.exports = async (ctx) => { }; try { - const es = _axios_client.get(itemUrl); + const es = axios.get(itemUrl); proList.push(es); out.push(single); } catch (err) { diff --git a/routes/namoc/news.js b/routes/namoc/news.js index 3ec941dd95..7366922058 100644 --- a/routes/namoc/news.js +++ b/routes/namoc/news.js @@ -1,18 +1,11 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cheerio = require('cheerio'); const url = require('url'); -const _axios_client = axios.create({ - headers: { - 'User-Agent': config.ua, - }, -}); - const host = 'http://www.namoc.org/xwzx/xw/xinwen/'; module.exports = async (ctx) => { - const response = await _axios_client.get(host); + const response = await axios.get(host); const $ = cheerio.load(response.data); @@ -36,7 +29,7 @@ module.exports = async (ctx) => { }; try { - const es = _axios_client.get(itemUrl); + const es = axios.get(itemUrl); proList.push(es); out.push(single); } catch (err) { diff --git a/routes/namoc/specials.js b/routes/namoc/specials.js index c404e77867..634712720c 100644 --- a/routes/namoc/specials.js +++ b/routes/namoc/specials.js @@ -1,17 +1,10 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cheerio = require('cheerio'); -const _axios_client = axios.create({ - headers: { - 'User-Agent': config.ua, - }, -}); - const host = 'http://www.namoc.org/xwzx/jdzt/2018zhuanti/'; module.exports = async (ctx) => { - const response = await _axios_client.get(host); + const response = await axios.get(host); const $ = cheerio.load(response.data); diff --git a/routes/natgeo/natgeo.js b/routes/natgeo/natgeo.js index 44b56ce0cd..e712c9f873 100644 --- a/routes/natgeo/natgeo.js +++ b/routes/natgeo/natgeo.js @@ -1,18 +1,10 @@ const cheerio = require('cheerio'); -const config = require('../../config'); const axios = require('../../utils/axios'); -const axios_ins = axios.create({ - headers: { - 'User-Agent': config.ua, - Reference: 'https://www.natgeomedia.com', - }, -}); - module.exports = async (ctx) => { const type = `${ctx.params.type ? ctx.params.type : ''}`; const url = `https://www.natgeomedia.com/category/${ctx.params.cat}/${type}`; - const res = await axios_ins.get(url); + const res = await axios.get(url); const data = res.data; const $ = cheerio.load(data); @@ -37,7 +29,7 @@ module.exports = async (ctx) => { if (value) { item.description = value; } else { - const storyDetail = await axios_ins.get(item.link); + const storyDetail = await axios.get(item.link); const data = storyDetail.data; const $ = cheerio.load(data); item.description = $('.td-post-content').html(); diff --git a/routes/ncm/artist.js b/routes/ncm/artist.js index 63585caba2..d5a359ad6d 100644 --- a/routes/ncm/artist.js +++ b/routes/ncm/artist.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://music.163.com/api/artist/albums/${id}`, headers: { - 'User-Agent': config.ua, Referer: 'https://music.163.com/', }, }); diff --git a/routes/ncm/djradio.js b/routes/ncm/djradio.js index 2da5a1a54c..da484fc1e9 100644 --- a/routes/ncm/djradio.js +++ b/routes/ncm/djradio.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const qs = require('querystring'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'post', url: 'http://music.163.com/api/dj/program/byradio', headers: { - 'User-Agent': config.ua, Referer: 'https://music.163.com/', 'Content-Type': 'application/x-www-form-urlencoded', }, diff --git a/routes/ncm/playlist.js b/routes/ncm/playlist.js index 06d9e1cd17..f1e95c691a 100644 --- a/routes/ncm/playlist.js +++ b/routes/ncm/playlist.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const qs = require('querystring'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'post', url: 'https://music.163.com/api/v3/playlist/detail', headers: { - 'User-Agent': config.ua, Referer: 'https://music.163.com/', 'Content-Type': 'application/x-www-form-urlencoded', }, diff --git a/routes/ncm/userplaylist.js b/routes/ncm/userplaylist.js index 86968d97ac..2a2f837897 100644 --- a/routes/ncm/userplaylist.js +++ b/routes/ncm/userplaylist.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const qs = require('querystring'); -const config = require('../../config'); module.exports = async (ctx) => { const uid = ctx.params.uid; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'post', url: 'http://music.163.com/api/user/playlist', headers: { - 'User-Agent': config.ua, Referer: 'https://music.163.com/', 'Content-Type': 'application/x-www-form-urlencoded', }, diff --git a/routes/one/index.js b/routes/one/index.js index 1de7612e71..39d2c37705 100644 --- a/routes/one/index.js +++ b/routes/one/index.js @@ -1,13 +1,11 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const response = await axios({ method: 'get', url: 'http://wufazhuce.com/', headers: { - 'User-Agent': config.ua, Referer: 'http://wufazhuce.com/', }, }); @@ -39,7 +37,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: 'http://wufazhuce.com/', }, }); diff --git a/routes/oschina/news.js b/routes/oschina/news.js index bab14c01d2..f0db6876d4 100644 --- a/routes/oschina/news.js +++ b/routes/oschina/news.js @@ -1,13 +1,11 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const res = await axios({ method: 'get', url: 'https://www.oschina.net/news/', headers: { - 'User-Agent': config.ua, Referer: 'https://www.oschina.net/news/', }, }); @@ -39,7 +37,6 @@ module.exports = async (ctx) => { method: 'get', url: item.link, headers: { - 'User-Agent': config.ua, Referer: item.link, }, }); diff --git a/routes/panda/room.js b/routes/panda/room.js index d10bfa566c..2f9f21b137 100644 --- a/routes/panda/room.js +++ b/routes/panda/room.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: `http://www.panda.tv/api_room?roomid=${id}`, headers: { - 'User-Agent': config.ua, Referer: `https://www.panda.tv/${id}`, }, }); diff --git a/routes/pigtails/index.js b/routes/pigtails/index.js index d3d9f1f67b..b02ca39d74 100644 --- a/routes/pigtails/index.js +++ b/routes/pigtails/index.js @@ -1,4 +1,3 @@ -const config = require('../../config'); const cheerio = require('cheerio'); const axios = require('../../utils/axios'); @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: base_url, headers: { - 'User-Agent': config.ua, Referer: base_url, }, }); diff --git a/routes/pku/eecs.js b/routes/pku/eecs.js index 5a9a23fb2f..e98d141f8b 100644 --- a/routes/pku/eecs.js +++ b/routes/pku/eecs.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const host = 'http://eecs.pku.edu.cn/'; @@ -14,7 +13,6 @@ module.exports = async (ctx) => { method: 'get', url: host + 'Survey/Notice/?Mtitle=' + type, headers: { - 'User-Agent': config.ua, Referer: host, }, }); diff --git a/routes/qcloud/mlvb/changelog.js b/routes/qcloud/mlvb/changelog.js index eb7c47514f..119d5edd23 100644 --- a/routes/qcloud/mlvb/changelog.js +++ b/routes/qcloud/mlvb/changelog.js @@ -1,6 +1,5 @@ const axios = require('../../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../../config'); module.exports = async (ctx) => { const url = 'https://cloud.tencent.com/document/product/454/7878'; @@ -8,9 +7,6 @@ module.exports = async (ctx) => { const res = await axios({ method: 'get', url: url, - headers: { - 'User-Agent': config.ua, - }, }); const data = res.data; const $ = cheerio.load(data); diff --git a/routes/qidian/chapter.js b/routes/qidian/chapter.js index 780a10f987..84c1cf61e6 100644 --- a/routes/qidian/chapter.js +++ b/routes/qidian/chapter.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -8,9 +7,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: `https://book.qidian.com/info/${id}#Catalog`, - headers: { - 'User-Agent': config.ua, - }, }); const $ = cheerio.load(response.data); @@ -22,9 +18,6 @@ module.exports = async (ctx) => { const chapters_response = await axios({ method: 'get', url: `https://book.qidian.com/ajax/book/category?${csrfToken}&bookId=${id}`, - headers: { - 'User-Agent': config.ua, - }, }); const chapter_item = []; diff --git a/routes/qidian/forum.js b/routes/qidian/forum.js index 890d7e453c..ce5073142b 100644 --- a/routes/qidian/forum.js +++ b/routes/qidian/forum.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const parseDate = require('../../utils/date'); module.exports = async (ctx) => { @@ -12,7 +11,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: `https://book.qidian.com/info/${id}`, }, }); diff --git a/routes/readhub/category.js b/routes/readhub/category.js index 2bb6de3b15..e2e081ec92 100644 --- a/routes/readhub/category.js +++ b/routes/readhub/category.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const category = ctx.params.category; @@ -25,9 +24,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: `https://api.readhub.me/${category}`, - headers: { - 'User-Agent': config.ua, - }, }); const data = response.data; diff --git a/routes/rsshub/rss.js b/routes/rsshub/rss.js index 8a88a948b8..ce7cfb5a3b 100644 --- a/routes/rsshub/rss.js +++ b/routes/rsshub/rss.js @@ -1,13 +1,11 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const response = await axios({ method: 'get', url: 'https://github.com/DIYgod/RSSHub/releases.atom', headers: { - 'User-Agent': config.ua, Referer: 'https://github.com/DIYgod/RSSHub', }, }); diff --git a/routes/scnu/cs/match.js b/routes/scnu/cs/match.js index 031f5a576a..ad540fff8b 100644 --- a/routes/scnu/cs/match.js +++ b/routes/scnu/cs/match.js @@ -1,13 +1,11 @@ const axios = require('../../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../../config'); module.exports = async (ctx) => { const res = await axios({ method: 'get', url: 'https://cs.scnu.edu.cn/xueshenggongzuo/chengchangfazhan/kejichuangxin/', headers: { - 'User-Agent': config.ua, Referer: 'https://cs.scnu.edu.cn', }, }); diff --git a/routes/scnu/jw.js b/routes/scnu/jw.js index 4e2760f02f..9346474d15 100644 --- a/routes/scnu/jw.js +++ b/routes/scnu/jw.js @@ -1,13 +1,11 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const res = await axios({ method: 'get', url: 'https://jw.scnu.edu.cn/ann/index.html', headers: { - 'User-Agent': config.ua, Referer: 'https://jw.scnu.edu.cn', }, }); diff --git a/routes/scnu/library.js b/routes/scnu/library.js index f54bd3d21a..e0c06866f0 100644 --- a/routes/scnu/library.js +++ b/routes/scnu/library.js @@ -1,13 +1,11 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const res = await axios({ method: 'get', url: 'https://lib.scnu.edu.cn/news/zuixingonggao', headers: { - 'User-Agent': config.ua, Referer: 'https://lib.scnu.edu.cn', }, }); diff --git a/routes/shmtu/events.js b/routes/shmtu/events.js index ae23878d4b..1295dcf58e 100644 --- a/routes/shmtu/events.js +++ b/routes/shmtu/events.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const host = 'http://www.shmtu.edu.cn'; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: host + '/events', headers: { - 'User-Agent': config.ua, Referer: host, }, }); diff --git a/routes/shmtu/jwc.js b/routes/shmtu/jwc.js index 1e53793b70..03f3091557 100644 --- a/routes/shmtu/jwc.js +++ b/routes/shmtu/jwc.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const host = 'http://jwc.shmtu.edu.cn/Information/'; @@ -16,7 +15,6 @@ module.exports = async (ctx) => { method: 'get', url: host + `MoreInfo.aspx?type=${type}`, headers: { - 'User-Agent': config.ua, Referer: host, }, }); diff --git a/routes/shmtu/notes.js b/routes/shmtu/notes.js index 938fb9db6b..903525f508 100644 --- a/routes/shmtu/notes.js +++ b/routes/shmtu/notes.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const host = 'http://www.shmtu.edu.cn'; @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: host + '/notes', headers: { - 'User-Agent': config.ua, Referer: host, }, }); diff --git a/routes/smzdm/keyword.js b/routes/smzdm/keyword.js index 36569d41c0..46664de507 100644 --- a/routes/smzdm/keyword.js +++ b/routes/smzdm/keyword.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const formatPubDate = require('../../utils/date.js'); module.exports = async (ctx) => { @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'get', url: `http://search.smzdm.com/?c=home&s=${encodeURI(keyword)}&order=time&v=b`, headers: { - 'User-Agent': config.ua, Referer: `http://search.smzdm.com/?c=home&s=${encodeURI(keyword)}&order=time&v=b`, }, }); diff --git a/routes/smzdm/ranking.js b/routes/smzdm/ranking.js index 71099b01a0..318177fd69 100644 --- a/routes/smzdm/ranking.js +++ b/routes/smzdm/ranking.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const { rank_type, rank_id, hour } = ctx.params; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://www.smzdm.com/top/json_more?rank_type=${rank_type}&rank_id=${rank_id}&hour=${hour}`, headers: { - 'User-Agent': config.ua, Referer: 'https://www.smzdm.com/top/', }, }); diff --git a/routes/swust/cs.js b/routes/swust/cs.js index 687006f245..3384cb6a7a 100644 --- a/routes/swust/cs.js +++ b/routes/swust/cs.js @@ -1,12 +1,10 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const host = 'http://www.cs.swust.edu.cn/'; module.exports = async (ctx) => { const axios_ins = axios.create({ headers: { - 'User-Agent': config.ua, Referer: host, }, responseType: 'arraybuffer', diff --git a/routes/swust/jwc.js b/routes/swust/jwc.js index e55b77eec3..70dea14454 100644 --- a/routes/swust/jwc.js +++ b/routes/swust/jwc.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const host = 'http://www.dean.swust.edu.cn'; @@ -21,7 +20,6 @@ module.exports = async (ctx) => { method: 'get', url: web, headers: { - 'User-Agent': config.ua, Referer: host, }, }); diff --git a/routes/t66y/index.js b/routes/t66y/index.js index 686b61e906..d5ab72dc1b 100644 --- a/routes/t66y/index.js +++ b/routes/t66y/index.js @@ -1,5 +1,4 @@ const cheerio = require('cheerio'); -const config = require('../../config'); const axios = require('../../utils/axios'); const iconv = require('iconv-lite'); const url = require('url'); @@ -8,7 +7,6 @@ const base = 'http://www.t66y.com'; const section = 'thread0806.php?fid='; const axios_ins = axios.create({ headers: { - 'User-Agent': config.ua, Referer: base, }, responseType: 'arraybuffer', diff --git a/routes/tieba/forum.js b/routes/tieba/forum.js index ba003fd388..dba8861cf2 100644 --- a/routes/tieba/forum.js +++ b/routes/tieba/forum.js @@ -1,7 +1,6 @@ const cheerio = require('cheerio'); const qs = require('querystring'); const axios = require('../../utils/axios'); -const config = require('../../config'); function isNormalTime(time) { return /^(\d{2}):(\d{2})$/.test(time); @@ -44,7 +43,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://tieba.baidu.com/f?${qs.stringify(params)}`, headers: { - 'User-Agent': config.ua, Referer: 'https://tieba.baidu.com/', }, }); diff --git a/routes/tingshuitz/dalian.js b/routes/tingshuitz/dalian.js index 1122fe3c1c..6b374f2c7b 100644 --- a/routes/tingshuitz/dalian.js +++ b/routes/tingshuitz/dalian.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { // const area = ctx.params.area; @@ -8,9 +7,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: url, - headers: { - 'User-Agent': config.ua, - }, }); const data = response.data; diff --git a/routes/tingshuitz/hangzhou.js b/routes/tingshuitz/hangzhou.js index 4844ff21b0..9783cd342b 100644 --- a/routes/tingshuitz/hangzhou.js +++ b/routes/tingshuitz/hangzhou.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { // const area = ctx.params.area; @@ -8,9 +7,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: url, - headers: { - 'User-Agent': config.ua, - }, }); const data = response.data; diff --git a/routes/tingshuitz/xiaoshan.js b/routes/tingshuitz/xiaoshan.js index 8cee37a96c..61c62ff590 100644 --- a/routes/tingshuitz/xiaoshan.js +++ b/routes/tingshuitz/xiaoshan.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { // const area = ctx.params.area; @@ -8,9 +7,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: url, - headers: { - 'User-Agent': config.ua, - }, }); const data = response.data; diff --git a/routes/toutiao/today.js b/routes/toutiao/today.js index cddc3f2041..4b54f8c3b8 100644 --- a/routes/toutiao/today.js +++ b/routes/toutiao/today.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const baseUrl = 'https://toutiao.io'; module.exports = async (ctx) => { @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: baseUrl, headers: { - 'User-Agent': config.ua, Host: 'toutiao.io', }, responseType: 'text', diff --git a/routes/toutiao/user.js b/routes/toutiao/user.js index 678da62c07..c95891465c 100644 --- a/routes/toutiao/user.js +++ b/routes/toutiao/user.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const baseUrl = 'https://toutiao.io'; module.exports = async (ctx) => { @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'get', url: requestUrl, headers: { - 'User-Agent': config.ua, Host: 'toutiao.io', }, responseType: 'text', diff --git a/routes/tucaoqq/post.js b/routes/tucaoqq/post.js index 627139000d..4fba11fa10 100644 --- a/routes/tucaoqq/post.js +++ b/routes/tucaoqq/post.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const md5 = require('../../utils/md5'); module.exports = async (ctx) => { @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://support.qq.com/api/v1/${projectID}/posts`, headers: { - 'User-Agent': config.ua, Timestamp: Math.round(+new Date() / 1000).toString(), Signature: md5(Math.round(+new Date() / 1000).toString() + key), }, diff --git a/routes/tuicool/mags.js b/routes/tuicool/mags.js index ae58caf30b..e81c9b0529 100755 --- a/routes/tuicool/mags.js +++ b/routes/tuicool/mags.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); module.exports = async (ctx) => { const type = ctx.params.type; @@ -11,9 +10,6 @@ module.exports = async (ctx) => { const res = await axios({ method: 'get', url: url, - headers: { - 'User-Agent': config.ua, - }, }); url = 'https://www.tuicool.com' + @@ -24,9 +20,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: url, - headers: { - 'User-Agent': config.ua, - }, }); const $ = cheerio.load(response.data); diff --git a/routes/uukanshu/chapter.js b/routes/uukanshu/chapter.js index 16d68add81..1189e63a89 100644 --- a/routes/uukanshu/chapter.js +++ b/routes/uukanshu/chapter.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const iconv = require('iconv-lite'); module.exports = async (ctx) => { @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'post', url: `https://www.uukanshu.com/b/${uid}`, headers: { - 'User-Agent': config.ua, Referer: 'https://www.uukanshu.com/b/${uid}', }, responseType: 'arraybuffer', diff --git a/routes/v2ex/topics.js b/routes/v2ex/topics.js index 75e4b9f2b6..834221cb36 100644 --- a/routes/v2ex/topics.js +++ b/routes/v2ex/topics.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const type = ctx.params.type; @@ -7,9 +6,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: `https://www.v2ex.com/api/topics/${type}.json`, - headers: { - 'User-Agent': config.ua, - }, }); const data = response.data; diff --git a/routes/wechat/wasi.js b/routes/wechat/wasi.js index e629cabf2e..d4463e814c 100644 --- a/routes/wechat/wasi.js +++ b/routes/wechat/wasi.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -8,7 +7,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://q.qnmlgb.tech/w/api/articles?_ls=&_fmt=authorSimple&_page=author&_author_id=${id}&_sub_tab=&_tab=author`, headers: { - 'User-Agent': config.ua, Referer: `https://w.qnmlgb.tech/authors/${id}/`, }, }); diff --git a/routes/weibo/keyword.js b/routes/weibo/keyword.js index 8591995c30..f8853c2e7d 100644 --- a/routes/weibo/keyword.js +++ b/routes/weibo/keyword.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const weiboUtils = require('./utils'); module.exports = async (ctx) => { @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://m.weibo.cn/api/container/getIndex?containerid=100103type%3D61%26q%3D${encodeURIComponent(keyword)}%26t%3D0`, headers: { - 'User-Agent': config.ua, Referer: `https://m.weibo.cn/p/searchall?containerid=100103type%3D1%26q%3D${encodeURIComponent(keyword)}`, }, }); diff --git a/routes/weibo/user.js b/routes/weibo/user.js index fd0956ed0f..d7d49cdb43 100644 --- a/routes/weibo/user.js +++ b/routes/weibo/user.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const weiboUtils = require('./utils'); module.exports = async (ctx) => { @@ -9,7 +8,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://m.weibo.cn/api/container/getIndex?type=uid&value=${uid}`, headers: { - 'User-Agent': config.ua, Referer: 'https://m.weibo.cn/', }, }); @@ -20,7 +18,6 @@ module.exports = async (ctx) => { method: 'get', url: `https://m.weibo.cn/api/container/getIndex?type=uid&value=${uid}&containerid=${containerid}`, headers: { - 'User-Agent': config.ua, Referer: `https://m.weibo.cn/u/${uid}`, }, }); diff --git a/routes/weibo/user2.js b/routes/weibo/user2.js index 916091788e..7ec5aae330 100644 --- a/routes/weibo/user2.js +++ b/routes/weibo/user2.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const weiboUtils = require('./utils'); module.exports = async (ctx) => { @@ -10,7 +9,6 @@ module.exports = async (ctx) => { method: 'get', url: `http://service.weibo.com/widget/widget_blog.php?uid=${uid}`, headers: { - 'User-Agent': config.ua, Referer: `http://service.weibo.com/widget/widget_blog.php?uid=${uid}`, }, }); diff --git a/routes/wikipedia/mainland.js b/routes/wikipedia/mainland.js index f84560fe40..6cad536773 100644 --- a/routes/wikipedia/mainland.js +++ b/routes/wikipedia/mainland.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const cheerio = require('cheerio'); module.exports = async (ctx) => { @@ -8,9 +7,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url, - headers: { - 'User-Agent': config.ua, - }, }); const $ = cheerio.load(response.data); diff --git a/routes/ximalaya/album.js b/routes/ximalaya/album.js index 2b6e832bcd..7a18efe321 100644 --- a/routes/ximalaya/album.js +++ b/routes/ximalaya/album.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const cheerio = require('cheerio'); -const config = require('../../config'); const formatPubDate = require('../../utils/date.js'); const baseUrl = 'http://www.ximalaya.com'; @@ -12,7 +11,6 @@ module.exports = async (ctx) => { method: 'get', url: `${apiUrl}`, headers: { - 'User-Agent': config.ua, Host: 'www.ximalaya.com', Referer: `${baseUrl}/${classify}/${id}`, }, @@ -21,7 +19,6 @@ module.exports = async (ctx) => { method: 'get', url: `${baseUrl}/${classify}/${id}`, headers: { - 'User-Agent': config.ua, Host: 'www.ximalaya.com', Referer: `${baseUrl}/${classify}/${id}`, }, diff --git a/routes/xueqiu/favorite.js b/routes/xueqiu/favorite.js index b9970fa93e..9d66fcc0dc 100644 --- a/routes/xueqiu/favorite.js +++ b/routes/xueqiu/favorite.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -7,9 +6,6 @@ module.exports = async (ctx) => { const res1 = await axios({ method: 'get', url: 'https://xueqiu.com/', - header: { - 'User-Agent': config.ua, - }, }); const token = res1.headers['set-cookie'].find((s) => s.startsWith('xq_a_token=')).split(';')[0]; @@ -20,7 +16,6 @@ module.exports = async (ctx) => { userid: id, }, headers: { - 'User-Agent': config.ua, Cookie: token, Referer: `https://xueqiu.com/u/${id}`, }, diff --git a/routes/xueqiu/user.js b/routes/xueqiu/user.js index 74a5625c12..a94942a13f 100644 --- a/routes/xueqiu/user.js +++ b/routes/xueqiu/user.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const id = ctx.params.id; @@ -17,9 +16,6 @@ module.exports = async (ctx) => { const res1 = await axios({ method: 'get', url: 'https://xueqiu.com/', - header: { - 'User-Agent': config.ua, - }, }); const token = res1.headers['set-cookie'].find((s) => s.startsWith('xq_a_token=')).split(';')[0]; @@ -32,7 +28,6 @@ module.exports = async (ctx) => { source: source, }, headers: { - 'User-Agent': config.ua, Cookie: token, Referer: `https://xueqiu.com/u/${id}`, }, diff --git a/routes/yande.re/post_popular_recent.js b/routes/yande.re/post_popular_recent.js index 87398c5fcd..8aba31732f 100644 --- a/routes/yande.re/post_popular_recent.js +++ b/routes/yande.re/post_popular_recent.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); module.exports = async (ctx) => { const { period = '1d' } = ctx.params; @@ -7,9 +6,6 @@ module.exports = async (ctx) => { const response = await axios({ method: 'get', url: 'https://yande.re/post/popular_recent.json', - headers: { - 'User-Agent': config.ua, - }, params: { period, }, diff --git a/routes/zhihu/daily.js b/routes/zhihu/daily.js index f0c1fcdd6f..cbddf04e9d 100644 --- a/routes/zhihu/daily.js +++ b/routes/zhihu/daily.js @@ -1,5 +1,4 @@ const axios = require('../../utils/axios'); -const config = require('../../config'); const utils = require('./utils'); // 参考:https://github.com/izzyleung/ZhihuDailyPurify/wiki/%E7%9F%A5%E4%B9%8E%E6%97%A5%E6%8A%A5-API-%E5%88%86%E6%9E%90 @@ -34,7 +33,6 @@ module.exports = async (ctx) => { method: 'get', url: url, headers: { - 'User-Agent': config.ua, Referer: url, }, }); diff --git a/routes/zhihu/utils.js b/routes/zhihu/utils.js index 818682bbbc..b4b35c56c2 100644 --- a/routes/zhihu/utils.js +++ b/routes/zhihu/utils.js @@ -1,8 +1,5 @@ -const config = require('../../config'); - module.exports = { header: { - 'User-Agent': config.ua, 'x-api-version': '3.0.40', 'x-udid': 'AMAiMrPqqQ2PTnOxAr5M71LCh-dIQ8kkYvw=', }, diff --git a/routes/ziroom/room.js b/routes/ziroom/room.js index 822b94f88d..f0b767270c 100644 --- a/routes/ziroom/room.js +++ b/routes/ziroom/room.js @@ -1,6 +1,5 @@ const axios = require('../../utils/axios'); const qs = require('querystring'); -const config = require('../../config'); module.exports = async (ctx) => { const city = ctx.params.city || 'sh'; @@ -13,7 +12,6 @@ module.exports = async (ctx) => { method: 'post', url: `http://${domain}/list/ajax-get-data`, headers: { - 'User-Agent': config.ua, Referer: `http://${domain}/${city.toUpperCase()}/search.html`, }, data: qs.stringify({