1688获取产品链接

轻松输出1688产品链接

  1. // ==UserScript==
  2. // @name 1688获取产品链接
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description 轻松输出1688产品链接
  6. // @author You
  7. // @license MIT
  8. // @include *://s.1688.com/*
  9. // @icon https://re.1688.com/%3Fkeywords%3D%7Bkeywords%7D%26cosite%3Dbaidujj_pz%26location%3Dre%26trackid%3D%7Btrackid%7D%26keywordid%3D%7Bkeywordid%7D%26format%3Dnormal
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // 创建一个按钮元素
  17. const button = document.createElement("button");
  18. button.innerHTML = "下载产品链接";
  19. button.style.cssText = "position:fixed;top:50px;right:10px;z-index:9999;display: inline-block;width: 152px;height: 32px;font: 14px/26px PingFangSC-Regular;text-align: center;color: #fff;border-radius: 4px;letter-spacing: 0;text-decoration: none;border: 1px solid #ff4000;background-image: linear-gradient(90deg, #FF7E3E 0%, #FF4000 100%);";
  20. document.body.appendChild(button);
  21.  
  22. // 添加按钮的点击事件
  23. button.addEventListener("click", () => {
  24. const hrefsSet = new Set();
  25. document.querySelectorAll('a').forEach((a) => {
  26. const href = a.href;
  27. if (href.includes('detail.1688.com')) {
  28. hrefsSet.add(href);
  29. }
  30. });
  31. const hrefsArray = Array.from(hrefsSet);
  32. const csvContent = "data:text/csv;charset=utf-8," + hrefsArray.map(href => href + '\r\n').join("");
  33. const blob = new Blob([csvContent], {type: 'text/csv;charset=utf-8;'});
  34. const link = document.createElement("a");
  35. link.setAttribute("href", URL.createObjectURL(blob));
  36. link.setAttribute("download", "hrefs.csv");
  37. link.click();
  38. });
  39. })();

QingJ © 2025

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