Skip to content

Instantly share code, notes, and snippets.

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
For de 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:
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: we can replace episode with video as well but it shouldn't matter. Do use the correct network ( in this case) as well! The replaced version will look like this:

Then either use the universally media rss feed or (for only)

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"></guid> as it's the same as the video id.

Now we can build the mediagenerator link like this:

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.

Copy link

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