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

Function getUidFromUrl

scripts/fb_GLOBAL.js:98–121  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

96 };
97}
98export async function getUidFromUrl(url) {
99 let methods = [
100 () => require("CometRouteStore").getRoute(url).rootView.props.userID,
101 async () => {
102 let response = await fetch(url);
103 if (response.status == 200) {
104 let text = await response.text();
105 let uid = /(?<="userID":")(.\d+?)(?=")/.exec(text);
106 if (uid?.length) {
107 return uid[0];
108 }
109 }
110 return null;
111 },
112 ];
113
114 for (let m of methods) {
115 try {
116 let uid = await m();
117 if (uid) return uid;
118 } catch (e) {}
119 }
120 return null;
121}
122export async function searchUser(keyword, exact_match = true) {
123 const res = await fetchGraphQl(
124 {

Calls 2

mFunction · 0.50
execMethod · 0.45

Tested by

no test coverage detected