From 1beebb7bead2ab8338287ae0dd1c9846a0025aa7 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Sun, 5 Jul 2015 21:51:58 +0200 Subject: [PATCH] mtvnn: they changed how the id is present in the text. fixes #243 --- lib/svtplay_dl/service/mtvnn.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/svtplay_dl/service/mtvnn.py b/lib/svtplay_dl/service/mtvnn.py index f52aeab..4df0ebb 100644 --- a/lib/svtplay_dl/service/mtvnn.py +++ b/lib/svtplay_dl/service/mtvnn.py @@ -4,7 +4,7 @@ import os import xml.etree.ElementTree as ET from svtplay_dl.service import Service, OpenGraphThumbMixin -from svtplay_dl.utils import get_http_data, is_py2_old +from svtplay_dl.utils import get_http_data, is_py2_old, check_redirect, urlparse from svtplay_dl.log import log from svtplay_dl.fetcher.rtmp import RTMP @@ -17,12 +17,11 @@ class Mtvnn(Service, OpenGraphThumbMixin): if error: log.error("Can't get the page") return - match = re.search(r'mrss\s+:\s+"([^"]+)"', data) + match = re.search(r'"(http://api.mtvnn.com/v2/mrss.xml[^"]+)"', data) if not match: log.error("Can't find id for the video") return - swfurl = re.search(r'embedSWF\( "([^"]+)"', self.get_urldata()[1]) - options.other = "-W %s" % swfurl.group(1) + error, data = get_http_data(match.group(1)) if error: log.error("Cant get video info") @@ -40,6 +39,10 @@ class Mtvnn(Service, OpenGraphThumbMixin): if self.exclude(options): return + swfurl = mediagen.find("{http://search.yahoo.com/mrss/}player").attrib["url"] + parse = urlparse(swfurl) + options.other = "-W %s://%s%s" % (parse.scheme, parse.hostname, check_redirect(swfurl)) + contenturl = mediagen.find("{http://search.yahoo.com/mrss/}content").attrib["url"] error, content = get_http_data(contenturl) if error: