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

Function getAuthorShareCode

jd_summer_movement_help.js:331–368  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

329
330
331function getAuthorShareCode(url) {
332 return new Promise(async resolve => {
333 const options = {
334 "url": `${url}?${new Date()}`,
335 "timeout": 10000,
336 "headers": {
337 "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"
338 }
339 };
340 if ($.isNode() && process.env.TG_PROXY_HOST && process.env.TG_PROXY_PORT) {
341 const tunnel = require("tunnel");
342 const agent = {
343 https: tunnel.httpsOverHttp({
344 proxy: {
345 host: process.env.TG_PROXY_HOST,
346 port: process.env.TG_PROXY_PORT * 1
347 }
348 })
349 }
350 Object.assign(options, { agent })
351 }
352 let res = []
353 $.get(options, async (err, resp, data) => {
354 try {
355 if (err) {
356 } else {
357 if (data) res = JSON.parse(data)
358 }
359 } catch (e) {
360 // $.logErr(e, resp)
361 } finally {
362 resolve(res || []);
363 }
364 })
365 await $.wait(10000)
366 resolve(res);
367 })
368}
369
370/**
371 * 随机从一数组里面取

Callers

nothing calls this directly

Calls 3

isNodeMethod · 0.45
getMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected