2025年6月16日 星期一

如何下載skool影片


方法一:

1. 找到影片ID。

    使用chrome開發者工具,

    關鍵字:  .m3u8  、playlist

範例:(數字經過修正,這只是純分享教學的數字)
https://luna.loom.com/id/0ee9338kk2abcde12345678638e7e2PP/rev/62fcc32963709c6f41b8fc46d35ca2dcfa98ae9a26fab6c8f83f7edcf89a8c899/resource/hls/playlist-split.m3u8?Signature=gKsVFiI72qENdH-xkmsNbB9voypUY3ectTqWVxTQnIs~BuAQ3tA-HT6tnq1I30VCcm3If-L03fy1N~MloorMmuUImpfJbwpx~UHjCwGzfn~DaT4c-M1fyCH7PJB6znSZNEEw9QuWrQ6vCdI-3dmzzdL3RhHNzeNDXA~jZ2l1AgIzZFONEGAUpSzs27Cp~RNhhTnpcseteNGG9Tz4mh-r2lA7MSGkRdyhfa4VCt~-OkQpOzInCol7g7y8Zq3-tizs8dHUi8QOQ9YJ9NkDtuKLjVhptg8yMaqpTN1xmx5leiaHe7ckJ1nsXJTtrtTCYNu9yGxHxKKKoa9VD07CfWq1YA__&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9sdW5hLmxvb20uY29tL2lkLzBlZTkzMzg2YzI4YjQyOGNhNTM4YjJiNjM4ZTdlMmRkL3Jldi82MmZjYzMyOTYzNzA5YzZmNDFiOGZjNDZkMzVjYTJkY2ZhOThhZTlhMjZmYWI2YzhmODNmN2VkY2Y4OWE4Yzg5OS9yZXNvdXJjZS8qIiwiQ29uZGl0aW9uIjp7IkRhdGVMZXNzVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNzUwMTc2NzIwfX19XX0_&Key-Pair-Id=APKAJQIC5BGSW7XXK7FQ

取id後的數字0ee9338kk2abcde12345678638e7e2PP
上面這串數字就是影片ID

2. 組合出正確影片網址:

使用以下網址+ID,組合新的網址
https://www.loom.com/share/
正確的影片網址組合
https://www.loom.com/share/0ee9338kk2abcde12345678638e7e2PP

3. 使用yt-dlp下載

在命令列下打
yt-dlp "https://www.loom.com/share/0ee9338kk2abcde12345678638e7e2PP"

來源:
https://github.com/yt-dlp/yt-dlp/issues/8863


方法二:
1. chrome主控台打命令文字

STEPS: 
1. Go to Skool.com and find the video you want to download. 
2. Open your browser’s console (right-click - inspect - console).
3. Paste the script I provide in the console and press return. 
4. Make sure the page fully loads to ensure the script finds the video. 
5. Copy the generated yt-dlp command. 
6. Open your terminal and run the command to download the video. 
7. Let the download finish – it’s that easy! 
8. Find the .webm file on your desktop and play it in your browser, or convert it to mp4 if you want.

程式碼:
-----------------------------------------------------------------------------------------------------
// Extract all lesson URLs from Skool classroom - paste in browser console
function extractAllLessonUrls() {
    console.log("🔍 Searching for lesson URLs on this page...");

    const urls = new Set();

    // Dynamically get base URL from current page
    const currentUrl = new URL(window.location.href);
    const baseUrl = `${currentUrl.protocol}//${currentUrl.host}${currentUrl.pathname}`;

    console.log(`📍 Auto-detected base URL: ${baseUrl}`);
    console.log(`🌐 Current full URL: ${window.location.href}`);

    // Method 1: Look for direct links with md= parameters
    document.querySelectorAll('a[href*="classroom"]').forEach(link => {
        if (link.href.includes('md=')) {
            urls.add(link.href);
            console.log("Found link:", link.href);
        }
    });

    // Method 2: Look for any links containing md= in any attribute  
    document.querySelectorAll('*').forEach(el => {
        // Check onclick handlers
        const onclick = el.getAttribute('onclick');
        if (onclick && onclick.includes('md=')) {
            const mdMatch = onclick.match(/md=([a-f0-9]+)/);
            if (mdMatch) {
                const url = `${baseUrl}?md=${mdMatch[1]}`;
                urls.add(url);
                console.log("Found in onclick:", url);
            }
        }

        // Check data attributes
        ['data-href', 'data-url', 'data-link', 'data-md'].forEach(attr => {
            const value = el.getAttribute(attr);
            if (value && value.includes('md=')) {
                if (value.startsWith('http')) {
                    urls.add(value);
                } else {
                    const mdMatch = value.match(/md=([a-f0-9]+)/);
                    if (mdMatch) {
                        const url = `${baseUrl}?md=${mdMatch[1]}`;
                        urls.add(url);
                        console.log(`Found in ${attr}:`, url);
                    }
                }
            }
        });

        // Check for md= in any attribute value
        for (let attr of el.attributes) {
            if (attr.value.includes('md=') && !attr.name.startsWith('data-react')) {
                const mdMatch = attr.value.match(/md=([a-f0-9]+)/g);
                if (mdMatch) {
                    mdMatch.forEach(match => {
                        const mdValue = match.replace('md=', '');
                        const url = `${baseUrl}?md=${mdValue}`;
                        urls.add(url);
                        console.log(`Found in ${attr.name}:`, url);
                    });
                }
            }
        }
    });

    // Method 3: Look in page source/innerHTML for md= patterns
    const pageSource = document.documentElement.innerHTML;
    const mdMatches = pageSource.match(/md=([a-f0-9]{32})/g);
    if (mdMatches) {
        mdMatches.forEach(match => {
            const mdValue = match.replace('md=', '');
            const url = `${baseUrl}?md=${mdValue}`;
            urls.add(url);
        });
        console.log(`Found ${mdMatches.length} md= patterns in page source`);
    }

    // Add current page URL if it has md=
    if (window.location.href.includes('md=')) {
        urls.add(window.location.href);
        console.log("Added current page:", window.location.href);
    }

    const urlArray = Array.from(urls).sort();

    console.log(`\n✅ Found ${urlArray.length} unique lesson URLs:`);
    urlArray.forEach((url, index) => {
        console.log(`${index + 1}. ${url}`);
    });

    if (urlArray.length === 0) {
        console.log("\n❌ No lesson URLs found!");
        console.log("💡 Try running this from the main classroom navigation page");
        console.log("💡 Or manually add URLs to the list below");

        // Add current URL as fallback
        urlArray.push(window.location.href);
    }

    // Create urls.txt file and download it
    const urlText = urlArray.join('\n');
    const blob = new Blob([urlText], {type: 'text/plain'});
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = 'urls.txt';
    document.body.appendChild(a);
    a.click();
    document.body.removeChild(a);
    URL.revokeObjectURL(url);

    console.log("\n📁 Downloaded urls.txt with all found URLs");
    console.log("📝 Next steps:");
    console.log("1. Check the downloaded urls.txt file");
    console.log("2. Add any missing URLs manually if needed");
    console.log("3. Use: wget --input-file=urls.txt [other options]");

    return urlArray;
}

// Run the extraction
extractAllLessonUrls();
--------------------------------------------------------------------------------------------------


參考以下影片。
https://www.youtube.com/watch?v=YH-oF2cWoDI
https://blog.devinschumacher.com/how-to-download-skoolcom-videos-wget

沒有留言:

張貼留言