getAppInfo

getApp info and app images from app Market

  1. // ==UserScript==
  2. // @name getAppInfo
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2.2
  5. // @description getApp info and app images from app Market
  6. // @author WhiteCat
  7. // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
  8. // @require https://cdn.bootcss.com/camanjs/4.1.2/caman.full.min.js
  9. // @match *://sj.qq.com/myapp/detail*
  10. // @match *://cps.guopan.cn/tpls/gameManage.html*
  11. // @match *://www.wandoujia.com/apps*
  12. // @grant GM_download
  13. // @grant GM_setClipboard
  14. // ==/UserScript==
  15. (function() {
  16. 'use strict';
  17. //获取名字
  18. var appname;
  19. //获取版本
  20. var appversion;
  21. //获取大小
  22. var appsize;
  23. //获取appurl
  24. var appurl;
  25. //获取介绍
  26. var appmore;
  27. //获取appPic
  28. var appImgs = [];
  29. //logo
  30. var logourl;
  31. //imgs
  32. var imgs;
  33. var tail = ["内购破解版下载","破解版下载","下载",""]
  34.  
  35. // 添加按钮
  36. const copyall = addFloatButton('ALL', () => getAll())
  37. const copyinfo = addFloatButton('Info', () => getWDinfo())
  38. const copyimg = addFloatButton('Img', () => getAppImg())
  39. function addFloatButton (text, onclick) {
  40. if (!document.addFloatButton) {
  41. const buttonContainer = document.body.appendChild(document.createElement('div')).attachShadow({ mode: 'open' })
  42. buttonContainer.innerHTML = '<style>:host{position:fixed;top:3px;right:40px;z-index:2147483647;height:0}#i{display:none}*{float:left;margin:4px;padding:1em;outline:0;border:0;border-radius:5px;background:#1e88e500;box-shadow:0 1px 4px rgba(0,0,0,.1);color:#fff;font-size:14px;line-height:0;transition:.3s}:active{background:#42a5f5;box-shadow:0 2px 5px rgba(0,0,0,.2)}button:active{transition:0s}:checked~button{visibility:hidden;opacity:0;transform:translateY(-3em)}label{border-radius:50%}:checked~label{opacity:.3;transform:translateY(3em)}</style><input id=i type=checkbox><label for=i></label>'
  43. document.addFloatButton = (text, onclick) => {
  44. const button = document.createElement('button')
  45. button.setAttribute("id","flybtn");
  46. button.textContent = text
  47. button.addEventListener('click', onclick)
  48. return buttonContainer.appendChild(button)
  49. }
  50. }
  51. return document.addFloatButton(text, onclick)
  52. }
  53. //click
  54. function getAll() {
  55. getInfo();
  56. getAppImg();
  57. }
  58. //去除空格
  59. function Trim(str, is_global) {
  60. var result;
  61. result = str.replace(/(^\s+)|(\s+$)/g, "");
  62. if (is_global.toLowerCase() == "g") {
  63. result = result.replace(/\s/g, "");
  64. }
  65. return result;
  66. }
  67. function getInfo(){
  68. var host = window.location.host;
  69. if(host.indexOf("guopan")!= -1){
  70. getGPinfo();
  71. }if(host.indexOf("qq")!= -1){
  72. getQinfo();
  73. }if(host.indexOf("wandoujia")!= -1){
  74. getWDinfo();
  75. }
  76. }
  77. //获取appinfo
  78. function getQinfo() {
  79. //appinfo = Trim(appinfo,"g");
  80. //var info = "游戏名: "+appname+"\n"+"版本: "+appversion+"\n"+"大小: "+appsize+"\n"+"链接: "+appurl+"\n"+"简介:\n "+appmore;
  81. //获取应用宝信息
  82. //获取名字
  83. appname = $(".det-name-int").text();
  84. //获取版本
  85. appversion = $(".det-othinfo-data").eq(0).text().toLowerCase();
  86. //获取大小
  87. appsize = $(".det-size").text() + 'B';
  88. //获取appurl
  89. appurl = $(".det-down-btn").attr("data-apkurl");
  90. //获取介绍
  91. appmore = $("#J_DetAppDataInfo").text().trim();
  92. //获取图片
  93. logourl = $(".det-icon img").attr("src");
  94. //清零
  95. appImgs.length = 0;
  96. imgs = $("#J_PicTurnImgBox .pic-img-box").each(function(inedx, item) {
  97. let img = $(this).children('img');
  98. appImgs.push($(img).attr("data-src"));
  99. });
  100. jsonSet(appname,appversion,appsize,appurl);
  101. }
  102. function getGPinfo() {
  103. appname = $("p.title.ng-binding").text();
  104. //获取版本
  105. appversion = $("span.ng-binding").eq(0).text().replace(/版本:/, "v");
  106. //获取大小
  107. appsize = $("span.ng-binding").eq(1).text().replace(/大小:/, "");
  108. //获取appurl
  109. appurl = $("button.btn.copy.clipboard.ng-binding").attr("data-clipboard-text");
  110. //获取介绍
  111. appmore = $("div.desc.ng-binding").text().trim();
  112. //获取logo
  113. //logourl = $(".imgUrl .ng-scope").attr("src");
  114. //获取图片
  115. appImgs.length = 0;
  116. logourl = $("a.imgUrl.ng-scope img").attr("src");
  117. //console.log($("div.allImg.clearfix"));
  118. imgs = $("div.allImg.clearfix .ng-scope").each(function(inedx, item) {
  119. appImgs.push($(this).attr("src"));
  120. });
  121. jsonSet(appname,appversion,appsize,appurl);
  122. }
  123. //豌豆夹
  124. function getWDinfo() {
  125. var info = "游戏名: "+appname+"\n"+"版本: "+appversion+"\n"+"大小: "+appsize+"\n"+"链接: "+appurl+"\n"+"简介:\n "+appmore;
  126. appname = $("span.title").text();
  127. //获取版本
  128. appversion = "v"+$("dl.infos-list dd").eq(2).text().trim();
  129. //获取大小
  130. appsize = $("dl.infos-list dd").eq(0).text().trim();
  131. //获取appurl
  132. appurl = $("a.normal-dl-btn ").attr("href");
  133. //获取介绍
  134. appmore = $("div.desc-info").text().trim();
  135. //获取logo
  136. logourl = $("div.app-icon img").attr("src");
  137. //获取图片
  138. appImgs.length = 0;
  139. //console.log($("div.allImg.clearfix"));
  140. imgs = $("div.overview img").each(function(inedx, item) {
  141. console.log($(this).attr("src"));
  142. appImgs.push($(this).attr("src"));
  143. });
  144. jsonSet(appname,appversion,appsize,appurl);
  145. }
  146. //设置json
  147. function jsonSet(name,version,size,url){
  148. var object = {};
  149. var params = [];
  150. var obj = {};
  151. obj["appversion"] = version;
  152. obj["appsize"] = size;
  153. obj["appurl"] = url;
  154. //obj["appmore"] = appmore;
  155. params.push(obj);
  156. object['appname'] = name;
  157. object['appinfo'] = params;
  158. var json = JSON.stringify(object);
  159. GM_setClipboard(json);
  160. //alert("已复制好,可贴粘。");
  161. }
  162. //格式化json输出
  163. var formatJson = function(json, options) {
  164. var reg = null,
  165. formatted = '',
  166. pad = 0,
  167. PADDING = ' '; // one can also use '\t' or a different number of spaces
  168. // optional settings
  169. options = options || {};
  170. // remove newline where '{' or '[' follows ':'
  171. options.newlineAfterColonIfBeforeBraceOrBracket = (options.newlineAfterColonIfBeforeBraceOrBracket === true) ? true: false;
  172. // use a space after a colon
  173. options.spaceAfterColon = (options.spaceAfterColon === false) ? false: true;
  174.  
  175. // begin formatting...
  176. // make sure we start with the JSON as a string
  177. if (typeof json !== 'string') {
  178. json = JSON.stringify(json);
  179. }
  180. // parse and stringify in order to remove extra whitespace
  181. json = JSON.parse(json);
  182. json = JSON.stringify(json);
  183.  
  184. // add newline before and after curly braces
  185. reg = /([\{\}])/g;
  186. json = json.replace(reg, '\r\n$1\r\n');
  187.  
  188. // add newline before and after square brackets
  189. reg = /([\[\]])/g;
  190. json = json.replace(reg, '\r\n$1\r\n');
  191.  
  192. // add newline after comma
  193. reg = /(\,)/g;
  194. json = json.replace(reg, '$1\r\n');
  195.  
  196. // remove multiple newlines
  197. reg = /(\r\n\r\n)/g;
  198. json = json.replace(reg, '\r\n');
  199.  
  200. // remove newlines before commas
  201. reg = /\r\n\,/g;
  202. json = json.replace(reg, ',');
  203.  
  204. // optional formatting...
  205. if (!options.newlineAfterColonIfBeforeBraceOrBracket) {
  206. reg = /\:\r\n\{/g;
  207. json = json.replace(reg, ':{');
  208. reg = /\:\r\n\[/g;
  209. json = json.replace(reg, ':[');
  210. }
  211. if (options.spaceAfterColon) {
  212. reg = /\:/g;
  213. json = json.replace(reg, ': ');
  214. }
  215.  
  216. $.each(json.split('\r\n'),
  217. function(index, node) {
  218. var i = 0,
  219. indent = 0,
  220. padding = '';
  221.  
  222. if (node.match(/\{$/) || node.match(/\[$/)) {
  223. indent = 1;
  224. } else if (node.match(/\}/) || node.match(/\]/)) {
  225. if (pad !== 0) {
  226. pad -= 1;
  227. }
  228. } else {
  229. indent = 0;
  230. }
  231.  
  232. for (i = 0; i < pad; i++) {
  233. padding += PADDING;
  234. }
  235.  
  236. formatted += padding + node + '\r\n';
  237. pad += indent;
  238. });
  239.  
  240. return formatted;
  241. };
  242. //图片下载
  243. function getAppImg() {
  244. //setTimeout(function(){ alert("Hello"); }, 3000);
  245. //console.log(appImgs);
  246. GM_download(logourl, appname + "logo");
  247. //遍历图片
  248. if (appImgs == null || appImgs == "") {
  249. alert("Info");
  250. } else {
  251. for (var i = 0; i < 4; i++) {
  252. //console.log(appImgs[i]);
  253. GM_download(appImgs[i], appname + tail[i]);
  254. }
  255. }
  256. //console.log(logourl);
  257. }
  258. //图片处理
  259. function imgHandle(imgurl) {
  260. var canvas = document.createElement('canvas');
  261. canvas.setAttribute("id", "flycanvans");
  262. Caman("#canvas-id", imgurl,
  263. function() {
  264. this.resize({
  265. width: 500,
  266. height: 300
  267. });
  268. this.render();
  269. });
  270. }
  271. })();

QingJ © 2025

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