From ab2741f6bf57791bf62b06348fe3285b02b470f0 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Sun, 20 Mar 2016 21:04:09 +0100 Subject: [PATCH] solidtango: more ways to detect solidtango --- lib/svtplay_dl/service/__init__.py | 6 ++++++ lib/svtplay_dl/service/solidtango.py | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/svtplay_dl/service/__init__.py b/lib/svtplay_dl/service/__init__.py index 837b717..bc90ff9 100644 --- a/lib/svtplay_dl/service/__init__.py +++ b/lib/svtplay_dl/service/__init__.py @@ -156,6 +156,12 @@ class Generic(Service): for i in sites: if i.handles(url): return self.url, i(self.options, self.url) + match = re.search(r'src="([^.]+\.solidtango.com[^"+]+)"', data) + if match: + url = match.group(1) + for i in sites: + if i.handles(url): + return self.url, i(self.options, url) match = re.search('(lemonwhale|lwcdn.com)', data) if match: url = "http://lemonwhale.com" diff --git a/lib/svtplay_dl/service/solidtango.py b/lib/svtplay_dl/service/solidtango.py index a3ea6fb..2c24bb1 100644 --- a/lib/svtplay_dl/service/solidtango.py +++ b/lib/svtplay_dl/service/solidtango.py @@ -2,15 +2,17 @@ # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- from __future__ import absolute_import import re +import xml.etree.ElementTree as ET from svtplay_dl.service import Service from svtplay_dl.fetcher.hls import hlsparse from svtplay_dl.error import ServiceError +from svtplay_dl.utils.urllib import urlparse class Solidtango(Service): supported_domains_re = [r'^([^.]+\.)*solidtango.com'] - supported_domains = ['mm-resource-service.herokuapp.com'] + supported_domains = ['mm-resource-service.herokuapp.com', 'solidtango.com'] def get(self): data = self.get_urldata() @@ -37,5 +39,14 @@ class Solidtango(Service): for n in list(streams.keys()): yield streams[n] else: - yield ServiceError("Can't find video info. if there is a video on the page. its a bug.") - return \ No newline at end of file + parse = urlparse(self.url) + url2 = "https://%s/api/v1/play/%s.xml" % (parse.netloc, parse.path[parse.path.rfind("/")+1:]) + data = self.http.request("get", url2) + if data.status_code != 200: + yield ServiceError("Can't find video info. if there is a video on the page. its a bug.") + return + xml = ET.XML(data.text) + elements = xml.findall(".//manifest") + streams = hlsparse(self.options, self.http.request("get", elements[0].text), elements[0].text) + for n in list(streams.keys()): + yield streams[n]