IconDownloader

用来在 Google Play 下载应用图标的脚本

  1. // ==UserScript==
  2. // @name IconDownloader
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.0.2
  5. // @description 用来在 Google Play 下载应用图标的脚本
  6. // @author Money
  7. // @match *://play.google.com/store/apps/details?id=*
  8. // @grant none
  9. // @license MIT License
  10. // @run-at document-end
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. // Your code here...
  15. var a = document.createElement('a');
  16. a.innerHTML = 'Download Icon';
  17. a.className = 'icon-download LkLjZd ScJHi nMZKrb g3P27d HPiPcc '
  18. a.download = document.getElementsByClassName("AHFaub")[0].innerText;
  19. a.click();
  20. var doDownload = function(blob, filename) {
  21. var a = document.createElement('a');
  22. a.download = filename;
  23. a.href = blob;
  24. a.click();
  25. }
  26. var container = document.getElementsByClassName("hfWwZc")[0];
  27. container.insertBefore(a,container.childNodes[0]);
  28.  
  29. a.addEventListener('click', function (ev) {
  30. var blob = document.getElementsByClassName("xSyT2c")[0].childNodes[0].getAttribute('src').split("=s")[0]+"=s512";
  31. var filename = document.getElementsByClassName("AHFaub")[0].innerText;
  32. download(blob,filename);
  33. });
  34.  
  35. var download = function (url, filename) {
  36. if (!filename) filename = url.split('\\').pop().split('/').pop();
  37. fetch(url, {
  38. headers: new Headers({
  39. 'Origin': location.origin
  40. }),
  41. mode: 'cors'
  42. })
  43. .then(response => response.blob())
  44. .then(blob => {
  45. let blobUrl = window.URL.createObjectURL(blob);
  46. doDownload(blobUrl, filename);
  47. })
  48. .catch(e => {console.error(e); return false;});
  49.  
  50. return true;
  51. }
  52.  
  53. })();

QingJ © 2025

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