Skip to content

plugin.mildom: new plugin for mildom.com #3584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 4, 2021

Conversation

shirokumacode
Copy link
Contributor

Mildom is a Japanese video live streaming focused on gaming (similar to twitch) operated by DouYu Japan. I don't speak Japanese, however I came across this platform because of e-sports. This website is currently hosting Apex Global Series Winter Circuit APAC North (official main tournament of Apex Legends). I also came across Mildom before through Valorant, as some tournaments specific to Japan are streamed there. I wanted to watch the Apex tournament with Streamlink, and that was my main motivation for creating the plugin.

URL patterns:
Livestream- https://www.mildom.com/10707087(user's page)
VOD (archive)- https://www.mildom.com/playback/10707087/10707087-c0p1d4d2lrnb79gc0kqg

The API (Json based) endpoints to obtain the .m3u8 stream lists were fairly easily to discover with the browser inspector. However the url is different for livestreams and VODs.
Note: The live API only requires a extra argument aside from the user id -> __platform=web (if this is not set it will return a error)
It doesn't require any additional handshakes,cookies,etc

I impletemented checks for the API return code (0 is OK) and to check if a streamer is live (anchor_code = 11).

@shirokumacode
Copy link
Contributor Author

shirokumacode commented Feb 27, 2021

After writing a small script to fetch live channels and test them, I was able to find out why and find the outliers.

import streamlink
import json
import requests
import os

from streamlink.exceptions import PluginError

CHANNEL_LIST_URL = "https://cloudac.mildom.com/nonolive/gappserv/channel/detailList?__platform=web&channel_key=all_game&tag_id=all&limit={}"
USER_PAGE_URL = "https://www.mildom.com/{}"

num_users_test = 20

r = requests.get(CHANNEL_LIST_URL.format(num_users_test))
users = [user["user_id"] for user in r.json()["body"]["models"]]

for user in users:
    print(USER_PAGE_URL.format(user), end='\t\t') 
    try:
        streamlink.streams(USER_PAGE_URL.format(user))   
        #os.system("streamlink " + USER_PAGE_URL.format(user) + " best") 
        print('OK')
    except KeyError:
        print("ERROR")
    except PluginError:
        print("OFFLINE")
    except KeyboardInterrupt:
        exit()

It seems that if the user has DVR features on livestreams disabled the streams I used are not available (and if they are available has small delay compared to live). I tested with 6 before and they all worked, guess I was lucky.

I found another way to get the streams. There is request that retrieves the base url where the streams are located. Based on that it is possible to construct the final URL to the m3u8 files. To access these files you need set 'referer' as a header however.

I corrected and pushed the changes. I have tested for a huge number of live streams now and so far they all worked on my end. Please review the changes and check if it all works now.

@shirokumacode shirokumacode requested a review from back-to March 2, 2021 17:46
@gravyboat
Copy link
Member

@back-to Can you re-review this when you have time please?

@back-to back-to merged commit 5579278 into streamlink:master Jun 4, 2021
Billy2011 pushed a commit to Billy2011/streamlink-27 that referenced this pull request Jun 8, 2021
Billy2011 pushed a commit to Billy2011/streamlink-27 that referenced this pull request Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants