fix: post type

This commit is contained in:
DIYgod 2019-06-04 18:28:06 +08:00
parent 218c06f96c
commit ea508b8bc2
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
28 changed files with 66 additions and 75 deletions

View File

@ -1,5 +1,4 @@
const got = require('@/utils/got');
const qs = require('querystring');
const iconv = require('iconv-lite');
const cheerio = require('cheerio');
@ -13,11 +12,11 @@ module.exports = {
url: 'https://space.bilibili.com/ajax/member/GetInfo',
headers: {
Referer: `https://space.bilibili.com/${uid}/`,
'Content-Type': 'application/x-www-form-urlencoded',
},
data: qs.stringify({
form: true,
data: {
mid: uid,
}),
},
});
name = nameResponse.data.data.name;
ctx.cache.set(key, name);

View File

@ -1,5 +1,4 @@
const got = require('@/utils/got');
const qs = require('querystring');
module.exports = async (ctx) => {
const region = ctx.params.region || 1;
@ -8,14 +7,12 @@ module.exports = async (ctx) => {
const response = await got({
method: 'post',
url: api,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
data: qs.stringify({
form: true,
data: {
region: region,
dateType: 2,
magnitude: 0,
}),
},
});
const data = response.data;

View File

@ -9,8 +9,8 @@ module.exports = async (ctx) => {
url: 'https://time.geekbang.org/serv/v1/column/intro',
headers: {
Referer: 'https://time.geekbang.org/',
'Content-Type': 'application/json',
},
json: true,
data: {
cid: column_id,
},
@ -24,8 +24,8 @@ module.exports = async (ctx) => {
url: 'https://time.geekbang.org/serv/v1/column/articles/latest',
headers: {
Referer: 'https://time.geekbang.org/',
'Content-Type': 'application/json',
},
json: true,
data: {
cid: column_id,
},

View File

@ -9,8 +9,8 @@ module.exports = async (ctx) => {
url: 'https://time.geekbang.org/serv/v1/column/intro',
headers: {
Referer: 'https://time.geekbang.org/',
'Content-Type': 'application/json',
},
json: true,
data: {
cid: column_id,
},
@ -24,8 +24,8 @@ module.exports = async (ctx) => {
url: 'https://time.geekbang.org/serv/v1/column/audios',
headers: {
Referer: 'https://time.geekbang.org/',
'Content-Type': 'application/json',
},
json: true,
data: {
cid: column_id,
},

View File

@ -13,6 +13,7 @@ module.exports = async (ctx) => {
headers: {
Authorization: `bearer ${config.github.access_token}`,
},
json: true,
data: {
query: `
{

View File

@ -14,6 +14,7 @@ module.exports = async (ctx) => {
headers: {
Authorization: `bearer ${config.github.access_token}`,
},
json: true,
data: {
query: `
{

View File

@ -1,5 +1,4 @@
const got = require('@/utils/got');
const qs = require('querystring');
module.exports = async (ctx) => {
const link = 'https://www.icourse163.org/category/all';
@ -13,16 +12,16 @@ module.exports = async (ctx) => {
method: 'post',
url: `https://www.icourse163.org/web/j/courseBean.getCoursePanelListByFrontCategory.rpc?csrfKey=${csrfKey}`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Cookie: `NTESSTUDYSI=${csrfKey};`,
},
data: qs.stringify({
form: true,
data: {
categoryId: -1,
type: 30,
orderBy: 10,
pageIndex: 1,
pageSize: 20,
}),
},
});
const items = response.data.result.result.map((item) => {

View File

@ -1,5 +1,4 @@
const got = require('@/utils/got');
const qs = require('querystring');
module.exports = async (ctx) => {
const category = ctx.params.category;
@ -12,11 +11,12 @@ module.exports = async (ctx) => {
headers: {
Referer: url,
},
form: true,
url: api_url,
data: qs.stringify({
data: {
pageNo: 1,
catid: `${category}`,
}),
},
});
const data = response.data;

View File

@ -10,8 +10,8 @@ module.exports = async (ctx) => {
url: apiUrl,
headers: {
Referer: pageUrl,
'Content-Type': 'application/json',
},
json: true,
data: {
size: 5,
},

View File

@ -12,8 +12,8 @@ module.exports = async (ctx) => {
url: infoUrl,
headers: {
Referer: pageUrl,
'Content-Type': 'application/json',
},
json: true,
data: {
id: paramId,
},
@ -26,8 +26,8 @@ module.exports = async (ctx) => {
url: apiUrl,
headers: {
Referer: pageUrl,
'Content-Type': 'application/json',
},
json: true,
data: {
size: 5,
type: type,

View File

@ -13,8 +13,8 @@ const ProcessFeed = async (list, cache) => {
url: detailUrl,
headers: {
Referer: link,
'Content-Type': 'application/json',
},
json: true,
data: {
uuid: uuid,
},

View File

@ -13,6 +13,7 @@ module.exports = async (ctx) => {
Referer: `https://m.okjike.com/topics/${id}`,
'App-Version': '4.12.0',
},
json: true,
data: {
loadMoreKey: null,
topic: id,

View File

@ -11,6 +11,7 @@ module.exports = async (ctx) => {
Referer: `https://m.okjike.com/topics/${id}`,
'App-Version': '4.12.0',
},
json: true,
data: {
loadMoreKey: null,
topicId: id,

View File

@ -12,6 +12,7 @@ module.exports = async (ctx) => {
Referer: `https://m.okjike.com/topics/${id}`,
'App-Version': '4.12.0',
},
json: true,
data: {
loadMoreKey: null,
topic: id,

View File

@ -11,6 +11,7 @@ module.exports = async (ctx) => {
'App-Version': '4.12.0',
platform: 'web',
},
json: true,
data: {
limit: 20,
loadMoreKey: null,

View File

@ -4,6 +4,7 @@ module.exports = async (ctx) => {
const response = await got({
method: 'post',
url: 'https://web-api.juejin.im/graphql',
json: true,
data: { operationName: '', query: '', variables: { size: 20, after: '', afterPosition: '' }, extensions: { query: { id: '964dab26a3f9997283d173b865509890' } } },
headers: {
'X-Agent': 'Juejin/Web',

View File

@ -1,6 +1,5 @@
const got = require('@/utils/got');
const parseDate = require('@/utils/date');
const qs = require('querystring');
module.exports = async (ctx) => {
const { id } = ctx.params;
@ -10,13 +9,13 @@ module.exports = async (ctx) => {
url: 'http://www.laosiji.com/api/hotShow/program',
headers: {
Referer: link,
'Content-Type': 'application/x-www-form-urlencoded',
},
data: qs.stringify({
form: true,
data: {
hotShowId: id,
sort: 1,
pageNo: 1,
}),
},
});
const data = response.data.body.hotshow;

View File

@ -5,6 +5,7 @@ module.exports = async (ctx) => {
const response = await got({
method: 'post',
url: 'https://server.matters.news/',
json: true,
data: {
operationName: 'NewestFeed',
variables: {

View File

@ -1,5 +1,4 @@
const got = require('@/utils/got');
const qs = require('querystring');
module.exports = async (ctx) => {
const id = ctx.params.id;
@ -9,13 +8,13 @@ module.exports = async (ctx) => {
url: 'http://music.163.com/api/dj/program/byradio',
headers: {
Referer: 'https://music.163.com/',
'Content-Type': 'application/x-www-form-urlencoded',
},
data: qs.stringify({
form: true,
data: {
radioId: id,
limit: 1000,
offset: 0,
}),
},
});
const programs = response.data.programs || [];

View File

@ -1,5 +1,4 @@
const got = require('@/utils/got');
const qs = require('querystring');
module.exports = async (ctx) => {
const id = ctx.params.id;
@ -9,11 +8,11 @@ module.exports = async (ctx) => {
url: 'https://music.163.com/api/v3/playlist/detail',
headers: {
Referer: 'https://music.163.com/',
'Content-Type': 'application/x-www-form-urlencoded',
},
data: qs.stringify({
form: true,
data: {
id: id,
}),
},
});
const data = response.data.playlist;

View File

@ -1,5 +1,4 @@
const got = require('@/utils/got');
const qs = require('querystring');
module.exports = async (ctx) => {
const uid = ctx.params.uid;
@ -9,13 +8,13 @@ module.exports = async (ctx) => {
url: 'http://music.163.com/api/user/playlist',
headers: {
Referer: 'https://music.163.com/',
'Content-Type': 'application/x-www-form-urlencoded',
},
data: qs.stringify({
form: true,
data: {
uid: uid,
limit: 1000,
offset: 0,
}),
},
});
const playlist = response.data.playlist || [];

View File

@ -1,21 +1,17 @@
const got = require('@/utils/got');
const qs = require('querystring');
module.exports = async (ctx) => {
const { fid } = ctx.params;
const gotInstance = got.extend({
baseURL: 'https://ngabbs.com/app_api.php',
const homePage = await got({
method: 'post',
url: 'https://ngabbs.com/app_api.php?__lib=subject&__act=list',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-User-Agent': 'NGA_skull/6.0.5(iPhone10,3;iOS 12.0.1)',
},
});
const homePage = await gotInstance.request({
method: 'post',
url: '?__lib=subject&__act=list',
data: qs.stringify({
form: true,
data: {
fid,
}),
},
});
const list = homePage.data.result.data.filter(({ tid }) => tid);
@ -31,12 +27,16 @@ module.exports = async (ctx) => {
};
const description = await ctx.cache.tryGet(`nga-forum: ${link}`, async () => {
const response = await gotInstance.request({
const response = await got({
method: 'post',
url: '?__lib=post&__act=list',
data: qs.stringify({
url: 'https://ngabbs.com/app_api.php?__lib=subject&__act=list?__lib=post&__act=list',
headers: {
'X-User-Agent': 'NGA_skull/6.0.5(iPhone10,3;iOS 12.0.1)',
},
form: true,
data: {
tid,
}),
},
});
return response.data.result[0].content;

View File

@ -4,6 +4,7 @@ module.exports = async (ctx) => {
const response = await got({
method: 'post',
url: `https://u3b6gr4ua3-dsn.algolia.net/1/indexes/*/queries?x-algolia-agent=Algolia%20for%20vanilla%20JavaScript%20(lite)%203.22.1%3BJS%20Helper%202.20.1&x-algolia-application-id=U3B6GR4UA3&x-algolia-api-key=9a20c93440cf63cf1a7008d75f7438bf`,
json: true,
data: {
requests: [
{

View File

@ -1,5 +1,4 @@
const got = require('@/utils/got');
const qs = require('querystring');
module.exports = async (ctx) => {
const { orgNo, provinceNo, scope = '', typeCode = '', lineName = '' } = ctx.params;
@ -14,10 +13,8 @@ module.exports = async (ctx) => {
const response = await got({
method: 'post',
url: 'http://www.95598.cn/95598/outageNotice/queryOutageNoticeList',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
data: qs.stringify({
form: true,
data: {
orgNo,
outageStartTime,
outageEndTime,
@ -26,7 +23,7 @@ module.exports = async (ctx) => {
typeCode,
lineName,
anHui,
}),
},
});
const items = (response.data.seleList || []).map((item) => {

View File

@ -1,7 +1,6 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const url = require('url');
const qs = require('querystring');
const baseUrl = 'http://jwc.scuteo.com/';
@ -21,14 +20,12 @@ module.exports = async (ctx) => {
const listResponse = await got({
method: 'post',
url: baseUrl + 'jiaowuchu/cms/category/index.do',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
data: qs.stringify({
form: true,
data: {
id: categoryData.id,
offset: 0,
pagesize: 20,
}),
},
});
const itemList = listResponse.data.results.splice(0, 10);

View File

@ -5,6 +5,7 @@ module.exports = async (ctx) => {
const response = await got({
method: 'post',
url: 'https://uapi.vip.qq.com/Api/api.brand.productssrf',
json: true,
data: {
page: 1,
per_page: 20,

View File

@ -1,5 +1,4 @@
const got = require('@/utils/got');
const qs = require('querystring');
module.exports = async (ctx) => {
const city = ctx.params.city || 'sh';
@ -14,14 +13,15 @@ module.exports = async (ctx) => {
headers: {
Referer: `http://${domain}/${city.toUpperCase()}/search.html`,
},
data: qs.stringify({
form: true,
data: {
recent_money: 0,
sort: 0,
is_whole: iswhole,
room: room,
key_word: keyword,
step: 0,
}),
},
});
let data = response.data.data; // 当查询的结果不存在时,该 data 是个对象 { info: '数据加载完毕' }
// 判断数据的类型,如果有数据就是数组类型的,没有数据的话,就赋值为空数组

View File

@ -79,11 +79,7 @@ const custom = got.extend({
(options) => {
// compatible with axios api
if (options.data) {
if (typeof options.data === 'object') {
options.json = options.json || options.data;
} else {
options.body = options.body || options.data;
}
options.body = options.body || options.data;
}
if (options.responseType === 'buffer') {
options.encoding = null;