// Method 3: Find video links in iframes const iframes = document.querySelectorAll('iframe'); iframes.forEach(iframe => if (iframe.src && (iframe.src.includes('vod') );
function downloadVideo(url, filename) chrome.runtime.sendMessage( action: "download", url: url, filename: filename ); download sharepoint video chrome extension
function extractFilename(url) try const urlObj = new URL(url); let filename = urlObj.pathname.split('/').pop(); if (!filename.includes('.')) filename += '.mp4'; if (filename.length > 50) filename = filename.substring(0, 50) + '.mp4'; return decodeURIComponent(filename); catch(e) return 'sharepoint_video.mp4'; // Method 3: Find video links in iframes
// Method 2: Find video links in SharePoint players const videoContainers = document.querySelectorAll('[data-video-url], [data-src*="video"], [data-filepath]'); videoContainers.forEach(container => ); if (iframe.src && (iframe.src.includes('vod') )
// Check for source elements const sources = video.querySelectorAll('source'); sources.forEach(source => if (source.src) videos.push( url: source.src, filename: extractFilename(source.src) ); ); );
// Listen for scan requests chrome.runtime.onMessage.addListener((request, sender, sendResponse) => if (request.action === "scanVideos") const videos = findAllVideos(); sendResponse(videos: videos); return true; ); function findAllVideos() const videos = [];
// Add download event listeners document.querySelectorAll('.download-btn').forEach(btn => btn.addEventListener('click', (e) => 'sharepoint_video.mp4'; downloadVideo(url, filename); ); );