VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. Hello.

    https://www.nowehoryzonty.pl/vod-film.s?id=14019&vb=kdv#play

    here's a site with some free videos but all i get in requests is a vp9 mpd.

    is there any trick to get h264 mpd from this site ?

    videos are free, you only need to login (polish ip might be needed)
    Quote Quote  
  2. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Code:
    N_m3u8DL-RE "https://1827693967.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__CZESC_LATO/04_09_24_1648_m4a/h264.mpd" --key f10f4b6fecd33c3ca26612310bdc9691:94640f195bed82c349f41b46a18925f2 -M format=mkv
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  3. which browser did you use to find this url ?

    looks like it's not only the filename is different but also host

    vp9 are hosted here
    Code:
    https://1104682167.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__CZESC_LATO/04_09_24_1648_m4a/vp9.mpd
    and h264 here
    Code:
    https://1827693967.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__CZESC_LATO/04_09_24_1648_m4a/h264.mpd
    Last edited by monk87; 29th Sep 2024 at 01:15.
    Quote Quote  
  4. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    I didn't really find the URL. Mostly guessed it.

    For Firefox I got this playing mpd
    Code:
    https://1104682167.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__CZESC_LATO/04_09_24_1648_m4a/vp9.mpd?secure=<value>==,<value>
    Tried changing vp9.mpd to h264.mpd and it didn't work (most likely you need other query parameters). Then I changed my user agent to random values until I got Mac OS X / Safari 17 and I got a mpd URL without parameters. The mpd was only for the short ad/intro and it didn't even play.

    Code:
    https://1827693967.rsc.cdn77.org/r/kdvod/2021/NH_VOD_3.0.2/30_11_23_1739_56s/vp9.mpd
    However by changing vp9 to h264 it still downloaded since you didn't need any parameters.
    Code:
    https://1827693967.rsc.cdn77.org/r/kdvod/2021/NH_VOD_3.0.2/30_11_23_1739_56s/h264.mpd
    So I combined those 2
    Code:
    https://1104682167.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__CZESC_LATO/04_09_24_1648_m4a/vp9.mpd?secure=<value>==,<value>
    https://1827693967.rsc.cdn77.org/r/kdvod/2021/NH_VOD_3.0.2/30_11_23_1739_56s/h264.mpd
    And got
    Code:
    https://1827693967.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__CZESC_LATO/04_09_24_1648_m4a/h264.mpd
    Maybe the base 1827693967 can be applied to all vods to get the h264 and 1104682167 for all vp9 vods, regardless of URL. So all you have to do is some basic URL editing by already knowing these 2 fixed values.

    It is a kinda convoluted solution. Maybe someone else knows an easier solution.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  5. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    I didn't really find the URL. Mostly guessed it.

    For Firefox I got this playing mpd
    Code:
    https://1104682167.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__CZESC_LATO/04_09_24_1648_m4a/vp9.mpd?secure=<value>==,<value>
    Tried changing vp9.mpd to h264.mpd and it didn't work (most likely you need other query parameters). Then I changed my user agent to random values until I got Mac OS X / Safari 17 and I got a mpd URL without parameters. The mpd was only for the short ad/intro and it didn't even play.

    Code:
    https://1827693967.rsc.cdn77.org/r/kdvod/2021/NH_VOD_3.0.2/30_11_23_1739_56s/vp9.mpd
    However by changing vp9 to h264 it still downloaded since you didn't need any parameters.
    Code:
    https://1827693967.rsc.cdn77.org/r/kdvod/2021/NH_VOD_3.0.2/30_11_23_1739_56s/h264.mpd
    So I combined those 2
    Code:
    https://1104682167.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__CZESC_LATO/04_09_24_1648_m4a/vp9.mpd?secure=<value>==,<value>
    https://1827693967.rsc.cdn77.org/r/kdvod/2021/NH_VOD_3.0.2/30_11_23_1739_56s/h264.mpd
    And got
    Code:
    https://1827693967.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__CZESC_LATO/04_09_24_1648_m4a/h264.mpd
    Maybe the base 1827693967 can be applied to all vods to get the h264 and 1104682167 for all vp9 vods, regardless of URL. So all you have to do is some basic URL editing by already knowing these 2 fixed values.

    It is a kinda convoluted solution. Maybe someone else knows an easier solution.

    No mater what, it still is a working solution

    I have tried to automate this sh... but failed miserably

    Code:
    import asyncio
    from playwright.async_api import async_playwright
    
    async def run(playwright):
        browser = await playwright.firefox.launch(headless=False, devtools=True)
        context = await browser.new_context()
        page = await context.new_page()
        await page.goto("https://www.nowehoryzonty.pl")
        post_data = {
            'login': 'FREE_LOGIN',   # Replace with actual login
            'passwd': 'PASS',   # Replace with actual password
            'location': 'https://www.nowehoryzonty.pl/vod-film.s?id=14020&vb=kdv',
            'gidtoken': ''       # Keep empty or dynamically filled if needed
        }
        response = await page.evaluate('''
            async (post_data) => {
                const response = await fetch('https://www.nowehoryzonty.pl/loguj.do', {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    },
                    body: new URLSearchParams(post_data)
                });
                const responseText = await response.text();
                return {
                    status: response.status,
                    body: responseText,
                    url: response.url
                };
            }
        ''', post_data)
    
        await page.goto("https://www.nowehoryzonty.pl/vod-film.s?id=14020&vb=kdv")
        await page.wait_for_selector('div.play-action', state='visible')
        await page.click('div.play-action')
        await asyncio.sleep(15)
        await browser.close()
    
    async def main():
        async with async_playwright() as playwright:
            await run(playwright)
    
    asyncio.run(main())
    it says "Nightly is installing components needed to play the audio or video on this page. Please try again later."

    Looks like firefox launched without widevine support.
    Tried to make it work with no luck.
    Any ides ?
    Quote Quote  
  6. launch playwright like this:
    Code:
    playwright.firefox.launch_persistent_context(
        user_data_dir="profile",
        headless=True
    )
    with the folder inside this zip file in the same directory as your script
    https://github.com/DevLARLEY
    Keys from just the License URL: WidevineFetch
    Quote Quote  
  7. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by monk87 View Post
    I have tried to automate this... but failed miserably
    Any ides ?
    Code:
    import json
    import re
    
    import browser_cookie3
    import requests
    
    ACCOUNT_COOKIES = None
    
    
    def set_account_cookies():
        global ACCOUNT_COOKIES
        ACCOUNT_COOKIES = {}
        for c in browser_cookie3.firefox(domain_name='nowehoryzonty.pl'):
            ACCOUNT_COOKIES[c.name] = c.value
    
    
    def get_manifests(source_url):
        source_url = source_url.replace("vod-film.s", "video.s")
        response = requests.get(source_url, cookies=ACCOUNT_COOKIES)
        response = response.content.decode()
        if "Najpierw musisz się zalogować" in response:
            raise "Log into your account using Firefox browser and run the script again"
        if "Film dostępny tylko na terenie Polski" in response:
            raise "Polish IP needed"
    
        response = re.findall(r'filminfo[^=]*=[^{]*({.*?});', response)
        response = json.loads(response[0])
    
        base_manifest = response["url"] + response.get("next", {}).get("urlSuffix", response["urlSuffix"])
        h264 = base_manifest + "h264.mpd"
        vp9 = base_manifest + "vp9.mpd"
    
        if 200 <= requests.get(h264).status_code < 300:
            print("h264: ", h264)
        if 200 <= requests.get(vp9).status_code < 300:
            print("vp9: ", vp9)
    
    
    SOURCE_URLS = [
        "https://www.nowehoryzonty.pl/vod-film.s?id=14020&vb=kdv",
        "https://www.nowehoryzonty.pl/vod-film.s?id=14019&vb=kdv#play",
        "https://www.nowehoryzonty.pl/vod-film.s?id=13226&vb=kdv",
    ]
    
    if __name__ == '__main__':
        if ACCOUNT_COOKIES is None:
            set_account_cookies()
    
        for s in SOURCE_URLS:
            print(s)
            get_manifests(s)
            print("------\n")
    Code:
    https://www.nowehoryzonty.pl/vod-film.s?id=14020&vb=kdv
    h264:  https://1827693967.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__DZIEWCZYNKA_Z_ZAJETYMI_OCZAMI/05_09_24_1436_4w2/h264.mpd
    ------
    
    https://www.nowehoryzonty.pl/vod-film.s?id=14019&vb=kdv#play
    h264:  https://1827693967.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__CZESC_LATO/04_09_24_1648_m4a/h264.mpd
    vp9:  https://1827693967.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__CZESC_LATO/04_09_24_1648_m4a/vp9.mpd
    ------
    
    https://www.nowehoryzonty.pl/vod-film.s?id=13226&vb=kdv
    h264:  https://1827693967.rsc.cdn77.org/r/kdvod/2023/WARSZTAT_ANIMACJA_PLASTELINOWA/22_09_23_0859_4aj/h264.mpd
    vp9:  https://1827693967.rsc.cdn77.org/r/kdvod/2023/WARSZTAT_ANIMACJA_PLASTELINOWA/22_09_23_0859_4aj/vp9.mpd
    ------
    Not all videos have vp9/h264 guaranteed.
    Last edited by 2nHxWW6GkN1l916N3ayz8HQoi; 8th Oct 2024 at 14:03. Reason: Edit: forgot to skip the intro to get the real manifest
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  8. Originally Posted by larley View Post
    launch playwright like this:
    Code:
    playwright.firefox.launch_persistent_context(
        user_data_dir="profile",
        headless=True
    )
    with the folder inside this zip file in the same directory as your script
    this works and what i came up with was to intercept requests, grab the license request and try to export it in order to use it with some other tool.
    is that possible ?
    I didn't find any method allowing to use 'copy as curl/copy as fetch' in playwright
    Quote Quote  
  9. You don't have to. Copy as fetch is just handy because all of the required headers/cookies/payload data is in one place (the clipboard).
    We don't need this here because we already have a request object:
    You can take a look at the page request listener https://playwright.dev/python/docs/api/class-page#page-event-request, which gives examples on how to use page events
    https://github.com/DevLARLEY
    Keys from just the License URL: WidevineFetch
    Quote Quote  
  10. Ok i managed to make it work automatically

    my approach is tricky but i'm more js than python so that's how it is

    Code:
    const { firefox } = require('playwright');
    const fs = require('fs');
    const path = require('path');
    const outputDir = path.join(__dirname, 'HellYesGui');
    const { spawn } = require('child_process');
    function runPythonScript(scriptPath) {
        const scriptDir = path.dirname(scriptPath); // Get the directory of the script
        const scriptName = path.basename(scriptPath); // Get the script file name
    
        // Spawn a new process
        const pythonProcess = spawn('python', [scriptName], { cwd: scriptDir });
    
        // Handle output from the script
        pythonProcess.stdout.on('data', (data) => {
            console.log(`Script output: ${data}`);
        });
    
        // Handle errors from the script
        pythonProcess.stderr.on('data', (data) => {
            console.error(`Script error output: ${data}`);
        });
    
        // Handle script exit
        pythonProcess.on('close', (code) => {
            console.log(`Script finished with exit code ${code}`);
        });
    }
    // Helper function to construct the curl command
    function requestToCurl(request) {
        const method = request.method();
        const url = request.url();
        const headers = request.headers();
        const postData = request.postData();
    
        // Initialize curl command
        let curlCommand = `curl '${url}'`;
    
        // Add headers to curl command with line breaks
        for (const [key, value] of Object.entries(headers)) {
            if (key.toLowerCase() === 'content-length') {
                continue; // Skip this iteration
            }		
            curlCommand += ` \\\n  -H '${key}: ${value}'`;
        }
    
        return curlCommand;
    }
    
    // Function to load cookies from a JSON file
    async function loadCookiesFromFile(context, filePath) {
        if (fs.existsSync(filePath)) {
            const cookies = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
            await context.addCookies(cookies);
            console.log('Cookies loaded from:', filePath);
        } else {
            console.log('Cookie file not found.');
        }
    }
    
    (async () => {
        // Path to the profile directory
        const profileDir = 'profile'; // Adjust if needed
    
        // Path to the cookies file
        const cookiesFile = 'cookies.json'; // JSON file containing cookies
    
        // Launch Firefox with the persistent context using the existing profile
        const context = await firefox.launchPersistentContext(profileDir, {
            headless: false, // Set to true for headless mode,
    		userAgent: 'Mozilla/5.0 (iPad; CPU OS 17_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) EdgiOS/129.0.2792.58 Version/17.0 Mobile/15E148 Safari/604.1'
        });
    
        // Load cookies from the file
        await loadCookiesFromFile(context, cookiesFile);
    
        // Open a new page or get the first one if it already exists
        const page = context.pages[0] || await context.newPage();
    
        // Intercept requests and look for specific POST and .mpd requests
        await context.route('**/*', async (route, request) => {
            const url = request.url();
            
            // Check if the request is a POST to the Widevine license URL
            if (request.method() === 'POST' && url === 'https://lic.drmtoday.com/license-proxy-widevine/cenc/?specConform=true') {
                console.log('Intercepted POST request to:', url);
    
                // Construct the curl command
                const curlCommand = requestToCurl(request);
    
                // Save the curl command to a file
                const curlFilePath = path.join(outputDir, 'request_curl.txt');
                fs.writeFileSync(curlFilePath, curlCommand, 'utf8');
                console.log('Saved curl command for license request to', curlFilePath);
    
                // Continue with the request
                await route.continue();
            }
            // Check if the request URL contains ".mpd"
            else if (url.includes('.mpd')) {
                console.log('Intercepted .mpd request to:', url);
    
                // Construct the curl command
                const mpdFilePath = path.join(outputDir, 'mpd_url.txt');
                fs.writeFileSync(mpdFilePath, url, 'utf8');
                console.log('Saved curl command for .mpd request to', mpdFilePath);
    
                // Continue with the request
                await route.continue();
            } else {
                // Continue with all other requests
                await route.continue();
            }
        });
    
        // Navigate to the specified URL
        await page.goto('https://www.nowehoryzonty.pl/vod-film.s?id=14020&vb=kdv');
    
        // Click the play-action button
        console.log('Waiting for play-action element to appear...');
        await page.waitForSelector('div.play-action', { state: 'visible' });
        console.log('play-action element is visible. Clicking the element...');
        await page.click('div.play-action');
    
        // Wait for 5 seconds after the click
        console.log('Waiting for 5 seconds...');
    
        const title = await page.title();
        const firstPartOfTitle = title.split('|')[0].trim();
        const titleFilePath = path.join(outputDir, 'title.txt');
        console.log('First part of the title:', firstPartOfTitle);
        fs.writeFileSync(titleFilePath, firstPartOfTitle, 'utf8');
        console.log('First part of the title saved to', titleFilePath);
        await new Promise(resolve => setTimeout(resolve, 5000));
    
        // Close the context (this closes the browser)
        await context.close();
    	runPythonScript('HellYesGui/allhell3.py');
    
    })().catch(err => {
        console.error('Error:', err);
    });
    this script generates txt file from license request, mpd and title to be later passed to allhell3.py

    + i modified allhell3.py to load data from those files and use '-sa best -sv best' to remove all the user needed input

    but well

    apparently the command generated fails...

    N_m3u8DL-RE 'https://1827693967.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__DZIEWCZYNKA_Z_ZAJETYMI_OCZA MI/05_09_24_1436_4w2/h264.mpd' --key a92f733652bd336fbbfad623d1c72286:935187216b20e244b 7459f554200d78e --save-name d -mt -M:format=mp4

    gives 00:29:40.713 ERROR: Object reference not set to an instance of an object.

    what could be wrong ?

    Edit: the problem was with ' character...

    Sorry, it was late
    Last edited by monk87; 9th Oct 2024 at 00:41.
    Quote Quote  
  11. run the command with
    Code:
    --log-level DEBUG
    https://github.com/DevLARLEY
    Keys from just the License URL: WidevineFetch
    Quote Quote  
  12. Originally Posted by larley View Post
    run the command with
    Code:
    --log-level DEBUG
    the problem was with ' character...

    so instead of

    Code:
    N_m3u8DL-RE 'https://1827693967.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__DZIEWCZYNKA_Z_ZAJETYMI_OCZAMI/05_09_24_1436_4w2/h264.mpd' --key a92f733652bd336fbbfad623d1c72286:935187216b20e244b7459f554200d78e  -M:format=mp4
    it should be

    Code:
    N_m3u8DL-RE "https://1827693967.rsc.cdn77.org/r/kdvod/2024/SNEAKPEAK_FESTIWALOWY__DZIEWCZYNKA_Z_ZAJETYMI_OCZAMI/05_09_24_1436_4w2/h264.mpd" --key a92f733652bd336fbbfad623d1c72286:935187216b20e244b7459f554200d78e  -M:format=mp4
    It was too late to finish it I guess
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!