MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / fetchGraphQl

Function fetchGraphQl

scripts/fb_GLOBAL.js:597–620  ·  view source on GitHub ↗
(params, fb_dtsg)

Source from the content-addressed store, hash-verified

595}
596
597export async function fetchGraphQl(params, fb_dtsg) {
598 let form;
599 if (typeof params === "string")
600 form =
601 "fb_dtsg=" +
602 encodeURIComponent(fb_dtsg) +
603 "&q=" +
604 encodeURIComponent(params);
605 else
606 form = wrapGraphQlParams({
607 fb_dtsg,
608 ...params,
609 });
610
611 let res = await fetch("https://www.facebook.com/api/graphql/", {
612 body: form,
613 method: "POST",
614 headers: { "Content-Type": "application/x-www-form-urlencoded" },
615 credentials: "include",
616 });
617
618 let json = await res.text();
619 return json;
620}
621export function decodeArrId(arrId) {
622 return arrId[0] * 4294967296 + arrId[1];
623}

Callers 2

searchUserFunction · 0.70
messagesCountFunction · 0.70

Calls 1

wrapGraphQlParamsFunction · 0.70

Tested by

no test coverage detected