Example #1
0
def itermedias(ctvcid, ctvcids=None):
    if not ctvcids:
        ctvcids = [ctvcid]
    for ctvcid in ctvcids:
        u = domain + "/" + ctvcid
        iframe1 = htmlement.fromstring(net.http(
            u, referer=domain)).find(".//iframe").get("src")
        iframe2 = htmlement.fromstring(net.http(
            iframe1, referer=u)).find(".//iframe").get("src")
        src = net.http(iframe2, referer=iframe1)
        media = re.search(
            "file[\s\t]*?\:[\s\t]*?atob\((?:\"|\')(.+?)(?:\"|\')\)", src)
        if media:
            yield net.hlsurl(base64.b64decode(media.group(1)).decode(),
                             headers={"referer": domain})
        else:
            for script in htmlement.fromstring(src).iterfind(".//script"):
                if script.get("src") and "yayin" in script.get("src"):
                    scriptsrc = net.http(script.get("src"), referer=domain)
                    key = re.search(rgxkey, scriptsrc)
                    if key:
                        for link in re.findall(rgxlink, scriptsrc):
                            if "anahtar" in link:
                                link = net.absurl(link, script.get("src"))
                                yield net.hlsurl(link + key.group(1),
                                                 headers={"referer": domain})
                                break
 def get(self):
     link = self.getlink()
     if "ZDF" in self.sender:
         links = util.get_ZDFstreamlinks()
     elif "ARD" in link:
         links = util.get_ARDstreamlinks()
     elif "ZDF" in link:
         links = util.get_ZDFstreamlinks()
     else:
         yield net.hlsurl(link)
         raise StopIteration
     for link in links:
         sender, url, _img, _ = link.split("|")
         if sender == self.sender:
             yield net.hlsurl(url)
             break
Example #3
0
def itermedias(chid, chids=None, adaptive=True):
    if not chids:
        chids = [chid]
    for chid in chids:
        url = domain + chid
        up = parse.urlparse(url)
        chid = up.path.split("/")[-1]
        subpage = htmlement.fromstring(net.http(url, referer=domain))
        embedlink = subpage.find(".//iframe").get("src")
        embedpage = htmlement.fromstring(net.http(embedlink, referer=url))
        script = embedpage.find(".//script[@id='v']")
        jsurl = "%s://%s/embed/%s" % (up.scheme, up.netloc, chid)
        data = {"e": 1, "id": script.get("data-i")}
        scode = net.http(jsurl,
                         referer=embedlink,
                         data=data,
                         headers={"x-requested-with": "XMLHttpRequest"},
                         method="POST")
        url = None
        scode = scode.replace("-", "+")
        scode = scode.replace("_", "/")
        scode = scode[::-1]
        for suffix in ["", "=", "=="]:
            try:
                url = base64.b64decode(scode + suffix)
                break
            except Exception:
                continue
        if url:
            url = url.decode()
            yield net.hlsurl(url,
                             headers={"referer": domain},
                             adaptive=adaptive)
Example #4
0
def itermedias(chfilter, isadaptive=True):
    if chfilter:
        found = False
        for selcukurl, url, chname in iteratechannels():
            if chfilter == normalize(chname):
                found = True
                break
        if found:
            links = url.split("#")
            up = parse.urlparse(links[0])
            chdict = dict(parse.parse_qsl(up.query))
            if "id" in chdict:
                subpage = net.http(links[0], referer=selcukurl, cache=None)
                olmusmu = re.findall(rgx1, subpage)
                if len(olmusmu) == 2:
                    # olmusmu = [parse.unquote(x) for x in olmusmu]
                    keslan = re.search(rgx6, subpage)
                    kourl = "%s://%s/%s" % (up.scheme, up.netloc,
                                            keslan.group(1))
                    kopage = net.http(kourl, referer=selcukurl, cache=None)
                    bases = [
                        base64.b64decode(x).decode()
                        for x in re.findall(rgx4, kopage)
                    ]
                    _radardom = bases.pop(-1)
                    selcukdom = bases.pop(-1)
                    for base in bases:
                        media = "https://" + base + selcukdom + "/i/" + olmusmu[
                            1] + "/" + chdict[
                                "id"] + "/playlist.m3u8" + olmusmu[0]
                        yield net.hlsurl(media,
                                         headers={"referer": url},
                                         adaptive=isadaptive)
Example #5
0
def mobile_itermedias(chid, isadaptive=True):
    # https://app.selcuksportsappltf.com/app/belgesel.json
    mdom = "https://app.selcuksportsappltf.com/app/"
    jsu = "%skanal/%s.json" % (mdom, chid)
    js = net.http(jsu, json=True)
    for result in js.get("results", []):
        m3u = result.get("m3u8_url")
        if m3u:
            yield net.hlsurl(m3u, adaptive=isadaptive)
Example #6
0
 def get(self):
     page = self.download(self.domain)
     js = re.search(r'data-ctrl-player="(.+?)"', page).group(1)
     js = re.search(r'url(?:\'|\")\s*?\:\s*?(?:\'|\")(.+?)(?:\'|\")',
                    js).group(1)
     jsdata = json.loads(
         self.download(self.domain2 + js,
                       referer=self.domain2 + "index.html"))
     yield net.hlsurl(
         jsdata["mc"]["_alternativeMediaArray"][0]["_mediaArray"][0]
         ["_mediaStreamArray"][0]["_stream"][0])
Example #7
0
def itermedias(chlink, chlinks=None):
    if not chlinks:
        chlinks = [chlink]
    for chlink in chlinks:
        url = domain + chlink
        page = htmlement.fromstring(net.http(url, referer=domain))
        iurl = page.find(".//iframe").get("src")
        ipage = net.http(iurl, referer=url)
        wise = unwise.unwise(*re.findall(rgx, ipage)[0])
        wise = unwise.unwise(*re.findall(rgx, wise)[0])
        wise = unwise.unwise(*re.findall(rgx, wise)[1])
        media = re.search(rgx2, wise.replace("\\", "")).group(1)
        yield net.hlsurl(media, headers={"referer": domain + "/"})
 def get(self):
     u = "%s/ing/%s" % (domain, self.ysid)
     p = net.http(u, referer=domain)
     iframeu = htmlement.fromstring(p).find(".//iframe").get("src")
     iframep = net.http(iframeu, referer=u)
     m3path = re.search("atob\((?:\"|\')(.+?)(?:\"|\')\)", iframep).group(1)
     for suffix in ["", "=", "=="]:
         try:
             yield net.hlsurl(net.absurl(
                 base64.b64decode(m3path + suffix).decode(), iframeu),
                              headers={"Referer": iframeu})
             break
         except Exception:
             pass
Example #9
0
def itermedias(youtube_chanid, youtube_stream, youtube_sindex):
    try:
        u = "https://m.youtube.com/%s/videos?view=2&flow=list&live_view=501&" % youtube_chanid
        page = net.http(u, useragent=ua, headers={"Cookie": COOKIE})
        try:
            js = json.loads(
                re.search('<div id="initial-data"><!-- (.+?) -->',
                          page).group(1))
        except AttributeError:
            t = re.search("ytInitialData = '(.+?)'", page).group(1)
            js = json.loads(t.encode("utf-8").decode("unicode-escape"))
        streams = js["contents"]["singleColumnBrowseResultsRenderer"]["tabs"][
            1]["tabRenderer"]["content"]["sectionListRenderer"]["contents"][0][
                "itemSectionRenderer"]["contents"]
        sindex = None

        if youtube_stream:
            for sindex, stream in enumerate(streams):
                if youtube_stream(stream):
                    break

        if not sindex and youtube_sindex:
            sindex = youtube_sindex

        if sindex is None:
            sindex = 0
        vid = streams[sindex]["compactVideoRenderer"]["videoId"]
        # icon = js["metadata"]["channelMetadataRenderer"]["avatar"]["thumbnails"][0]["url"]
    except Exception:
        print(traceback.format_exc())
        return
    page = net.http("https://m.youtube.com/watch?v=%s" % vid,
                    useragent=ua,
                    headers={"Cookie": COOKIE})
    pconfig1 = re.search('ytInitialPlayerConfig = (\{.+?\})\;', page)
    if pconfig1:
        js = json.loads(pconfig1.group(1))
        response = json.loads(js["args"]["player_response"])
    else:
        response = json.loads(
            re.search('ytInitialPlayerResponse\s*?\=\s*?(\{.+?\})\;',
                      page).group(1))
    # dash = response["streamingData"].get("dashManifestUrl")
    # if dash:
    #     yield net.mpdurl(dash)
    yield net.hlsurl(response["streamingData"]["hlsManifestUrl"])
Example #10
0
def itermedias(dadyid=None, dadyname=None):
    if not dadyid:
        u = getchanurl(dadyname)
    else:
        u = "%s/embed/stream-%s.php" % (dom, dadyid)
    iframeu = htmlement.fromstring(net.http(u)).find(".//iframe").get("src")
    iframe = net.http(iframeu, referer=u)
    iframeu2 = re.search("iframe\s*?src=(?:\'|\")(.+?)(?:\'|\")",
                         iframe).group(1)
    iframe = net.http(iframeu2, referer=iframeu)
    src = re.findall(mrgx, iframe)
    ref = parse.urlparse(iframeu2)
    ref = "%s://%s/" % (ref.scheme, ref.netloc)
    yield net.hlsurl(src[-1],
                     headers={
                         "Referer": ref,
                         "User-Agent": ua
                     },
                     adaptive=False)
Example #11
0
 def get(self):
     page = self.download(self.domain + "/mediathek/live")
     link = re.search(r'publicLocation.+?"(.+?)"', page)
     yield net.hlsurl(link.group(1))
Example #12
0
 def geturl(self, url):
     if not isinstance(url, const.URL):
         url, headers = net.fromkodiurl(url)
         url = net.hlsurl(url, headers)
     return url