You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

45 lines
902 B

const fetch = require('node-fetch');
const graphql_endpoint = 'https://www.facebook.com/api/graphql/';
const https_proxy_agent = require('https-proxy-agent');
const do_request = async (doc_id, variables) => {
const params = new URLSearchParams();
const agent = new https_proxy_agent('http://10.0.0.210:5566');
params.append('doc_id', doc_id);
params.append('variables', JSON.stringify(variables));
const fetch_options = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: params,
method: 'POST',
agent,
};
let res = null;
try {
res = await fetch(graphql_endpoint, fetch_options);
} catch (e) {
console.error(e);
return null;
}
if (!res.ok) {
return null;
}
try {
res = await res.json();
} catch (e) {
console.error(e);
return null;
}
return res;
};
module.exports = {
do_request,
};