Skip to content

Instantly share code, notes, and snippets.

@vimagick
Created November 6, 2023 13:52
Show Gist options
  • Save vimagick/97ede9d2287918d0889db9e9b5c49f9a to your computer and use it in GitHub Desktop.
Save vimagick/97ede9d2287918d0889db9e9b5c49f9a to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name icp-extractor
// @namespace http://tampermonkey.net/
// @version 1.0
// @description remove chinese results
// @author EasyPi Software Foundation
// @match *
// @grant GM_xmlhttpRequest
// @require https://code.jquery.com/jquery-3.7.1.min.js
// @run-at document-idle
// ==/UserScript==
(function() {
$(document).ready(function() {
let txt = $('a[href*="beian.miit.gov.cn"]:visible').last().css({'color': 'white', 'background-color': 'red'}).text();
/* Samples: 京ICP证000007号, 粤B2-20090059, 粤B2-20062018号, 京ICP备06050721号 */
if (txt !== null) {
let num = /[云京冀吉宁蜀新晋桂沪津浙渝港湘澳琼甘皖粤苏蒙藏豫黔赣辽鄂闵陕青鲁黑](ICP[备证]|B2-)\d{6,}号?/.exec(txt.replace(/\s+/g, ''));
if (num !== null) {
GM_xmlhttpRequest({
method: "POST",
url: "http://127.0.0.1:7379/",
headers: {
"Content-Type": "text/plain; charset=UTF-8"
},
data: `SADD/pending/${num[0]}`,
onload: function(response) {
console.log(response.responseText);
}
});
}
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment