当前位置: 首页>>代码示例>>Python>>正文


Python client.source函数代码示例

本文整理汇总了Python中modules.libraries.client.source函数的典型用法代码示例。如果您正苦于以下问题:Python source函数的具体用法?Python source怎么用?Python source使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了source函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_movie

    def get_movie(self, imdb, title, year):
        try:
            search = 'http://www.omdbapi.com/?i=tt%s' % imdb
            search = client.source(search)
            search = json.loads(search)
            country = [i.strip() for i in search['Country'].split(',')]
            if not 'India' in country: return

            languages = ['hindi', 'tamil', 'telugu', 'malayalam']
            language = [i.strip().lower() for i in search['Language'].split(',')]
            language = [i for i in language if any(x == i for x in languages)][0]

            query = self.search_link % (urllib.quote_plus(title), language)
            query = urlparse.urljoin(self.base_link, query)

            result = client.source(query)
            result = client.parseDOM(result, "div", attrs = { "class": "search-category" })
            result = [i for i in result if 'Movies' in client.parseDOM(i, "p")[0]][0]
            result = client.parseDOM(result, "li")

            title = cleantitle.movie(title)
            years = ['(%s)' % str(year), '(%s)' % str(int(year)+1), '(%s)' % str(int(year)-1)]
            result = [(client.parseDOM(i, "a", ret="href")[0], client.parseDOM(i, "a")[0]) for i in result]
            r = [i for i in result if any(x in i[1] for x in years)]
            if not len(r) == 0: result = r
            result = [i[0] for i in result if title == cleantitle.movie(i[1])][0]

            try: url = re.compile('//.+?(/.+)').findall(result)[0]
            except: url = result
            url = url.replace('../', '/')
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
开发者ID:MrChuco213,项目名称:team.expat,代码行数:35,代码来源:einthusan_mv.py

示例2: get_show

    def get_show(self, imdb, tvdb, show, show_alt, year):


        # import logging
        # LOG_FILENAME = '/home/keeganmccallum/test.log'
        # logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)

        # logging.debug(','.join([imdb, tvdb, show, show_alt, year]))

        try:
            result = client.source(self.base_link)
            if not "'index show'" in result:
                cookie = client.source(self.sign_link, post=self.key_link, output='cookie')
                result = client.source(self.base_link, cookie=cookie)

            result = client.parseDOM(result, "div", attrs = { "class": "index show" })
            result = [(client.parseDOM(i, "a", attrs = { "class": "name" })[0], client.parseDOM(i, "span", attrs = { "class": "value" })[0], client.parseDOM(i, "a", ret="href")[0]) for i in result]

            shows = [cleantitle.tv(show), cleantitle.tv(show_alt)]
            years = [str(year), str(int(year)+1), str(int(year)-1)]
            result = [i for i in result if any(x in i[1] for x in years)]
            result = [i[2] for i in result if any(x == cleantitle.tv(i[0]) for x in shows)][0]

            try: url = re.compile('//.+?(/.+)').findall(result)[0]
            except: url = result
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
开发者ID:keeganmccallum,项目名称:lambda-addons,代码行数:30,代码来源:ororo_tv.py

示例3: get_show

    def get_show(self, imdb, tvdb, show, show_alt, year):
        try:
            result = client.source(self.base_link)
            if not "'index show'" in result:
                cookie = client.source(self.sign_link, post=self.key_link, output="cookie")
                result = client.source(self.base_link, cookie=cookie)

            result = client.parseDOM(result, "div", attrs={"class": "index show"})
            result = [
                (
                    client.parseDOM(i, "a", attrs={"class": "name"})[0],
                    client.parseDOM(i, "span", attrs={"class": "value"})[0],
                    client.parseDOM(i, "a", ret="href")[0],
                )
                for i in result
            ]

            shows = [cleantitle.tv(show), cleantitle.tv(show_alt)]
            years = [str(year), str(int(year) + 1), str(int(year) - 1)]
            result = [i for i in result if any(x in i[1] for x in years)]
            result = [i[2] for i in result if any(x == cleantitle.tv(i[0]) for x in shows)][0]

            try:
                url = re.compile("//.+?(/.+)").findall(result)[0]
            except:
                url = result
            url = client.replaceHTMLCodes(url)
            url = url.encode("utf-8")
            return url
        except:
            return
开发者ID:Mendim,项目名称:tdbaddon,代码行数:31,代码来源:ororo_tv.py

示例4: get_movie

    def get_movie(self, imdb, title, year):
        try:
            query = self.search_link % (urllib.quote_plus(title))
            query = urlparse.urljoin(self.base_link, query)

            result = client.source(query)
            if result == None: result = client.source(self.agent_link + urllib.quote_plus(query))

            result = result.replace('\r','').replace('\n','').replace('\t','')

            result = re.compile('(<div id="*\d*.+?</div>)').findall(result)

            title = cleantitle.movie(title)
            years = ['%s' % str(year), '%s' % str(int(year)+1), '%s' % str(int(year)-1)]

            result = [(re.compile('id="*(\d*)"*').findall(i), re.compile('<h4>(.+?)</h4>').findall(i), re.compile('Releasedatum *: *(\d{4})').findall(i)) for i in result]
            result = [(i[0][0], i[1][0], i[2][0]) for i in result if len(i[0]) > 0 and len(i[1]) > 0 and len(i[2]) > 0]
            result = [(i[0], i[1].rsplit('</span>')[0].split('>')[-1].strip(), i[2]) for i in result]
            result = [i for i in result if title == cleantitle.movie(i[1])]
            result = [i[0] for i in result if any(x in i[2] for x in years)][0]

            try: url = re.compile('//.+?(/.+)').findall(result)[0]
            except: url = result
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
开发者ID:krisawatson,项目名称:plugin.video.genesis,代码行数:28,代码来源:sweflix_mv.py

示例5: get_episode

    def get_episode(self, url, imdb, tvdb, title, date, season, episode):
        try:
            if url == None:
                return

            url = urlparse.urljoin(self.base_link, url)

            result = client.source(url)
            if not "menu season-tabs" in result:
                cookie = client.source(self.sign_link, post=self.key_link, output="cookie")
                result = client.source(url, cookie=cookie)

            result = client.parseDOM(
                result, "a", ret="data-href", attrs={"href": "#%01d-%01d" % (int(season), int(episode))}
            )[0]

            try:
                url = re.compile("//.+?(/.+)").findall(result)[0]
            except:
                url = result
            url = client.replaceHTMLCodes(url)
            url = url.encode("utf-8")
            return url
        except:
            return
开发者ID:Mendim,项目名称:tdbaddon,代码行数:25,代码来源:ororo_tv.py

示例6: get_sources

    def get_sources(self, url, hosthdDict, hostDict, locDict):
        try:
            sources = []

            if url == None: return sources

            url = urlparse.urljoin(self.base_link, url)

            result = client.source(url)

            video_id = re.compile('video_id *= *[\'|\"](.+?)[\'|\"]').findall(result)[0]
            post = urllib.urlencode({'video_id': video_id})

            result = client.source(urlparse.urljoin(self.base_link, self.info_link), post=post)

            u = [i for i in result.split('&') if 'google' in i][0]
            u = urllib.unquote_plus(u)
            u = [urllib.unquote_plus(i.split('|')[-1]) for i in u.split(',')]
            u = [googleplus.tag(i)[0] for i in u]
            u = [i for i in u if i['quality'] in ['1080p', 'HD']]

            for i in u: sources.append({'source': 'GVideo', 'quality': i['quality'], 'provider': 'Afdah', 'url': i['url']})

            return sources
        except:
            return sources
开发者ID:marnnie,项目名称:Cable-buenaventura,代码行数:26,代码来源:afdah_mv.py

示例7: get_sources

    def get_sources(self, url, hosthdDict, hostDict, locDict):
        try:
            sources = []

            if url == None:
                return sources

            query = re.compile("(\d*)").findall(url)[0]
            query = urlparse.urljoin(self.base_link, self.content_link % query)
            query += self.__extra()

            result = client.source(query)
            result = json.loads(result)
            result = self.__decrypt(self.data_key, result["data"])
            result = json.loads(result)
            result = result["listvideos"]

            content = re.compile("(.+?)\sS\d*E\d*$").findall(url)

            if len(content) == 0:
                links = [i["film_id"] for i in result]
            else:
                ep = re.compile(".+?\s(S\d*E\d*)$").findall(url)[0]
                links = [i["film_id"] for i in result if ep in i["film_name"].encode("utf-8").upper()]

            for l in links[:3]:
                try:
                    url = urlparse.urljoin(self.base_link, self.source_link % l)
                    url += self.__extra()

                    url = client.source(url)
                    url = json.loads(url)

                    url = self.__decrypt(self.data_key, url["data"])
                    url = json.loads(url)["videos"]
                    url = [self.__decrypt(self.film_key, i["film_link"]) for i in url]

                    url = "#".join(url)
                    url = url.split("#")
                    url = [i for i in url if "http" in i and "google" in i]
                    url = [googleplus.tag(i)[0] for i in url]

                    for i in url:
                        sources.append(
                            {"source": "GVideo", "quality": i["quality"], "provider": "GVcenter", "url": i["url"]}
                        )
                except:
                    pass

            return sources
        except:
            return sources
开发者ID:johnnieko,项目名称:marnnie-wizard-tv,代码行数:52,代码来源:gvcenter_mv_tv.py

示例8: get_movie

    def get_movie(self, imdb, title, year):
        try:
            query = self.search_link % urllib.quote_plus(title)

            result = ""
            links = [self.link_1, self.link_2, self.link_3]
            for base_link in links:
                result = client.source(urlparse.urljoin(base_link, query), headers=self.headers)
                if "movie_table" in str(result):
                    break

            result = result.decode("iso-8859-1").encode("utf-8")
            result = client.parseDOM(result, "div", attrs={"class": "movie_table"})

            title = cleantitle.movie(title)
            years = ["(%s)" % str(year), "(%s)" % str(int(year) + 1), "(%s)" % str(int(year) - 1)]
            result = [(client.parseDOM(i, "a", ret="href")[0], client.parseDOM(i, "a", ret="title")[1]) for i in result]
            result = [i for i in result if any(x in i[1] for x in years)]

            result = [(client.replaceHTMLCodes(i[0]), i[1]) for i in result]
            try:
                result = [(urlparse.parse_qs(urlparse.urlparse(i[0]).query)["u"][0], i[1]) for i in result]
            except:
                pass
            result = [(urlparse.urlparse(i[0]).path, i[1]) for i in result]

            match = [i[0] for i in result if title == cleantitle.movie(i[1])]

            match2 = [i[0] for i in result]
            match2 = [x for y, x in enumerate(match2) if x not in match2[:y]]
            if match2 == []:
                return

            for i in match2[:10]:
                try:
                    if len(match) > 0:
                        url = match[0]
                        break
                    result = client.source(base_link + i, headers=self.headers)
                    if str("tt" + imdb) in str(result):
                        url = i
                        break
                except:
                    pass

            url = url.encode("utf-8")
            return url
        except:
            return
开发者ID:marnnie,项目名称:Cable-buenaventura,代码行数:49,代码来源:movie25_mv.py

示例9: get_sources

    def get_sources(self, url, hosthdDict, hostDict, locDict):
        try:
            sources = []

            if url == None: return sources

            content = re.compile('(.+?)\sS\d*E\d*$').findall(url)

            if len(content) == 0:
                query = urlparse.urljoin(self.base_link, self.detail_link % url)

                result = client.source(query)
                result = json.loads(result)
                result = result['data']['chapters'][0]['id']
            else:
                url, s, e = re.compile('(.+?)\sS(\d*)E(\d*)$').findall(url)[0]
                ep = 'S%02dE%03d' % (int(s), int(e))

                query = urlparse.urljoin(self.base_link, self.detail_link % url)

                result = client.source(query)
                result = json.loads(result)
                result = result['data']['chapters']
                result = [i['id'] for i in result if ep in i['title'].encode('utf-8').upper()][0]

            url = urlparse.urljoin(self.base_link, self.stream_link % result)
            result = client.source(url)
            result = json.loads(result)['data']

            for i in result:
                try:
                    if not i['server'] == 'ggvideo': raise Exception()

                    quality = i['quality'].replace('720p', 'HD')
                    if not quality in ['1080p', 'HD']: quality = 'SD'

                    key = base64.b64decode('cXdlcnR5dWlvcGFzZGZnaGprbHp4YzEyMzQ1Njc4OTA=')
                    decrypter = pyaes.Decrypter(pyaes.AESModeOfOperationCBC(key, '\0' * 16))
                    url = base64.decodestring(i['stream'])
                    url = decrypter.feed(url) + decrypter.feed()

                    sources.append({'source': 'GVideo', 'quality': quality, 'provider': 'PlayBox', 'url': url})
                except:
                    pass

            return sources
        except:
            return sources
开发者ID:djjohnnyb15,项目名称:BlackKodi,代码行数:48,代码来源:playbox_mv_tv.py

示例10: get_episode

    def get_episode(self, url, imdb, tvdb, title, date, season, episode):
        try:
            if url == None: return

            query = self.tvbase_link + self.index_link
            post = urllib.urlencode({'a': 'retrieve', 'c': 'result', 'p': '{"KeyWord":"%s","Page":"1","NextToken":""}' % url})

            result = client.source(query, post=post)
            result = result.decode('iso-8859-1').encode('utf-8')
            result = client.parseDOM(result, "tr")

            show = cleantitle.tv(url)
            season = '%01d' % int(season)
            episode = '%02d' % int(episode)
            result = [client.parseDOM(i, "h1")[0] for i in result]
            result = [(client.parseDOM(i, "a", ret="href")[0], client.parseDOM(i, "a")[0]) for i in result]
            result = [(i[0], re.sub('\sSeason(|\s)\d*.+', '', i[1]), re.compile('\sSeason *(\d*) *').findall(i[1])[0]) for i in result]
            result = [i for i in result if show == cleantitle.tv(i[1])]
            result = [i[0] for i in result if season == i[2]][0]

            url = result.split('v=', 1)[-1]
            url = '%s|%s' % (url, episode)
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
开发者ID:Mendim,项目名称:tdbaddon,代码行数:27,代码来源:movietube_mv_tv.py

示例11: get_episode

    def get_episode(self, url, imdb, tvdb, title, date, season, episode):
        try:
            if url == None: return

            season = '%01d' % int(season)
            episode = '%01d' % int(episode)

            query = '%s "Season %s" "Episode %s"' % (url, season, episode)
            query = urlparse.urljoin(self.base_link, self.tvsearch_link + urllib.quote_plus(query))

            result = cloudflare.source(query)
            if result == None: result = client.source(self.agent_link + urllib.quote_plus(query))

            result = result.replace('> ', '>').replace(' <', '<')

            r = client.parseDOM(result, "li", attrs = { "class": "first element.+?" })
            r += client.parseDOM(result, "li", attrs = { "class": "element.+?" })

            show = cleantitle.tv(url)
            result = [(client.parseDOM(i, "a", ret="href"), re.compile('>(.+?): Season (\d*), Episode (\d*)<').findall(i)) for i in r]
            result = [(i[0][0], i[1][-1][0].split('>')[-1], i[1][-1][1], i[1][-1][2]) for i in result if len(i[0]) > 0 and len(i[1]) > 0]
            result = [i for i in result if season == '%01d' % int(i[2]) and episode == '%01d' % int(i[3])]
            result = [i[0] for i in result if show == cleantitle.tv(i[1])][0]

            url = client.replaceHTMLCodes(result)
            try: url = urlparse.parse_qs(urlparse.urlparse(url).query)['u'][0]
            except: pass
            url = urlparse.urlparse(url).path
            url = url.encode('utf-8')
            return url
        except:
            return
开发者ID:ooXei1sh,项目名称:lambda-addons,代码行数:32,代码来源:yifystream_mv_tv.py

示例12: get_episode

    def get_episode(self, url, imdb, tvdb, title, date, season, episode):
        try:
            if url == None: return

            title = url
            hdlr = 'S%02dE%02d' % (int(season), int(episode))

            query = self.search_link % (urllib.quote_plus('%s "%s"' % (title, hdlr)))
            query = urlparse.urljoin(self.tvbase_link, query)

            result = client.source(query)
            result = client.parseDOM(result, "header", attrs = { "class": "post-title" })

            title = cleantitle.tv(title)
            result = [(client.parseDOM(i, "a", ret="href"), client.parseDOM(i, "a")) for i in result]
            result = [(i[0][0], i[1][0]) for i in result if len(i[0]) > 0 and len(i[1]) > 0]
            result = [(i[0], re.compile('(.+?) (S\d*E\d*)').findall(i[1])) for i in result]
            result = [(i[0], i[1][0][0], i[1][0][1]) for i in result if len(i[1]) > 0]
            result = [i for i in result if title == cleantitle.tv(i[1])]
            result = [i[0] for i in result if hdlr == i[2]][0]

            url = result.replace(self.tvbase_link, '')
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
开发者ID:Mendim,项目名称:tdbaddon,代码行数:27,代码来源:wso_mv_tv.py

示例13: get_sources

    def get_sources(self, url, hosthdDict, hostDict, locDict):
        try:
            sources = []

            if url == None: return sources

            url = urlparse.urljoin(self.base_link, url)
            headers = {'User-Agent': 'android-async-http/1.4.1 (http://loopj.com/android-async-http)'}

            par = urlparse.parse_qs(urlparse.urlparse(url).query)
            try: num = int(par['h'][0]) + int(par['u'][0]) + int(par['y'][0])
            except: num = int(par['id'][0]) + 537

            result = client.source(url, headers=headers)
            result = json.loads(result)
            try: result = result['langs']
            except: pass
            i = [i for i in result if i['lang'] in ['en', '']][0]

            url = (str(int(i['apple']) + num), str(int(i['google']) + num), i['microsoft'])
            url = vk.resolve(self.vk_link % url)

            for i in url: sources.append({'source': 'VK', 'quality': i['quality'], 'provider': 'VKBox', 'url': i['url']})

            return sources
        except:
            return sources
开发者ID:Mendim,项目名称:tdbaddon,代码行数:27,代码来源:vkbox_mv_tv.py

示例14: get_sources

    def get_sources(self, url, hosthdDict, hostDict, locDict):
        try:
            sources = []

            if url == None: return sources

            url = urlparse.urljoin(self.base_link, url)

            result = cloudflare.source(url)
            if result == None: result = client.source(self.agent_link + urllib.quote_plus(url))

            result = client.parseDOM(result, "a", ret="href")

            u = [i for i in result if '.php' in i and  'i=' in urllib.unquote_plus(i) ][0]
            u = client.replaceHTMLCodes(u)
            try: u = urlparse.parse_qs(urlparse.urlparse(u).query)['u'][0]
            except: pass
            u = urlparse.parse_qs(urlparse.urlparse(u).query)['i'][0]
 
            url = gkplugins.decrypter(198,128).decrypt(u,base64.urlsafe_b64decode('b3F5czkzZEswc2FEY3pRNW9NSTE='),'ECB').split('\0')[0]
            url = resolvers.request(url)
 
            if not type(url) == list: raise Exception()

            for i in url: sources.append({'source': 'GVideo', 'quality': i['quality'], 'provider': 'YIFYstream', 'url': i['url']})

            return sources
        except:
            return sources
开发者ID:ooXei1sh,项目名称:lambda-addons,代码行数:29,代码来源:yifystream_mv_tv.py

示例15: get_sources

    def get_sources(self, url, hosthdDict, hostDict, locDict):
        try:
            sources = []

            if url == None: return sources

            url = urlparse.urljoin(self.base_link, url)
            result = client.source(url)

            fmt = re.compile('<strong>Quality</strong>.+?<strong>(.+?)</strong>').findall(result)
            if len(fmt) > 0: fmt = (' '.join((fmt[0].decode("utf-8").lower().strip()).split())).split(' ')

            if any(x in ['dvdscr', 'r5', 'r6'] for x in fmt): quality = 'SCR'
            elif any(x in ['camrip', 'tsrip', 'hdcam', 'hdts', 'dvdcam', 'dvdts', 'cam', 'ts'] for x in fmt): quality = 'CAM'
            else: quality = 'HD'

            result = client.parseDOM(result, "div", attrs = { "class": "video-embed" })[0]
            url = re.compile('hashkey=(.+?)[\'|\"]').findall(result)
            url += re.compile('[?]ref=(.+?)[\'|\"]').findall(result)
            url = self.videomega_link % url[0]

            url = videomega.resolve(url)
            if url == None: raise Exception()

            sources.append({'source': 'Videomega', 'quality': quality, 'provider': 'Onlinemovies', 'url': url})

            return sources
        except:
            return sources
开发者ID:marnnie,项目名称:Cable-buenaventura,代码行数:29,代码来源:onlinemovies_mv.py


注:本文中的modules.libraries.client.source函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。