TikTok Video URL Extractor

Logs video links from a TikTok profile to your browsers console.

当前为 2023-06-17 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name TikTok Video URL Extractor
  3. // @namespace Violentmonkey Scripts
  4. // @match https://www.tiktok.com/*
  5. // @grant none
  6. // @version 1.1
  7. // @license GPLv2
  8. // @author Flop7534
  9. // @description Logs video links from a TikTok profile to your browsers console.
  10. // ==/UserScript==
  11.  
  12. // IMPORTANT: You may need to edit the class which gets selected in var "x"
  13. // If needed, change it to the common class associated with each individual video element on the profile.
  14.  
  15. console.log("Script started")
  16. console.log("Script started")
  17. console.log("Script started")
  18. console.log("Script started")
  19. console.log("Script started")
  20. console.log("Script started")
  21.  
  22. setTimeout(() => {
  23. var b = document.getElementsByClassName("tiktok-ba55d9-DivHeaderRightContainer");
  24. var myButton = document.createElement("button");
  25. myButton.innerHTML = "Save links";
  26.  
  27. myButton.addEventListener("click", function () {
  28. var x = document.getElementsByClassName("tiktok-x6y88p-DivItemContainerV2");
  29. var i = 0;
  30. var y = x.length;
  31. var links = "";
  32.  
  33. while (i < y) {
  34. var link = x[i].children[0].children[0].children[0].children[0].attributes.href.value;
  35. links += link + "\n";
  36. i++;
  37. }
  38.  
  39. var blob = new Blob([links], { type: "text/plain" });
  40. var url = URL.createObjectURL(blob);
  41. var a = document.createElement("a");
  42. a.href = url;
  43. a.download = "links.txt";
  44. a.click();
  45. URL.revokeObjectURL(url);
  46. });
  47.  
  48. b[0].appendChild(myButton);
  49. }, 5000);