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

Function getUserInfoFromUid

scripts/fb_GLOBAL.js:32–68  ·  view source on GitHub ↗
(uid)

Source from the content-addressed store, hash-verified

30 return null;
31}
32export async function getUserInfoFromUid(uid) {
33 const variables = {
34 userID: uid,
35 shouldDeferProfilePic: false,
36 useVNextHeader: false,
37 scale: 1.5,
38 };
39 let f = new URLSearchParams();
40 f.append("fb_dtsg", await getFbdtsg());
41 f.append("fb_api_req_friendly_name", "ProfileCometHeaderQuery");
42 f.append("variables", JSON.stringify(variables));
43 f.append("doc_id", "4159355184147969");
44
45 let res = await fetch("https://www.facebook.com/api/graphql/", {
46 method: "POST",
47 headers: { "content-type": "application/x-www-form-urlencoded" },
48 body: f,
49 });
50
51 let text = await res.text();
52 return {
53 uid: uid,
54 name: UfsGlobal.DEBUG.decodeEscapedUnicodeString(
55 /"name":"(.*?)"/.exec(text)?.[1]
56 ),
57 avatar: UfsGlobal.DEBUG.decodeEscapedUnicodeString(
58 /"profilePicLarge":{"uri":"(.*?)"/.exec(text)?.[1] ||
59 /"profilePicMedium":{"uri":"(.*?)"/.exec(text)?.[1] ||
60 /"profilePicSmall":{"uri":"(.*?)"/.exec(text)?.[1] ||
61 /"profilePic160":{"uri":"(.*?)"/.exec(text)?.[1]
62 ),
63 gender: /"gender":"(.*?)"/.exec(text)?.[1],
64 alternateName: UfsGlobal.DEBUG.decodeEscapedUnicodeString(
65 /"alternate_name":"(.*?)"/.exec(text)?.[1]
66 ),
67 };
68}
69export async function getUserInfo_(uid, access_token) {
70 let fields = [
71 "birthday",

Callers 3

fb_whoIsTyping.jsFile · 0.90

Calls 2

getFbdtsgFunction · 0.70
execMethod · 0.45

Tested by

no test coverage detected