1688详情页获取电话号

孙胖专用哦 1688详情页获取电话号

  1. // ==UserScript==
  2. // @name 1688详情页获取电话号
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-08-15
  5. // @description 孙胖专用哦 1688详情页获取电话号
  6. // @author wangyang
  7. // @license MIT
  8. // @match https://detail.1688.com/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=1688.com
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15. let num = 0
  16. let button = document.createElement('button');
  17. let Message = document.createElement('div')
  18. button.textContent = '获取电话号';
  19. Message.innerText = ''
  20.  
  21. // 设置按钮样式
  22. button.style.backgroundColor = '#0958d9';
  23. button.style.color = 'white';
  24. button.style.border = 'none';
  25. button.style.borderRadius = '5px';
  26. button.style.padding = '10px 20px';
  27. button.style.position = 'fixed';
  28. button.style.bottom = '10px';
  29. button.style.right = '10px';
  30. button.style.cursor = 'pointer'
  31. button.style.zIndex = '1000'; // 确保按钮在其他内容之上
  32. button.addEventListener('click', () => {
  33. num+=1
  34. searchFn()
  35. })
  36.  
  37. //设置提示信息样式
  38. Message.style.zIndex = '9999999999999999999999';
  39. Message.style.position = 'fixed';
  40. Message.style.bottom = '100px';
  41. Message.style.right = '10px';
  42. Message.style.fontSize = '18px';
  43. Message.style.fontWeight = '600';
  44. // 将按钮添加到页面中
  45. document.body.appendChild(button);
  46. document.body.appendChild(Message)
  47.  
  48.  
  49.  
  50.  
  51. let timer = setInterval(()=>{
  52. searchFn()
  53. num+=1
  54. if(num>10){
  55. clearInterval(timer)
  56. timer = null
  57. }
  58. }, 1000)
  59. function getQueryString() {
  60. const url = window.location.href;
  61. const queryStart = url.indexOf('?');
  62. const queryString = queryStart !== -1 ? url.substring(queryStart + 1) : '';
  63. const params = {};
  64. if (queryString) {
  65. const pairs = queryString.split('&');
  66. pairs.forEach(pair => {
  67. const [key, value] = pair.split('=');
  68. params[decodeURIComponent(key)] = decodeURIComponent(value || '');
  69. });
  70. }
  71. return params;
  72. }
  73. function tongzhi(content) {
  74. Message.innerText = content
  75. Message.style.display = 'block';
  76. }
  77.  
  78. function searchFn() {
  79. let hrefObj = getQueryString()
  80. const url = `https://dj.1688.com/clue/queryCustPhone?clickid=${hrefObj.clickid}&pageUrl=https:%2F%2Fdetail.1688.com&a=${hrefObj.a}&e=${hrefObj.e}&style=${hrefObj.style}`
  81. fetch(url, {
  82. method: 'GET'
  83. }).then(response => {
  84. if (!response.ok) {
  85. }
  86. return response.json();
  87. })
  88. .then(data => {
  89. copyToClipboard(data.data.secretNumber || data.data.mobileNumber || data.data.phoneArea + '-' + data.data.phoneNumber, `加密电话:${data.data.secretNumber || '无'},移动电话:${data.data.mobileNumber || '无'},固定电话:${data.data.phoneNumber? data.data.phoneArea + '-' + data.data.phoneNumber : '无'}`)
  90. })
  91. .catch(error => {
  92. });
  93. }
  94. function copyToClipboard(text, info) {
  95. if(text){
  96. navigator.clipboard.writeText(text).then(() => {
  97. tongzhi(`第一个可用电话已复制, 全部电话======>${info}`)
  98. }).catch(err => {
  99. tongzhi('复制失败')
  100. });
  101. clearInterval(timer)
  102. timer = null
  103. }else {
  104. tongzhi(`他可能没有电话号我获取了${num}次了`)
  105. }
  106. }
  107. })();

QingJ © 2025

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