# ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- from __future__ import absolute_import import sys import re import xml.etree.ElementTree as ET from svtplay_dl.service import Service from svtplay_dl.utils import get_http_data, select_quality from svtplay_dl.log import log from svtplay_dl.fetcher.rtmp import download_rtmp class Qbrick(Service): def handle(self, url): return ("dn.se" in url) or ("di.se" in url) or ("svd.se" in url) def get(self, options, url): if re.findall("dn.se", url): data = get_http_data(url) match = re.search("data-qbrick-mcid=\"([0-9A-F]+)\"", data) if not match: match = re.search("mediaId = \'([0-9A-F]+)\';", data) if not match: log.error("Can't find video file") sys.exit(2) mcid = "%sDE1BA107" % match.group(1) else: mcid = match.group(1) host = "http://vms.api.qbrick.com/rest/v3/getsingleplayer/%s" % mcid elif re.findall("di.se", url): data = get_http_data(url) match = re.search("src=\"(http://qstream.*)\">