예제 #1
0
 def getVideo(self):
     src_container = RegExpResponseContainer(
         kakadmApi.getVideoUrl(self.aid, self.pid),
         src=(r"vid=(.*)\'", lambda x: x[4:-1:]),
     )
     self.src = src_container.data["src"]
     container = RegExpResponseContainer(
         kakadmApi.resolveVideoUrl(self.src),
         real_url=(r"url:\"(.*)\"", lambda x: x[5:-1:]),
         strip=" ",
     )
     real_url = container.data["real_url"]
     return MediaSource(
         container.data["real_url"], Config.commonHeaders,
         "{}.{}".format(self.title, file.getSuffixByUrl(real_url)))
예제 #2
0
 def load(self, **kwargs):
     if self.ep_id == "":
         return
     container = RegExpResponseContainer(
         videoApi.getBangumiInfo(self.ep_id),
         state=(r"__INITIAL_STATE__={(.*?)]};", lambda x: x[18:-1:]))
     initial_state = json.loads(container.data["state"])
     self.title = initial_state["mediaInfo"]["title"]
     self.cover_url = "https:" + initial_state["mediaInfo"]["cover"]
     eplist = initial_state["epList"]
     self.bid = eplist[0]["bvid"]
     self.currentPage = 1
     pages = []
     epid = ""
     if "ep" in self.ep_id:
         epid = str(re.search(r"ep[0-9]+", self.ep_id).group()[2:])
     for index, ep in enumerate(eplist, start=1):
         pages.append({
             "page":
             index,
             "pagename":
             "%s %s" % (ep["titleFormat"], ep["longTitle"]),
             "cid":
             ep["cid"]
         })
         if epid == str(ep["id"]):
             self.currentPage = index
     self.pages = pages
예제 #3
0
 def load(self):
     if self.bid == "": return
     container = RegExpResponseContainer(wenku8api.getBookInfo(self.bid),
                                         info=(r"<title>(.*)</title>",
                                               lambda x: x[7:-8:]))
     title = container.data["info"].split(" - ")
     self.publisher = title[2]
     self.author = title[1]
     self.title = title[0]
예제 #4
0
 def load(self, **kwargs):
     container = RegExpResponseContainer(
         imomoeApi.getVideoInfo(self.id, self.source_id, self.ep_id),
         title=(r"xTitle='(.*)'", lambda x: x[8:-1:]),
         playdata_url=(r"src=\"/playdata/(.*)\"", lambda x: x[5:-1:]))
     self.title = container.data["title"]
     playdata_url = container.data["playdata_url"]
     playdata = RegExpResponseContainer(imomoeApi.getPlaydata(playdata_url),
                                        videolist=(r"=\[(.*)\],",
                                                   lambda x: x[1:-1:]))
     for index, part in enumerate(
             json.loads(playdata.data["videolist"].replace("'", "\""))):
         sid = str(index)
         self.episodes[sid] = []
         for url in part[1]:
             tmp = url.split("$")
             self.episodes[sid].append({
                 "title": tmp[0],
                 "src": tmp[1],
                 "format": tmp[2]
             })
예제 #5
0
 def getVideo(self, source_id: str = "-1", ep_id: str = "-1"):
     source_id, ep_id = str(source_id), str(ep_id)
     source_id = self.source_id if source_id == "-1" else source_id
     ep_id = self.ep_id if ep_id == "-1" else ep_id
     data = self.episodes[source_id][int(ep_id)]
     container = RegExpResponseContainer(
         imomoeApi.resolveVideoUrl(data["src"]),
         real_url=("varvideo='(.*)';", lambda x: x[10:-2:]),
         strip=" ")
     real_url = container.data["real_url"]
     return MediaSource(
         real_url, Config.commonHeaders,
         "{}-{}.{}".format(self.title, data["title"],
                           file.getSuffixByUrl(real_url)))
예제 #6
0
    def load(self, **kwargs):

        # raw_html = httpGet(self.player_url.format(aid=self.aid, pid=self.pid),
        #                    cookies=Config.getCookie("kakadm"))
        # html_text = raw_html.content.decode("utf-8").replace("\r", "").replace("\n", "")
        # self.title = re.search(r"play_title=\"((?!\";).)*\";", html_text).group()[12:-2:]
        container = RegExpResponseContainer(
            kakadmApi.getVideoInfo(self.aid, self.pid),
            strip=["\r", "\n"],
            title=(r"play_title=\"((?!\";).)*\";", lambda x: x[12:-2:]),
            movurls=r"<div class=\"movurls\">((?!</div>).)*</div>")
        self.title = container.data["title"]
        self.pid_list = [
            str(i)
            for i in range(1, container.data["movurls"].count("</li>") + 1)
        ]

        data_html = httpGet(
            self.src_api.format(aid=self.aid, pid=self.pid),
            cookies=Config.getCookie("kakadm")).content.decode("utf-8")
        self.src = re.search(r"vid=(.*)\'", data_html).group()[4:-1:]