VideoHelp Forum




+ Reply to Thread
Results 1 to 16 of 16
  1. Member
    Join Date
    Dec 2023
    Location
    Italy
    Search PM
    Script to speed up the steps?

    the steps are now very clear. no problem downloading a video or two. but it gets complicated when the TV series has more than 50 episodes.
    since the steps are always the same:
    1) copy init data from console with eme-logger
    2) copy license from network
    3) paste both files to cdrmproject
    4) copy the key obtained to cdrmproject
    5) copy the mpd to streamdetector
    6) finally glue everything onto N_m3u8DL-RE

    Isn't it possible to create an automation for all these steps?
    A thousand thanks
    Quote Quote  
  2. If your aim is to do so from FREE-TO-WATCH sites then give an Freevine a try ....
    Quote Quote  
  3. It is possible, but not very smart. The correct way to do it is use Python or some other script-language to mimic browser actions of the process and forget the loggers and streamdetectors. This means sending the same requests (POST, GET...) that the browser does. Everything you need to know can be seen by inspecting the network tab of the browser when the page loads. Only "problem" is that the sites tend to send lots of requests that are not related to this process in anyway, so you need to ignore those and focus on the important ones. You only need to understand Python basics, http-requests and JSON to do this, internet is full of example code that is almost copy-paste-ready to go.
    For example, (depending on the site) the process may start by sending a refresh-request to the server, which in return gives you a response with an access-token, then you do the second round by sending a request with the media-id together with the access-token from last response to get the PSSH and licence data and so on. After a few rounds you have all the data you need to generate the keys.
    Also, it is not very advisable to rely on 3rd party services like cdrmproject, they can go down anytime and your script is broken immediately. There are instructions for dumping your own CDM in the stickies.
    Quote Quote  
  4. Member
    Join Date
    Dec 2023
    Location
    Italy
    Search PM
    @echo off
    setlocal enabledelayedexpansion

    set "serie="
    set "stagione=01"
    set "numeroPuntata=1"
    set "contatoreFile=contatore.txt"
    set "primaVolta=true"

    :mainLoop
    if /i "!serie!" equ "reset" set "primaVolta=true"

    if "%primaVolta%"=="true" (
    set "serie="
    set "stagione=01"
    set "numeroPuntata=1"
    set /p "serie=Inserisci il nome della serie: "
    if not defined serie goto :eof

    set /p "stagione=Inserisci il numero della stagione: "
    if not defined stagione goto :eof

    set /p "numeroPuntata=Inserisci il numero della puntata: "
    if not defined numeroPuntata goto :eof

    set "primaVolta=false"
    )

    rem Richiedi all'utente di inserire manualmente il link
    set /p "link=Inserisci il link: "
    if /i "!link!" equ "reset" set "primaVolta=true" & goto :mainLoop
    if not defined link goto :eof

    rem Costruisci il nome della puntata con il numero formattato
    set "numeroPuntataFormatted=00%numeroPuntata%"
    set "numeroPuntataFormatted=!numeroPuntataFormatte d:~-2!"
    set "nomePuntata=!serie! !stagione!x!numeroPuntataFormatted!"

    rem Esegui lo script Python per ottenere chiave
    python script.py

    rem Leggi chiave dal file generato dallo script Python (rimuovi eventuali spazi bianchi)
    set /p "chiave=" < "chiave.txt"
    set "chiave=!chiave: =!"

    rem Esegui il comando N_m3u8DL-RE con i parametri
    N_m3u8DL-RE -sv best -sa all -ss all --key !chiave! "!link!" --header "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" --header "Referer: https://www.nowtv.it/" -M format=mkv --save-name "!nomePuntata!"

    rem Incrementa il numero della puntata
    set /a "numeroPuntata+=1"

    rem Salva il contatore delle puntate nel file
    echo !numeroPuntata! > "%contatoreFile%"

    goto :mainLoop


    script.py
    import requests
    import json
    import os

    api_url = "https://cdrm-project.com/api"

    # Richiedi all'utente di inserire manualmente "license" e "pssh"
    license_url = input("Inserisci il valore per license: ")
    pssh = input("Inserisci il valore per pssh: ")

    headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (Ktesttemp, like Gecko) Chrome/90.0.4430.85 Safari/537.36'}

    # Invia la richiesta al servizio CDRM-Project
    response = requests.post(api_url, headers=headers, json={"license": license_url, "pssh": pssh})
    result_json = response.json()

    # Estrai solo il valore della chiave
    key_value = result_json["keys"][0]["key"]

    # Stampa il risultato senza virgolette
    print(key_value)

    # Scrivi il risultato nel file chiave.txt
    with open('chiave.txt', 'w') as file:
    file.write(key_value)
    I started writing the script, I'm at a good point. I implemented cdrm-project API

    how does it work?
    1.enter series name
    2.enter season number
    3. enter episode number (added a counter)
    4. insert mpd link (via stream detector) (ps. write "reset" to return to point 1)
    5.enter license (f12 tab network)
    6.enter init data (via emelogger)
    at this point N-m3u8DL-RE starts automatically. at the end of the process go back to point 4

    the final objective is to join the automatic points 4 - 5 - 6. anyone want to collaborate?

    requirements: Put these files in the same folder together with the batch

    ffmpeg.exe
    mkvmerge.exe
    mp4decrypt.exe
    mp4mux.exe
    N_m3u8DL-RE.exe
    Quote Quote  
  5. Originally Posted by RobbieDS View Post
    the final objective is to join the automatic points 4 - 5 - 6. anyone want to collaborate?
    I only made a script with mpd url and keys, reused the l3 script to acquire keys with cdm.
    Quote Quote  
  6. Search, Learn, Download! Karoolus's Avatar
    Join Date
    Oct 2022
    Location
    Belgium
    Search Comp PM
    Why not fetch all the other information automatically as well, so you don't need any manual input apart from the show/season url.
    Dive in the developer console and check where the metadata/mpd url/tokens/... are requested and imitate those requests from your code.
    Quote Quote  
  7. Member
    Join Date
    Dec 2023
    Location
    Italy
    Search PM
    my computer skills are limited.. I'm looking for someone to help me complete the script. I find it complicated to extract data from the stream detector and emelogger extension.. I'm already saving a lot of time with this script. it would be wonderful to implement the other steps as well
    Quote Quote  
  8. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Originally Posted by RobbieDS View Post
    my computer skills are limited.. I'm looking for someone to help me complete the script. I find it complicated to extract data from the stream detector and emelogger extension.. I'm already saving a lot of time with this script. it would be wonderful to implement the other steps as well
    if your computer skills are limited then you have the rest of your life to improve them. Eventually you'll be able to write your own scripts rather than begging others to work for you for free.

    Find a script on VH as a framework or starting point and adapt that. I started by adapting l3.py within WKS-KEYS; that got the keys for me and I added some simply automation to use yt-dlp to download and other routines to decrypt, combine and save files. If you've been in a school since after the mid 1980s you will have had lessons in computing.

    Learn python https://www.w3schools.com/python/ and help yourself join the 21st Century
    Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes6.zip
    Quote Quote  
  9. Originally Posted by RobbieDS View Post
    @echo off
    setlocal enabledelayedexpansion

    set "serie="
    set "stagione=01"
    set "numeroPuntata=1"
    set "contatoreFile=contatore.txt"
    set "primaVolta=true"

    :mainLoop
    if /i "!serie!" equ "reset" set "primaVolta=true"

    if "%primaVolta%"=="true" (
    set "serie="
    set "stagione=01"
    set "numeroPuntata=1"
    set /p "serie=Inserisci il nome della serie: "
    if not defined serie goto :eof

    set /p "stagione=Inserisci il numero della stagione: "
    if not defined stagione goto :eof

    set /p "numeroPuntata=Inserisci il numero della puntata: "
    if not defined numeroPuntata goto :eof

    set "primaVolta=false"
    )

    rem Richiedi all'utente di inserire manualmente il link
    set /p "link=Inserisci il link: "
    if /i "!link!" equ "reset" set "primaVolta=true" & goto :mainLoop
    if not defined link goto :eof

    rem Costruisci il nome della puntata con il numero formattato
    set "numeroPuntataFormatted=00%numeroPuntata%"
    set "numeroPuntataFormatted=!numeroPuntataFormatte d:~-2!"
    set "nomePuntata=!serie! !stagione!x!numeroPuntataFormatted!"

    rem Esegui lo script Python per ottenere chiave
    python script.py

    rem Leggi chiave dal file generato dallo script Python (rimuovi eventuali spazi bianchi)
    set /p "chiave=" < "chiave.txt"
    set "chiave=!chiave: =!"

    rem Esegui il comando N_m3u8DL-RE con i parametri
    N_m3u8DL-RE -sv best -sa all -ss all --key !chiave! "!link!" --header "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" --header "Referer: https://www.nowtv.it/" -M format=mkv --save-name "!nomePuntata!"

    rem Incrementa il numero della puntata
    set /a "numeroPuntata+=1"

    rem Salva il contatore delle puntate nel file
    echo !numeroPuntata! > "%contatoreFile%"

    goto :mainLoop


    script.py
    import requests
    import json
    import os

    api_url = "https://cdrm-project.com/api"

    # Richiedi all'utente di inserire manualmente "license" e "pssh"
    license_url = input("Inserisci il valore per license: ")
    pssh = input("Inserisci il valore per pssh: ")

    headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (Ktesttemp, like Gecko) Chrome/90.0.4430.85 Safari/537.36'}

    # Invia la richiesta al servizio CDRM-Project
    response = requests.post(api_url, headers=headers, json={"license": license_url, "pssh": pssh})
    result_json = response.json()

    # Estrai solo il valore della chiave
    key_value = result_json["keys"][0]["key"]

    # Stampa il risultato senza virgolette
    print(key_value)

    # Scrivi il risultato nel file chiave.txt
    with open('chiave.txt', 'w') as file:
    file.write(key_value)
    I started writing the script, I'm at a good point. I implemented cdrm-project API

    how does it work?
    1.enter series name
    2.enter season number
    3. enter episode number (added a counter)
    4. insert mpd link (via stream detector) (ps. write "reset" to return to point 1)
    5.enter license (f12 tab network)
    6.enter init data (via emelogger)
    at this point N-m3u8DL-RE starts automatically. at the end of the process go back to point 4

    the final objective is to join the automatic points 4 - 5 - 6. anyone want to collaborate?

    requirements: Put these files in the same folder together with the batch

    ffmpeg.exe
    mkvmerge.exe
    mp4decrypt.exe
    mp4mux.exe
    N_m3u8DL-RE.exe
    so cool

    For me, I created my own GUI to get the keys and start the download, it's not the fastest way but it saves me a lot of time
    Image
    [Attachment 76410 - Click to enlarge]
    Quote Quote  
  10. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Originally Posted by imr_saleh View Post

    so cool

    For me, I created my own GUI to get the keys and start the download, it's not the fastest way but it saves me a lot of time
    Why not share instead of bragging?
    Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes6.zip
    Quote Quote  
  11. Originally Posted by A_n_g_e_l_a View Post
    Originally Posted by imr_saleh View Post

    so cool

    For me, I created my own GUI to get the keys and start the download, it's not the fastest way but it saves me a lot of time
    Why not share instead of bragging?
    Dude even has a github
    Quote Quote  
  12. Originally Posted by A_n_g_e_l_a View Post
    Originally Posted by imr_saleh View Post

    so cool

    For me, I created my own GUI to get the keys and start the download, it's not the fastest way but it saves me a lot of time
    Why not share instead of bragging?
    not bragging 😅

    I'm planning to share it on GitHub, but first I have to fix some errors.

    it will take some time Because work takes up most of my time
    Quote Quote  
  13. Originally Posted by imr_saleh View Post
    Originally Posted by A_n_g_e_l_a View Post
    Originally Posted by imr_saleh View Post

    so cool

    For me, I created my own GUI to get the keys and start the download, it's not the fastest way but it saves me a lot of time
    Why not share instead of bragging?
    not bragging 😅

    I'm planning to share it on GitHub, but first I have to fix some errors.

    it will take some time Because work takes up most of my time
    Any Update ??
    Quote Quote  
  14. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Originally Posted by justnerd View Post
    Originally Posted by imr_saleh View Post
    I'm planning to share it on GitHub, but first I have to fix some errors.
    it will take some time Because work takes up most of my time
    Any Update ??
    Looked finished when the image was posted...

    Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes6.zip
    Quote Quote  



Similar Threads

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