(url)
| 96 | }; |
| 97 | } |
| 98 | export 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 | } |
| 122 | export async function searchUser(keyword, exact_match = true) { |
| 123 | const res = await fetchGraphQl( |
| 124 | { |
no test coverage detected