(other_uid, cursor, uid, fb_dtsg)
| 495 | ); |
| 496 | } |
| 497 | export async function searchGroupForOther(other_uid, cursor, uid, fb_dtsg) { |
| 498 | let variables = JSON.stringify({ |
| 499 | count: 8, |
| 500 | cursor: cursor ?? null, |
| 501 | id: btoa(`app_collection:${other_uid}:2361831622:66`), |
| 502 | }); |
| 503 | |
| 504 | let f = new URLSearchParams(); |
| 505 | f.append("__user", uid); |
| 506 | f.append("__a", 1); |
| 507 | f.append("dpr", 1); |
| 508 | f.append("fb_dtsg", fb_dtsg); |
| 509 | f.append("fb_api_caller_class", "RelayModern"); |
| 510 | f.append( |
| 511 | "fb_api_req_friendly_name", |
| 512 | "ProfileCometAppCollectionGridRendererPaginationQuery" |
| 513 | ); |
| 514 | f.append("variables", variables); |
| 515 | f.append("doc_id", 5244211935648733); |
| 516 | |
| 517 | try { |
| 518 | let res = await fetch("https://www.facebook.com/api/graphql/", { |
| 519 | method: "POST", |
| 520 | body: f, |
| 521 | }); |
| 522 | |
| 523 | let json = await res.json(); |
| 524 | let { pageItems } = json.data.node; |
| 525 | return { |
| 526 | nextCursor: pageItems.page_info.end_cursor, |
| 527 | data: pageItems.edges.map((e) => ({ |
| 528 | id: e.node.node?.id || btoa(e.node.id).split(":").at(-1), |
| 529 | title: e.node.title.text, |
| 530 | subTitle: e.node.subtitle_text?.text, |
| 531 | url: e.node.url, |
| 532 | visibility: e.node.node.visibility, |
| 533 | image: e.node.image.uri, |
| 534 | membersCount: Number( |
| 535 | // e.node.node.forum_member_profiles.formatted_count_text || |
| 536 | // e.node.node.group_member_profiles.formatted_count_text |
| 537 | (e.node.subtitle_text.text.split("\n")?.[0] || "") |
| 538 | .match(/\d+/g) |
| 539 | .join("") ?? 1 |
| 540 | ), |
| 541 | cursor: e.cursor, |
| 542 | })), |
| 543 | }; |
| 544 | } catch (e) { |
| 545 | console.log("ERROR fetch page", e); |
| 546 | return { |
| 547 | nextCursor: null, |
| 548 | data: [], |
| 549 | }; |
| 550 | } |
| 551 | } |
| 552 | export async function searchAllGroupForOther( |
| 553 | other_uid, |
| 554 | uid, |
no outgoing calls
no test coverage detected