MCPcopy Create free account
hub / github.com/Semporia/Scripts / getAuthorShareCode

Function getAuthorShareCode

jd_cfd.js:1094–1125  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

1092}
1093
1094function getAuthorShareCode(url) {
1095 return new Promise(async resolve => {
1096 const options = {
1097 url: `${url}?${new Date()}`, "timeout": 10000, headers: {
1098 "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88"
1099 }
1100 };
1101 if ($.isNode() && process.env.TG_PROXY_HOST && process.env.TG_PROXY_PORT) {
1102 const tunnel = require("tunnel");
1103 const agent = {
1104 https: tunnel.httpsOverHttp({
1105 proxy: {
1106 host: process.env.TG_PROXY_HOST,
1107 port: process.env.TG_PROXY_PORT * 1
1108 }
1109 })
1110 }
1111 Object.assign(options, { agent })
1112 }
1113 $.get(options, async (err, resp, data) => {
1114 try {
1115 resolve(JSON.parse(data))
1116 } catch (e) {
1117 // $.logErr(e, resp)
1118 } finally {
1119 resolve();
1120 }
1121 })
1122 await $.wait(10000)
1123 resolve();
1124 })
1125}
1126
1127function setMark() {
1128 return new Promise(resolve => {

Callers

nothing calls this directly

Calls 3

isNodeMethod · 0.45
getMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected