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
+ Reply to Thread
Results 1 to 16 of 16
-
-
If your aim is to do so from FREE-TO-WATCH sites then give an Freevine a try ....
-
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. -
@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)
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 -
-
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. -
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 CenturyNoob Starter Pack. Just download every Widevine mpd! Not kidding!.
https://files.videohelp.com/u/301890/hellyes6.zip -
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
[Attachment 76410 - Click to enlarge] -
Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
https://files.videohelp.com/u/301890/hellyes6.zip -
-
Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
https://files.videohelp.com/u/301890/hellyes6.zip -
Similar Threads
-
Steps for Peacock TV?
By intheory628 in forum Video Streaming DownloadingReplies: 126Last Post: 10th Jun 2025, 08:21 -
N_m3u8DL-RE: Learning About Scripts Baby Steps
By Tom Saurus in forum Video Streaming DownloadingReplies: 53Last Post: 5th Sep 2023, 15:40 -
Looking for Batch MP4 Normalization Script of existing script
By VideoFanatic in forum Video ConversionReplies: 6Last Post: 31st Jul 2021, 19:50 -
How to decrypt an mpd file. Steps please
By iscosilvabh in forum Video Streaming DownloadingReplies: 6Last Post: 3rd Jul 2021, 10:13 -
High speed (double speed) VHS scope
By RajkoBizjak in forum Camcorders (DV/HDV/AVCHD/HD)Replies: 7Last Post: 21st Mar 2021, 13:45