sj-api.js
535 Bytes
const md5 = require('yoho-md5');
const rp = require('request-promise');
const userKey = '7fe2d9ada6-MWI5NWUyM2';
const user_secret = 'M3ZmUyZDlhZGE2NT-523cdf23981b95e';
const source_id = 737210;
module.exports = (query) => {
const timestamp = parseInt(Date.now() / 1000, 10);
const sign = md5(`${userKey}${timestamp}${user_secret}`);
return rp({
url: `https://graphql.shenjian.io/?user_key=${userKey}×tamp=${timestamp}&sign=${sign}&source_id=${source_id}&query=${encodeURIComponent(query)}`,
json: true
});
};