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

Function searchPageForOther

scripts/fb_GLOBAL.js:399–448  ·  view source on GitHub ↗
(other_uid, cursor, uid, fb_dtsg)

Source from the content-addressed store, hash-verified

397 });
398}
399export async function searchPageForOther(other_uid, cursor, uid, fb_dtsg) {
400 let variables = JSON.stringify({
401 count: 8,
402 scale: 1,
403 cursor: cursor ?? null,
404 id: btoa(`app_collection:${other_uid}:2409997254:96`),
405 });
406
407 let f = new URLSearchParams();
408 f.append("__user", uid);
409 f.append("__a", 1);
410 f.append("dpr", 1);
411 f.append("fb_dtsg", fb_dtsg);
412 f.append("fb_api_caller_class", "RelayModern");
413 f.append(
414 "fb_api_req_friendly_name",
415 "ProfileCometAppCollectionGridRendererPaginationQuery"
416 );
417 f.append("variables", variables);
418 f.append("doc_id", 2983410188445167);
419
420 try {
421 let res = await fetch("https://www.facebook.com/api/graphql/", {
422 method: "POST",
423 body: f,
424 });
425
426 let json = await res.json();
427 let { items } = json.data.node;
428 return {
429 nextCursor: items.page_info.end_cursor,
430 data: items.edges.map((e) => ({
431 id: e.node.node?.id || btoa(e.node.id).split(":").at(-1),
432 name: e.node.title.text,
433 subTitle: e.node.subtitle_text?.text,
434 url: e.node.url,
435 image: e.node.image.uri,
436 cursor: e.cursor,
437 })),
438 totalCount: items.count,
439 };
440 } catch (e) {
441 console.log("ERROR fetch page", e);
442 return {
443 nextCursor: null,
444 data: [],
445 totalCount: 0,
446 };
447 }
448}
449export async function searchAllPageForOther(
450 other_uid,
451 uid,

Callers 1

searchAllPageForOtherFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected