pusatdata

Pengekstrak MyEdisi UPDATE HARIAN

Feb 21st, 2025
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="id">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Ekstrak Link Gambar UPDATE HARIAN</title>
  7. <style>
  8. body {
  9. font-family: Arial, sans-serif;
  10. margin: 20px;
  11. text-align: center;
  12. }
  13. textarea {
  14. width: 100%;
  15. height: 150px;
  16. margin-bottom: 10px;
  17. }
  18. button {
  19. margin: 5px;
  20. padding: 10px;
  21. background-color: #007bff;
  22. color: white;
  23. border: none;
  24. cursor: pointer;
  25. border-radius: 5px;
  26. }
  27. button:hover {
  28. background-color: #0056b3;
  29. }
  30. #output {
  31. width: 100%;
  32. height: 150px;
  33. margin-top: 10px;
  34. }
  35. </style>
  36. </head>
  37. <body>
  38. <h2>Ekstrak Link Gambar</h2>
  39. <textarea id="inputText" placeholder="Masukkan teks yang berisi link gambar..."></textarea>
  40. <br>
  41. <button onclick="extractLinks()">Ekstrak</button>
  42. <button onclick="copyToClipboard()">Salin ke Clipboard</button>
  43. <button onclick="downloadAsTxt()">Unduh sebagai TXT</button>
  44. <br>
  45. <textarea id="output" readonly placeholder="Hasil ekstraksi akan muncul di sini..."></textarea>
  46.  
  47. <script>
  48. function extractLinks() {
  49. let inputText = document.getElementById("inputText").value;
  50. let regex = /(https?:\/\/[^\s]+\.(?:jpg|jpeg|png|gif))/gi;
  51. let matches = inputText.match(regex);
  52.  
  53. if (matches) {
  54. let updatedLinks = matches.map(link => link.replace("/coverthumb/tiny-", "/cover/"));
  55. document.getElementById("output").value = updatedLinks.join("\n");
  56. } else {
  57. document.getElementById("output").value = "Tidak ada link gambar yang ditemukan.";
  58. }
  59. }
  60.  
  61. function copyToClipboard() {
  62. let output = document.getElementById("output");
  63. output.select();
  64. document.execCommand("copy");
  65. alert("Hasil telah disalin ke clipboard!");
  66. }
  67.  
  68. function downloadAsTxt() {
  69. let outputText = document.getElementById("output").value;
  70. if (outputText.trim() === "") {
  71. alert("Tidak ada hasil untuk diunduh.");
  72. return;
  73. }
  74. let blob = new Blob([outputText], { type: "text/plain" });
  75. let link = document.createElement("a");
  76. link.href = URL.createObjectURL(blob);
  77. link.download = "hasil_ekstraksi.txt";
  78. document.body.appendChild(link);
  79. link.click();
  80. document.body.removeChild(link);
  81. }
  82. </script>
  83. </body>
  84. </html>
Add Comment
Please, Sign In to add comment