商品_行业洞察_市场构成

云图扩展工具

  1. // ==UserScript==
  2. // @name 商品_行业洞察_市场构成
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description 云图扩展工具
  6. // @author siji-Xian
  7. // @match *://yuntu.oceanengine.com/yuntu_brand/product/industry/marketAweme?*
  8. // @icon https://lf3-static.bytednsdoc.com/obj/eden-cn/prhaeh7pxvhn/yuntu/yuntu-logo_default.svg
  9. // @grant none
  10. // @license MIT
  11. // @require https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.2.1/jquery.min.js
  12. // @require https://cdn.bootcss.com/moment.js/2.20.1/moment.min.js
  13. // @require https://gf.qytechs.cn/scripts/404478-jsonexportexcel-min/code/JsonExportExcelmin.js?version=811266
  14. // @require https://gf.qytechs.cn/scripts/455576-qmsg/code/Qmsg.js?version=1122361
  15. // ==/UserScript==
  16.  
  17. (function () {
  18. "use strict";
  19. var new_element = document.createElement("link");
  20. new_element.setAttribute("rel", "stylesheet");
  21. new_element.setAttribute("href", "https://qmsg.refrain.xyz/message.min.css");
  22. document.body.appendChild(new_element);
  23.  
  24. const button = document.createElement("div");
  25. button.textContent = "导出数据";
  26. Object.assign(button.style, {
  27. height: "34px",
  28. lineHeight: "var(--line-height, 34px)",
  29. alignItems: "center",
  30. color: "#FFF",
  31. background: "linear-gradient(60deg, rgb(95, 240, 225), rgb(47, 132, 254))",
  32. borderRadius: "5px",
  33. margin: "0 10px",
  34. fontSize: "13px",
  35. padding: "0 10px",
  36. cursor: "pointer",
  37. fontWeight: "500",
  38. });
  39. button.addEventListener("click", urlClick);
  40.  
  41. let target_data = null;
  42.  
  43. (function listen() {
  44. var origin = {
  45. open: XMLHttpRequest.prototype.open,
  46. send: XMLHttpRequest.prototype.send,
  47. };
  48. XMLHttpRequest.prototype.open = function (a, b) {
  49. this.addEventListener("load", replaceFn);
  50. origin.open.apply(this, arguments);
  51. };
  52. XMLHttpRequest.prototype.send = function (a, b) {
  53. origin.send.apply(this, arguments);
  54. };
  55. function replaceFn(obj) {
  56. if (
  57. this?._url?.slice(0, 47) ==
  58. "/product_node/v2/api/industry/insightAwemeStats"
  59. ) {
  60. target_data = JSON.parse(obj?.target?.response);
  61. }
  62. }
  63. })();
  64.  
  65. //message.js
  66. let loadingMsg = null;
  67.  
  68. function appendDoc() {
  69. const likeComment = document.querySelector(
  70. ".right"
  71. );
  72. if (likeComment) {
  73. likeComment.append(button);
  74. return;
  75. }
  76. setTimeout(appendDoc, 1000);
  77. }
  78. appendDoc();
  79.  
  80. async function getData(e) {
  81. let body = e;
  82. let expData = body?.data?.list?.map((v) => {
  83. return {
  84. ...v.aweme,
  85. perUidOrderCnt: v.data.perUidOrderCnt.value,
  86. perUidPurchaseProductCnt: v.data.perUidPurchaseProductCnt.value,
  87. productAvgPrice: v.data.productAvgPrice.value,
  88. productCnt: v.data.productCnt.value,
  89. purchaseUidCnt: v.data.purchaseUidCnt.value,
  90. salesAmount: v.data.salesAmount.value,
  91. salesAmountRank: v.data.salesAmount.rank,
  92. salesVolune: v.data.salesVolune.value,
  93. };
  94. });
  95. expExcel(expData);
  96. }
  97.  
  98. function expExcel(e) {
  99. let contrast = {
  100. '排名': "salesAmountRank",
  101. '头像': "imageUrl",
  102. '名称': "name",
  103. '抖音号': "awemeId",
  104. '抖音号类型': "authorType",
  105. '主推类目': "liveMainCategory",
  106. "销售金额(指数)": "salesAmount",
  107. "销售量(指数)": "salesVolune",
  108. "购买人数(指数)": "purchaseUidCnt",
  109. "商品数(指数)": "productCnt",
  110. "人均购买频次(指数)": "perUidOrderCnt",
  111. "人均购买量(指数)": "perUidPurchaseProductCnt",
  112. };
  113. let fileName = "抖音号分析";
  114. let option = {};
  115. option.fileName = fileName; //文件名
  116. option.datas = [
  117. {
  118. sheetName: "",
  119. sheetData: e,
  120. sheetHeader: Object.keys(contrast),
  121. sheetFilter: Object.values(contrast),
  122. columnWidths: [], // 列宽
  123. },
  124. ];
  125. var toExcel = new ExportJsonExcel(option);
  126. toExcel.saveExcel();
  127. setTimeout(() => {
  128. loadingMsg.close();
  129. }, 1000);
  130. }
  131.  
  132. function urlClick() {
  133. if (target_data) {
  134. loadingMsg = Qmsg.loading("正在导出,请勿重复点击!");
  135. getData(target_data);
  136. } else {
  137. loadingMsg = Qmsg.error("数据加载失败,请重试");
  138. }
  139. }
  140. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址