Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MTV Network

In order to be able to download videos from mtv (no matter the country and various other sites of their network) we need the mgid.

One of the easiest ways is the following:
For com https://www.mtv.com/feeds/triforce/manifest/v8?url=http%3A%2F%2Fwww.mtv.com%2Fepisodes%2F4iqsts%2Frevenge-prank-the-prank-that-hits-the-jackpot-season-1-ep-16
For de https://www.mtv.de/feeds/triforce/manifest/v8?url=http%3A%2F%2Fwww.mtv.de%2Ffolgen%2Fhxzmi4%2Fgeordie-shore-die-neue-chloe-S21-F7 and so on.

Note that url=http (!) if you try to use https it won't work for now but MTV is about to change their system to using https.
So there should be some error handling built in (site will return json with 404).
There is also another case which needs to be handled:
{"manifest":{"type":"redirect","newLocation":"http://www.mtv.com/episodes/4iqsts/revenge-prank-the-prank-that-hits-the-jackpot-season-1-ep-116"}}
This means we have to probe the feed again with the new url.

As a result we get a manifest. It contains various informations. The most important for us now is the itemId as we can either download another feed to get the mgid or simply build it on our own with the itemId.

For the mgid we simply need something like this:
mgid:arc:episode:mtv.com:itemId we can replace episode with video as well but it shouldn't matter. Do use the correct network (mtv.com in this case) as well! The replaced version will look like this:
mgid:arc:episode:mtv.com:7d923db1-a492-11ea-9225-70df2f866ace

Then either use the universally media rss feed http://feeds.mtvnservices.com/od/feed/intl-mrss-player-feed?arcEp=mtv.com&mgid=mgid%3Aarc%3Aepisode%3Amtv.com%3A7d923db1-a492-11ea-9225-70df2f866ace or (for mtv.com only)
https://www.mtv.com/feeds/mrss/?uri=mgid%3Aarc%3Aepisode%3Amtv.com%3A7d923db1-a492-11ea-9225-70df2f866ace

There we could use the the content video url or build it ourself since we need to modify the query anyway.
Without modification it will give us some encrypted rtmp streams (rtmpe) which we cannot properly use.
Instead we will grab the hls (dash is also available but I haven't figured out how to grab better qualities if that is even possible)

So the mrss feed may have several items. Each item has a media:group there we gonna need media:category scheme="urn:mtvn:id.
It's the id of each separate (if multiple) video.
As a backup we can also try to get this value <guid isPermaLink="false">mgid:arc:video:mtv.com:ab59f422-eff8-437a-81a0-345c0cf47c85</guid> as it's the same as the video id.

Now we can build the mediagenerator link like this:
https://media-utils.mtvnservices.com/services/MediaGenerator/mgid:arc:video:mtv.com:ab59f422-eff8-437a-81a0-345c0cf47c85?format=json&acceptMethods=hls

We gonna do that for each item in the mrss feed. In the end we need to concat all parts together.
So it comes in handy if we append the index number of each item to the file name or simply use the title.

All that is left is to download the master playlist which contains all different qualities as dedicated playlists.
After picking a quality feed the playlist to a hls downloader.

The itemId may also be found in the html doc directly tho it depends on the network how they are named.

There are different device types such as iPad, Android, Xbox etc. some of them may require or can use additional queries.

@StevenDTX

This comment has been minimized.

Copy link

@StevenDTX StevenDTX commented Oct 9, 2020

You are amazing for explaining all of this! Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment