Size
6.7 KB
Version
1.0.1
Created
Feb 8, 2026
Updated
about 1 month ago
1// ==UserScript==
2// @name Pipiads Video İndirici
3// @description Pipiads videolarını kolayca indirin
4// @version 1.0.1
5// @match https://*.pipiads.com/*
6// @icon https://www.pipiads.com/assets/images/favicon.ico
7// ==/UserScript==
8(function() {
9 'use strict';
10
11 console.log('Pipiads Video İndirici başlatıldı');
12
13 // Debounce fonksiyonu
14 function debounce(func, wait) {
15 let timeout;
16 return function executedFunction(...args) {
17 const later = () => {
18 clearTimeout(timeout);
19 func(...args);
20 };
21 clearTimeout(timeout);
22 timeout = setTimeout(later, wait);
23 };
24 }
25
26 // İndirme butonunu oluştur
27 function createDownloadButton(videoContainer) {
28 // Zaten buton varsa ekleme
29 if (videoContainer.querySelector('.pipiads-download-btn')) {
30 return;
31 }
32
33 const downloadBtn = document.createElement('div');
34 downloadBtn.className = 'pipiads-download-btn';
35 downloadBtn.innerHTML = '⬇️ İndir';
36 downloadBtn.title = 'Videoyu İndir';
37
38 downloadBtn.addEventListener('click', async (e) => {
39 e.stopPropagation();
40 e.preventDefault();
41
42 try {
43 // Video elementini bul
44 const videoElement = videoContainer.querySelector('video');
45 if (!videoElement) {
46 console.error('Video elementi bulunamadı');
47 return;
48 }
49
50 const videoUrl = videoElement.src || videoElement.currentSrc;
51 if (!videoUrl) {
52 console.error('Video URL bulunamadı');
53 return;
54 }
55
56 console.log('Video indiriliyor:', videoUrl);
57 downloadBtn.innerHTML = '⏳ İndiriliyor...';
58 downloadBtn.style.pointerEvents = 'none';
59
60 // Video dosyasını indir
61 const response = await GM.xmlhttpRequest({
62 method: 'GET',
63 url: videoUrl,
64 responseType: 'blob',
65 onprogress: (progress) => {
66 if (progress.lengthComputable) {
67 const percent = Math.round((progress.loaded / progress.total) * 100);
68 downloadBtn.innerHTML = `⏳ ${percent}%`;
69 }
70 }
71 });
72
73 // Blob'u indir
74 const blob = response.response;
75 const blobUrl = URL.createObjectURL(blob);
76
77 // Dosya adını oluştur
78 const timestamp = new Date().getTime();
79 const filename = `pipiads_video_${timestamp}.mp4`;
80
81 // İndirme linkini oluştur ve tıkla
82 const a = document.createElement('a');
83 a.href = blobUrl;
84 a.download = filename;
85 document.body.appendChild(a);
86 a.click();
87 document.body.removeChild(a);
88
89 // Blob URL'yi temizle
90 setTimeout(() => URL.revokeObjectURL(blobUrl), 100);
91
92 console.log('Video başarıyla indirildi:', filename);
93 downloadBtn.innerHTML = '✅ İndirildi';
94
95 setTimeout(() => {
96 downloadBtn.innerHTML = '⬇️ İndir';
97 downloadBtn.style.pointerEvents = 'auto';
98 }, 2000);
99
100 } catch (error) {
101 console.error('Video indirme hatası:', error);
102 downloadBtn.innerHTML = '❌ Hata';
103 setTimeout(() => {
104 downloadBtn.innerHTML = '⬇️ İndir';
105 downloadBtn.style.pointerEvents = 'auto';
106 }, 2000);
107 }
108 });
109
110 // Butonu video kontrol alanına ekle
111 const controlsContainer = videoContainer.querySelector('.controls-container.video-control');
112 if (controlsContainer) {
113 controlsContainer.appendChild(downloadBtn);
114 } else {
115 // Alternatif olarak cover container'a ekle
116 const coverContainer = videoContainer.querySelector('.cover');
117 if (coverContainer) {
118 coverContainer.appendChild(downloadBtn);
119 }
120 }
121 }
122
123 // Tüm video kartlarına buton ekle
124 function addDownloadButtons() {
125 const videoContainers = document.querySelectorAll('.cover-container');
126 console.log(`${videoContainers.length} video kartı bulundu`);
127
128 videoContainers.forEach(container => {
129 createDownloadButton(container);
130 });
131 }
132
133 // CSS stillerini ekle
134 function addStyles() {
135 const style = document.createElement('style');
136 style.textContent = `
137 .pipiads-download-btn {
138 position: absolute;
139 bottom: 10px;
140 right: 10px;
141 background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
142 color: white;
143 padding: 8px 16px;
144 border-radius: 20px;
145 cursor: pointer;
146 font-size: 14px;
147 font-weight: 600;
148 z-index: 1000;
149 transition: all 0.3s ease;
150 box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
151 display: flex;
152 align-items: center;
153 gap: 5px;
154 user-select: none;
155 }
156
157 .pipiads-download-btn:hover {
158 transform: translateY(-2px);
159 box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
160 background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
161 }
162
163 .pipiads-download-btn:active {
164 transform: translateY(0);
165 }
166
167 .cover {
168 position: relative;
169 }
170 `;
171 document.head.appendChild(style);
172 }
173
174 // Sayfa yüklendiğinde başlat
175 function init() {
176 console.log('Pipiads Video İndirici başlatılıyor...');
177
178 // Stilleri ekle
179 addStyles();
180
181 // İlk butonları ekle
182 setTimeout(() => {
183 addDownloadButtons();
184 }, 2000);
185
186 // DOM değişikliklerini izle
187 const observer = new MutationObserver(debounce(() => {
188 addDownloadButtons();
189 }, 500));
190
191 observer.observe(document.body, {
192 childList: true,
193 subtree: true
194 });
195
196 console.log('Pipiads Video İndirici hazır!');
197 }
198
199 // Sayfa hazır olduğunda başlat
200 if (document.readyState === 'loading') {
201 document.addEventListener('DOMContentLoaded', init);
202 } else {
203 init();
204 }
205
206})();