コード例 #1
0
ファイル: plus7.py プロジェクト: erick-guerra/Royalbox
    def get_video_id(self):
        doc = grab_html(self.url, 3600)
        for script in doc.xpath("//script"):
            if not script.text:
                continue
            for line in script.text.split(";"):
                line = line.strip()
                if line.find("new Y.VideoPlatform.VideoPlayer") <= 0:
                    continue


###				vidparams = line[line.find("(")+1 : line.rfind(")")]
###				vidparams = json.loads(vidparams)
###				return vidparams["playlist"]["mediaItems"][0]["id"]

# Cannot parse it as JSON :(
                pos1 = line.find('"mediaItems":')
                if pos1 < 0:
                    continue
                pos2 = line.find('"id":', pos1)
                if pos2 < 0:
                    continue
                pos3 = line.find('"', pos2 + 5)
                pos4 = line.find('"', pos2 + 6)
                if pos3 < 0 or pos4 < 0:
                    continue
                return line[pos3 + 1:pos4]

        raise Exception("Could not find video id on page " + self.url)
コード例 #2
0
ファイル: plus7.py プロジェクト: ryanf86/AusTV-WebDL
	def get_video_id(self):
		doc = grab_html(self.url, 3600)
		for script in doc.xpath("//script"):
			if not script.text:
				continue
			for line in script.text.split(";"):
				line = line.strip()
				if line.find("new Y.VideoPlatform.VideoPlayer") <= 0:
					continue

###				vidparams = line[line.find("(")+1 : line.rfind(")")]
###				vidparams = json.loads(vidparams)
###				return vidparams["playlist"]["mediaItems"][0]["id"]

				# Cannot parse it as JSON :(
				pos1 = line.find('"mediaItems":')
				if pos1 < 0:
					continue
				pos2 = line.find('"id":', pos1)
				if pos2 < 0:
					continue
				pos3 = line.find('"', pos2+5)
				pos4 = line.find('"', pos2+6)
				if pos3 < 0 or pos4 < 0:
					continue
				return line[pos3+1:pos4]

		raise Exception("Could not find video id on page " + self.url)
コード例 #3
0
ファイル: plus7.py プロジェクト: ryanf86/AusTV-WebDL
	def fill_children(self):
		doc = grab_html(self.url, 3600)
		for item in CSSSelector("#related-episodes div.itemdetails")(doc):
			title = CSSSelector("span.title")(item)[0].text
			subtitle = CSSSelector("span.subtitle")(item)[0].xpath("string()")
			title = demangle_title(title, subtitle)
			url = CSSSelector("a")(item)[0].attrib["href"]
			Plus7Node(title, self, BASE + url)
コード例 #4
0
ファイル: plus7.py プロジェクト: erick-guerra/Royalbox
 def fill_children(self):
     doc = grab_html(self.url, 3600)
     for item in CSSSelector("#related-episodes div.itemdetails")(doc):
         title = CSSSelector("span.title")(item)[0].text
         subtitle = CSSSelector("span.subtitle")(item)[0].xpath("string()")
         title = demangle_title(title, subtitle)
         url = CSSSelector("a")(item)[0].attrib["href"]
         Plus7Node(title, self, BASE + url)
コード例 #5
0
ファイル: plus7.py プロジェクト: ryanf86/AusTV-WebDL
	def fill_children(self):
		doc = grab_html(BROWSE, 3600)
		shows = []
		for script in doc.xpath("//script"):
			if not script.text or not script.text.startswith("var shows = "):
				continue
			shows = script.text[12:]
			shows = shows.rstrip("; \n")
			shows = json.loads(shows)
		for show in shows:
			Plus7Series(show["title"], self, show["url"])
コード例 #6
0
ファイル: plus7.py プロジェクト: erick-guerra/Royalbox
 def fill_children(self):
     doc = grab_html(BROWSE, 3600)
     shows = []
     for script in doc.xpath("//script"):
         if not script.text or not script.text.startswith("var shows = "):
             continue
         shows = script.text[12:]
         shows = shows.rstrip("; \n")
         shows = json.loads(shows)
     for show in shows:
         Plus7Series(show["title"], self, show["url"])
コード例 #7
0
ファイル: sbs.py プロジェクト: ryanf86/AusTV-WebDL
    def download(self):
        doc = grab_html(VIDEO_URL % self.video_id, 0)
        player_params = self.get_player_params(doc)
        release_url = player_params["releaseUrls"]["html"]

        doc = grab_xml(release_url, 0)
        video = doc.xpath("//smil:video", namespaces=NS)[0]
        video_url = video.attrib["src"]
        if not video_url:
            raise Exception("Unsupported video %s: %s" % (self.video_id, self.title))
        filename = self.title + ".ts"
        return download_hls(filename, video_url)
コード例 #8
0
ファイル: sbs.py プロジェクト: erick-guerra/Royalbox
    def download(self):
        doc = grab_html(VIDEO_URL % self.video_id, 0)
        player_params = self.get_player_params(doc)
        release_url = player_params["releaseUrls"]["html"]

        doc = grab_xml(release_url, 0)
        video = doc.xpath("//smil:video", namespaces=NS)[0]
        video_url = video.attrib["src"]
        if not video_url:
            raise Exception("Unsupported video %s: %s" %
                            (self.video_id, self.title))
        filename = self.title + ".ts"
        return download_hls(filename, video_url)
コード例 #9
0
    def download(self):
        with requests_cache.disabled():
            doc = grab_html(VIDEO_URL % self.video_id)
        player_params = self.get_player_params(doc)

        error = player_params.get("error", None)
        if error:
            print("Cannot download:", error)
            return False

        release_url = player_params["releaseUrls"]["html"]
        filename = self.title + ".ts"

        hls_url = self.get_hls_url(release_url)
        if hls_url:
            return download_hls(filename, hls_url)
        else:
            return download_mpd(filename, release_url)