Advertisement
Huxulm

Untitled

May 9th, 2024 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. // ==UserScript==
  2. // @name 题单页面 - DS
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-04-23
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://leetcode.cn/circle/discuss/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode.cn
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. var delayFn = function() {
  16. const qs = document.querySelectorAll('div[class="e2v1tt3 css-1ayia3m-MarkdownContent"] ul li a');
  17. const all = [];
  18. if (qs) {
  19. qs.forEach(function(v) {
  20. if (v.href.startsWith('https://leetcode') && /\. /g.test(v.textContent)) {
  21. all.push({title: v.textContent, src: v.href})
  22. } else {
  23. console.log(v.textContent, v.href);
  24. }
  25. })
  26. }
  27. console.log(JSON.stringify(all, null, 2));
  28. console.log('总数:', all.length);
  29. };
  30.  
  31. setTimeout(delayFn, 10000);
  32.  
  33. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement