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.11
  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. setTimeout(() => {
  16. var b = document.getElementsByClassName("tiktok-ba55d9-DivHeaderRightContainer");
  17. var myButton = document.createElement("button");
  18. myButton.innerHTML = "Save links";
  19.  
  20. myButton.addEventListener("click", function () {
  21. var x = document.getElementsByClassName("tiktok-x6y88p-DivItemContainerV2");
  22. var i = 0;
  23. var y = x.length;
  24. var links = "";
  25.  
  26. while (i < y) {
  27. var link = x[i].children[0].children[0].children[0].children[0].attributes.href.value;
  28. links += link + "\n";
  29. i++;
  30. }
  31.  
  32. var blob = new Blob([links], { type: "text/plain" });
  33. var url = URL.createObjectURL(blob);
  34. var a = document.createElement("a");
  35. a.href = url;
  36. a.download = "links.txt";
  37. a.click();
  38. URL.revokeObjectURL(url);
  39. });
  40.  
  41. b[0].appendChild(myButton);
  42. }, 5000);