Mediaset Infinity Downloader is a typescript library to download Mediaset Infinity movies or tv-series. It uses yt-dlp to download the actual episodes.
To use mediaset-infinity-downloader, clone this repo and cd into the cloned folder. Then you have to install needed packages
# Install typescript runnernpm install --global ts-node# Install project packagesnpm install
Make yt-dlp
accessible to the script:
Download the executable (for your machine)
Put the executable into the folder src/executables
Tweak your src/user/config.ts
file making sure the ytDlpPath
is correct and the outputFolder
exists.
Fill in your src/user/episodes.ts
with an array of strings containing the episode or movie page. Example below
export default [ 'https://mediasetinfinity.mediaset.it/video/terraamara/episodio-243_F311851102010702', 'https://mediasetinfinity.mediaset.it/video/terraamara/episodio-242_F311851102010602',];
# cd into the project foldercd mediaset-infinitry-downloader# run the scriptnpm run start
By default yt-dlp uses the name that the .mp4 you are about to download as the output file name I've added in the config a way to programmatically change the output of the file name. Follow steps below to use it
Enable customOutputName
in the src/user/config.ts
Adjust customOutputNameFunction
to output a string that will be automatically be used as the file name for the corresponding element in the array.
Simplest, safest but most time-consuming
Open each episode page and copy the link manually.
Add it to episodes.ts
array surrounded by ticks.
Most prone to fail (if mediasetinfinity changes the page structure) but fastest
Scroll to the bottom in the episodes list page
Open browser console and paste this js copy($$('a[href*="/video/"]').map((x)=>x.href))
You will find in your clipboard the array of all episodes links
Paste the episodes array into the episodes.ts
file
Most reliable (requires some expertise)
Open an episodes list page (example: https://mediasetinfinity.mediaset.it/fiction/bitterlands/episodi_SE000000001766,ST000000003181,sb100018308)
Open devtools and go to Network Tab
Scroll to the bottom of the page
You will see a new type:'fetch'
request appearing named mediaset-prod-all-programs-v2
Right click then Copy > Copy as fetch
Go to Console Tab of the devtools
Paste the copied fetch (example below)
fetch("https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs-v2?byCustomValue={subBrandId} {100018308}&sort=:publishInfo_lastPublished|desc,tvSeasonEpisodeNumber|desc&range=1-1000", {"headers": { "accept": "*/*", "accept-language": "it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7", "sec-ch-ua": ""Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"", "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": ""Windows"", "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "cross-site"},"referrer": "https://mediasetinfinity.mediaset.it/","referrerPolicy": "strict-origin-when-cross-origin","body": null,"method": "GET","mode": "cors","credentials": "omit"});
Modify the range
queryParam to any number you want (in the example above i modified it to 1 to 1000)
Run the fetch
by pressing enter
Go back to Network Tab
Select the request we just did and in the preview tab right click entries
and press Copy value
.
Paste the episodes array into the episodes.ts
file