MCPcopy Create free account
hub / github.com/ClydeTime/Surge / share

Function share

Script/Task/BiliBili.js:407–455  ·  view source on GitHub ↗
(aid, cid, short_link)

Source from the content-addressed store, hash-verified

405}
406
407async function share(aid, cid, short_link) {
408 $.log("2️⃣ 分享任务")
409 if (check("share")) {
410 $.log("- 正在分享, aid=" + aid)
411 const body = {
412 access_key: config.key.replace(/&actionKey=.*?&appkey=.*$/, ''),
413 actionKey: 'appkey',
414 appkey: '27eb53fc9058f8c3',
415 build: '72700100',
416 c_locale: 'zh-Hans_CN',
417 device: 'phone',
418 disable_rcmd: 0,
419 link: short_link,
420 mobi_app: 'iphone',
421 object_extra_fields: '%7B%7D',
422 oid: aid,
423 panel_type: 1,
424 platform: 'ios',
425 s_locale:'zh-Hans_CN',
426 share_channel: 'WEIXIN',
427 share_id: 'main.ugc-video-detail.0.0.pv',
428 share_origin: 'vinfo_share',
429 sid: cid,
430 spm_id: 'main.ugc-video-detail.0.0',
431 statistics: '%7B%22appId%22%3A1%2C%22version%22%3A%227.27.0%22%2C%22abtest%22%3A%22%22%2C%22platform%22%3A1%7D',
432 success: 1,
433 ts: $.getTimestamp()
434 }
435 const sign = md5($.queryStr(body) + 'c2ed53a74eeefe3cf99fbd01d8c9c375')
436 body['sign'] = sign
437 const myRequest = {
438 url: 'https://api.bilibili.com/x/share/finish',
439 headers: {},
440 body: $.queryStr(Object.fromEntries(new Map(Array.from(Object.entries(body)).sort())))
441 }
442 await $.fetch(myRequest).then(response => {
443 const body = $.toObj(response.body)
444 if (body?.code === 0) {
445 config.share.num = (config.share.num || 0) + 1
446 $.log("- 分享成功")
447 $.setItem($.name + "_daily_bonus", $.toStr(config))
448 } else {
449 $.log("- 分享失败, 失败原因: " + body?.message)
450 }
451 })
452 } else {
453 $.log(`- 今日已经分享 ${config.share.time}`)
454 }
455}
456
457async function coin() {
458 if (config.coins.num >= 50) {

Callers 1

signBiliBiliFunction · 0.70

Calls 10

checkFunction · 0.70
md5Function · 0.70
logMethod · 0.45
getTimestampMethod · 0.45
queryStrMethod · 0.45
fromMethod · 0.45
fetchMethod · 0.45
toObjMethod · 0.45
setItemMethod · 0.45
toStrMethod · 0.45

Tested by

no test coverage detected