示例#1
0
文件: ytsam.py 项目: schubic/install
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if url is None: return sources
         if debrid.status() is False: raise Exception()
         data = urlparse.parse_qs(url)
         data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data])
         query = '%s %s' % (data['title'], data['year'])
         url = self.search_link % urllib.quote(query)
         url = urlparse.urljoin(self.base_link, url)
         html = client.request(url)
         try:
             results = client.parseDOM(html, 'div', attrs={'class': 'row'})[2]
         except Exception:
             return sources
         items = re.findall('class="browse-movie-bottom">(.+?)</div>\s</div>', results, re.DOTALL)
         if items is None:
             return sources
         for entry in items:
             try:
                 try:
                     link, name = \
                         re.findall('<a href="(.+?)" class="browse-movie-title">(.+?)</a>', entry, re.DOTALL)[0]
                     name = client.replaceHTMLCodes(name)
                     if not cleantitle.get(name) == cleantitle.get(data['title']):
                         continue
                 except Exception:
                     continue
                 y = entry[-4:]
                 if not y == data['year']:
                     continue
                 response = client.request(link)
                 try:
                     entries = client.parseDOM(response, 'div', attrs={'class': 'modal-torrent'})
                     for torrent in entries:
                         link, name = re.findall(
                             'href="magnet:(.+?)" class="magnet-download download-torrent magnet" title="(.+?)"',
                             torrent, re.DOTALL)[0]
                         link = 'magnet:%s' % link
                         link = str(client.replaceHTMLCodes(link).split('&tr')[0])
                         quality, info = source_utils.get_release_quality(name, name)
                         try:
                             size = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))', torrent)[-1]
                             div = 1 if size.endswith(('GB', 'GiB')) else 1024
                             size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                             size = '%.2f GB' % size
                             info.append(size)
                         except Exception:
                             pass
                         info = ' | '.join(info)
                         sources.append(
                             {'source': 'Torrent', 'quality': quality, 'language': 'en', 'url': link, 'info': info,
                              'direct': False, 'debridonly': True})
                 except Exception:
                     continue
             except Exception:
                 continue
         return sources
     except Exception:
         return sources
示例#2
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         r = self.scraper.get(url).content
         try:
             v = re.findall('document.write\(Base64.decode\("(.+?)"\)',
                            r)[0]
             b64 = base64.b64decode(v)
             url = client.parseDOM(b64, 'iframe', ret='src')[0]
             try:
                 host = re.findall(
                     '([\w]+[.][\w]+)$',
                     urlparse.urlparse(url.strip().lower()).netloc)[0]
                 host = client.replaceHTMLCodes(host)
                 host = host.encode('utf-8')
                 sources.append({
                     'source': host,
                     'quality': 'SD',
                     'language': 'en',
                     'url': url.replace('\/', '/'),
                     'direct': False,
                     'debridonly': True
                 })
             except:
                 pass
         except:
             pass
         r = client.parseDOM(r, 'div', {'class': 'server_line'})
         r = [(client.parseDOM(i, 'a', ret='href')[0],
               client.parseDOM(i, 'p', attrs={'class':
                                              'server_servername'})[0])
              for i in r]
         if r:
             for i in r:
                 try:
                     host = re.sub('Server|Link\s*\d+', '', i[1]).lower()
                     url = i[0]
                     host = client.replaceHTMLCodes(host)
                     host = host.encode('utf-8')
                     if 'other' in host: continue
                     sources.append({
                         'source': host,
                         'quality': 'SD',
                         'language': 'en',
                         'url': url.replace('\/', '/'),
                         'direct': False,
                         'debridonly': True
                     })
                 except:
                     pass
         return sources
     except Exception:
         return
示例#3
0
def resolve(regex):
    try:
        vanilla = re.compile('(<regex>.+)', re.MULTILINE|re.DOTALL).findall(regex)[0]
        cddata = re.compile('<\!\[CDATA\[(.+?)\]\]>', re.MULTILINE|re.DOTALL).findall(regex)
        for i in cddata:
            regex = regex.replace('<![CDATA['+i+']]>', urllib.quote_plus(i))

        regexs = re.compile('(<regex>.+)', re.MULTILINE|re.DOTALL).findall(regex)[0]
        regexs = re.compile('<regex>(.+?)</regex>', re.MULTILINE|re.DOTALL).findall(regexs)
        regexs = [re.compile('<(.+?)>(.*?)</.+?>', re.MULTILINE|re.DOTALL).findall(i) for i in regexs]

        regexs = [dict([(client.replaceHTMLCodes(x[0]), client.replaceHTMLCodes(urllib.unquote_plus(x[1]))) for x in i]) for i in regexs]
        regexs = [(i['name'], i) for i in regexs]
        regexs = dict(regexs)

        url = regex.split('<regex>', 1)[0].strip()
        url = client.replaceHTMLCodes(url)
        url = url.encode('utf-8')

        r = getRegexParsed(regexs, url)

        try:
            ln = ''
            ret = r[1]
            listrepeat = r[2]['listrepeat']
            regexname = r[2]['name']

            for obj in ret:
                try:
                    item = listrepeat
                    for i in range(len(obj)+1):
                        item = item.replace('[%s.param%s]' % (regexname, str(i)), obj[i-1])

                    item2 = vanilla
                    for i in range(len(obj)+1):
                        item2 = item2.replace('[%s.param%s]' % (regexname, str(i)), obj[i-1])

                    item2 = re.compile('(<regex>.+?</regex>)', re.MULTILINE|re.DOTALL).findall(item2)
                    item2 = [x for x in item2 if not '<name>%s</name>' % regexname in x]
                    item2 = ''.join(item2)

                    ln += '\n<item>%s\n%s</item>\n' % (item, item2)
                except:
                    pass

            return ln
        except:
            pass

        if r[1] == True:
            return r[0]
    except:
        return
示例#4
0
    def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
        try:
            query = self.tvsearch_link % urllib.quote_plus(
                cleantitle.query(tvshowtitle))
            query = urlparse.urljoin(self.base_link, query.lower())

            result = self.scraper.get(query).content
            result = client.parseDOM(
                result, 'div', attrs={
                    'class': 'index_item.+?'})

            result = [(dom.parse_dom(i, 'a', req=['href', 'title'])[0])
                      for i in result if i]
            result = [
                (i.attrs['href']) for i in result if cleantitle.get(tvshowtitle) == cleantitle.get(
                    re.sub(
                        '(\.|\(|\[|\s)(\d{4}|S\d+E\d+|S\d+|3D)(\.|\)|\]|\s|)(.+|)',
                        '',
                        i.attrs['title'],
                        flags=re.I))][0]

            url = client.replaceHTMLCodes(result)
            url = url.encode('utf-8')
            return url
        except Exception:
            return
示例#5
0
def strip_domain(url):
    try:
        if url.lower().startswith('http') or url.startswith('/'):
            url = re.findall('(?://.+?|)(/.+)', url)[0]
        url = client.replaceHTMLCodes(url)
        url = url.encode('utf-8')
        return url
    except:
        return
示例#6
0
 def resolve(self, url):
     try:
         r = client.request(url)
         r = dom_parser2.parse_dom(
             r, 'a', req=['href', 'data-episodeid', 'data-linkid'])[0]
         url = r.attrs['href']
         url = client.replaceHTMLCodes(url)
         url = url.encode('utf-8')
         return url
     except:
         return
示例#7
0
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if url is None: return sources

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])
            urls = self.search(data['title'], data['year'])

            for url in urls:
                try:
                    link = client.replaceHTMLCodes(url[1])
                    link = link.encode('utf-8')
                    if link in sources: continue
                    if 'snahp' in link:
                        data = client.request(link)
                        data = client.parseDOM(data, 'center')
                        data = [i for i in data if 'Hidden Link' in i][0]
                        link = client.parseDOM(data, 'a', ret='href')[0]
                    if 'google' in link:
                        quality, info2 = source_utils.get_release_quality(
                            url[0], link)
                        sources.append({
                            'source': 'gvideo',
                            'quality': quality,
                            'language': 'en',
                            'url': link,
                            'direct': False,
                            'debridonly': False
                        })

                    else:
                        host = re.findall(
                            '([\w]+[.][\w]+)$',
                            urlparse.urlparse(link.strip().lower()).netloc)[0]
                        if host in hostDict:
                            host = host.encode('utf-8')
                            quality, info2 = source_utils.get_release_quality(
                                url[0], link)
                            sources.append({
                                'source': host,
                                'quality': quality,
                                'language': 'en',
                                'url': link,
                                'direct': False,
                                'debridonly': False
                            })
                except BaseException:
                    pass
            return sources
        except BaseException:
            return sources
示例#8
0
    def getTVShowTranslation(self, thetvdb, lang):
        try:
            url = 'http://thetvdb.com/api/%s/series/%s/%s.xml' % (
                'MUQ2MkYyRjkwMDMwQzQ0NA=='.decode('base64'), thetvdb, lang)
            r = client.request(url)
            title = client.parseDOM(r, 'SeriesName')[0]
            title = client.replaceHTMLCodes(title)
            title = title.encode('utf-8')

            return title
        except:
            pass
示例#9
0
文件: 1337x.py 项目: schubic/install
 def sources(self, url, hostDict, hostprDict):
     sources = []
     try:
         if url is None: return sources
         if debrid.status() is False: raise Exception()
         data = urlparse.parse_qs(url)
         data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data])
         title = data['tvshowtitle'] if 'tvshowtitle' in data else data['title']
         hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']
         query = '%s s%02de%02d' % (
             data['tvshowtitle'], int(data['season']),
             int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
             data['title'], data['year'])
         query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
         url = self.search_link % urllib.quote_plus(query)
         url = urlparse.urljoin(self.base_link, url)
         r = client.request(url)
         try:
             posts = client.parseDOM(r, 'div', attrs={'class': 'box-info'})
             for post in posts:
                 data = client.parseDOM(post, 'a', ret='href')
                 u = [i for i in data if '/torrent/' in i]
                 for u in u:
                     match = '%s %s' % (title, hdlr)
                     match = match.replace('+', '-').replace(' ', '-').replace(':-', '-').replace('---', '-')
                     if not match in u: continue
                     u = self.base_link + u
                     r = client.request(u)
                     r = client.parseDOM(r, 'div', attrs={'class': 'torrent-category-detail clearfix'})
                     for t in r:
                         link = re.findall('href="magnet:(.+?)" onclick=".+?"', t)[0]
                         link = 'magnet:%s' % link
                         link = str(client.replaceHTMLCodes(link).split('&tr')[0])
                         seeds = int(re.compile('<span class="seeds">(.+?)</span>').findall(t)[0])
                         if self.min_seeders > seeds:
                             continue
                         quality, info = source_utils.get_release_quality(link, link)
                         try:
                             size = re.findall('<strong>Total size</strong> <span>(.+?)</span>', t)
                             for size in size:
                                 size = '%s' % size
                                 info.append(size)
                         except BaseException:
                             pass
                         info = ' | '.join(info)
                         sources.append(
                             {'source': 'Torrent', 'quality': quality, 'language': 'en', 'url': link, 'info': info,
                              'direct': False, 'debridonly': True})
         except:
             return
         return sources
     except:
         return sources
示例#10
0
    def episode(self, url, imdb, tvdb, title, premiered, season, episode):
        try:
            if url is None:
                return

            url = urlparse.urljoin(self.base_link, url) if url.startswith('/') else url
            url = url.split('online.html')[0]
            url = '%s%s-online.html' % (url, 'season-%01d-episode-%01d' % (int(season), int(episode)))
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except BaseException:
            return
示例#11
0
文件: proxy.py 项目: schubic/install
def parse(url):
    try:
        url = client.replaceHTMLCodes(url)
    except:
        pass
    try:
        url = urlparse.parse_qs(urlparse.urlparse(url).query)['u'][0]
    except:
        pass
    try:
        url = urlparse.parse_qs(urlparse.urlparse(url).query)['q'][0]
    except:
        pass
    return url
示例#12
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url is None:
                return sources

            r = self.scraper.get(url, headers={
                'referer': self.base_link
            }).content
            links = client.parseDOM(r,
                                    'a',
                                    ret='href',
                                    attrs={'target': '.+?'})
            links = [x for y, x in enumerate(links) if x not in links[:y]]

            for i in links:
                try:
                    url = i
                    url = proxy.parse(url)
                    url = urlparse.parse_qs(
                        urlparse.urlparse(url).query)['r'][0]
                    url = url.decode('base64')
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = re.findall(
                        '([\w]+[.][\w]+)$',
                        urlparse.urlparse(url.strip().lower()).netloc)[0]
                    if host not in hostDict:
                        continue
                    host = host.encode('utf-8')
                    sources.append({
                        'source': host,
                        'quality': 'SD',
                        'language': 'en',
                        'url': url,
                        'direct': False,
                        'debridonly': False
                    })
                except:
                    pass

            return sources
        except:
            failure = traceback.format_exc()
            log_utils.log('XWatchSeries - Exception: \n' + str(failure))
            return sources
示例#13
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if url is None: return sources
         if debrid.status() is False: raise Exception()
         data = urlparse.parse_qs(url)
         data = dict([(i, data[i][0]) if data[i] else (i, '')
                      for i in data])
         query = '%s %s' % (data['title'], data['year'])
         url = self.search_link % urllib.quote(query)
         url = urlparse.urljoin(self.base_link, url).replace('%20', '-')
         html = self.scraper(url).content
         try:
             results = client.parseDOM(html, 'div', attrs={'class': 'ava1'})
         except:
             return sources
         for torrent in results:
             link = re.findall(
                 'a data-torrent-id=".+?" href="(magnet:.+?)" class=".+?" title="(.+?)"',
                 torrent, re.DOTALL)
             for link, name in link:
                 link = str(client.replaceHTMLCodes(link).split('&tr')[0])
                 quality, info = source_utils.get_release_quality(
                     name, name)
                 try:
                     size = re.findall(
                         '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))',
                         torrent)[-1]
                     div = 1 if size.endswith(('GB', 'GiB')) else 1024
                     size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                     size = '%.2f GB' % size
                     info.append(size)
                 except Exception:
                     pass
                 info = ' | '.join(info)
                 sources.append({
                     'source': 'Torrent',
                     'quality': quality,
                     'language': 'en',
                     'url': link,
                     'info': info,
                     'direct': False,
                     'debridonly': True
                 })
         return sources
     except:
         return
示例#14
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url == None: return sources

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data])
            aliases = eval(data['aliases'])

            if 'tvshowtitle' in data:
                ep = data['episode']
                url = '%s/film/%s-season-%01d/watching.html?ep=%s' % (
                    self.base_link, cleantitle.geturl(data['tvshowtitle']), int(data['season']), ep)
                r = self.scraper.get(url).content

                if url == None:
                    url = self.searchShow(data['tvshowtitle'], data['season'], aliases)

            else:
                url = self.searchMovie(data['title'], data['year'], aliases)

            if url == None: raise Exception()

            r = self.scraper.get(url).content
            r = client.parseDOM(r, 'div', attrs={'class': 'les-content'})
            if 'tvshowtitle' in data:
                ep = data['episode']
                links = client.parseDOM(r, 'a', attrs={'episode-data': ep}, ret='player-data')
            else:
                links = client.parseDOM(r, 'a', ret='player-data')

            for link in links:
                try:
                    host = re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(link.strip().lower()).netloc)[0]
                    if not host in hostDict: raise Exception()
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

                    sources.append({'source': host, 'quality': '720p', 'language': 'en', 'url': link, 'direct': False,
                                    'debridonly': False})
                except:
                    pass

            return sources
        except:
            return sources
示例#15
0
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if url is None:
                return sources

            url = urlparse.urljoin(self.base_link, url) if not url.startswith('http') else url

            result = self.scraper.get(url).content
            links = client.parseDOM(result, 'tbody')

            for i in links:
                try:
                    data = [
                        (client.parseDOM(i, 'a', ret='href')[0],
                         client.parseDOM(i, 'span', attrs={'class': 'version_host'})[0])][0]
                    url = urlparse.urljoin(self.base_link, data[0])
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    host = data[1]
                    valid, host = source_utils.is_host_valid(host, hostDict)
                    if not valid:
                        raise Exception()

                    quality = client.parseDOM(i, 'span', ret='class')[0]
                    quality, info = source_utils.get_release_quality(
                        quality, url)

                    sources.append({'source': host,
                                    'quality': quality,
                                    'language': 'en',
                                    'url': url,
                                    'direct': False,
                                    'debridonly': False})
                except Exception:
                    pass

            return sources
        except Exception:
            return sources
示例#16
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []
            if url is None:
                return sources
            if debrid.status() is False:
                raise Exception()

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])
            title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                'title']
            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']
            query = '%s S%02dE%02d' % (
                data['tvshowtitle'], int(data['season']), int(data['episode'])
            ) if 'tvshowtitle' in data else '%s' % (data['imdb'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
            s = self.scraper.get(self.base_link).content
            s = re.findall('\'(http.+?)\'', s) + re.findall('\"(http.+?)\"', s)
            s = [
                i for i in s if urlparse.urlparse(self.base_link).netloc in i
                and len(i.strip('/').split('/')) > 3
            ]
            s = s[0] if s else urlparse.urljoin(self.base_link, 'vv')
            s = s.strip('/')
            url = s + self.search_link % urllib.quote_plus(query)
            r = self.scraper.get(url).content
            r = client.parseDOM(r, 'h2')
            l = zip(client.parseDOM(r, 'a', ret='href'),
                    client.parseDOM(r, 'a', ret='title'))
            r = [(i[0], i[1],
                  re.sub('(\.|\(|\[|\s)(\d{4}|3D)(\.|\)|\]|\s|)(.+|)', '',
                         i[1]),
                  re.findall('[\.|\(|\[|\s](\d{4}|)([\.|\)|\]|\s|].+)', i[1]))
                 for i in l]
            r = [(i[0], i[1], i[2], i[3][0][0], i[3][0][1]) for i in r if i[3]]
            r = [(i[0], i[1], i[2], i[3], re.split('\.|\(|\)|\[|\]|\s|\-',
                                                   i[4])) for i in r]
            r = [
                i for i in r if cleantitle.get(title) == cleantitle.get(i[2])
                and data['year'] == i[3]
            ]
            r = [
                i for i in r if not any(x in i[4] for x in [
                    'HDCAM', 'CAM', 'DVDR', 'DVDRip', 'DVDSCR', 'HDTS', 'TS',
                    '3D'
                ])
            ]
            r = [i for i in r if '1080p' in i[4]
                 ][:1] + [i for i in r if '720p' in i[4]][:1]
            if 'tvshowtitle' in data:
                posts = [(i[1], i[0]) for i in l]
            else:
                posts = [(i[1], i[0]) for i in l]
            hostDict = hostprDict + hostDict
            items = []
            for post in posts:
                try:
                    t = post[0]
                    u = self.scraper.get(post[1]).content
                    u = re.findall('"(http.+?)"', u) + re.findall(
                        '"(http.+?)"', u)
                    u = [i for i in u if not '/embed/' in i]
                    u = [i for i in u if not 'youtube' in i]
                    items += [(t, i) for i in u]
                except:
                    pass

            seen_urls = set()
            for item in items:
                try:
                    name = item[0]
                    name = client.replaceHTMLCodes(name)
                    t = re.sub(
                        '(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)',
                        '', name)
                    if not cleantitle.get(t) == cleantitle.get(title):
                        raise Exception()
                    y = re.findall(
                        '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                        name)[-1].upper()
                    if not y == hdlr:
                        raise Exception()
                    url = item[1]

                    if url in seen_urls:
                        continue
                    seen_urls.add(url)

                    quality, info = source_utils.get_release_quality(url, name)
                    try:
                        size = re.findall(
                            '((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))',
                            item[2])[-1]
                        div = 1 if size.endswith(('GB', 'GiB')) else 1024
                        size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                        size = '%.2f GB' % size
                        info.append(size)
                    except:
                        pass
                    info = ' | '.join(info)
                    if any(x in url for x in ['.rar', '.zip', '.iso']):
                        raise Exception()
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')
                    host = re.findall(
                        '([\w]+[.][\w]+)$',
                        urlparse.urlparse(url.strip().lower()).netloc)[0]
                    if not host in hostDict: raise Exception()
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')
                    sources.append({
                        'source': host,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': True
                    })
                except:
                    pass
            check = [i for i in sources if not i['quality'] == 'CAM']
            if check:
                sources = check
            return sources
        except:
            return
示例#17
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         results_limit = 30
         vshare_limit = 1
         openload_limit = 1
         speedvid_limit = 1
         vidoza_limit = 1
         vidlox_limit = 1
         mango_limit = 1
         streamplay_limit = 1
         vidtodo_limit = 1
         clipwatch_limit = 1
         vidcloud_limit = 1
         vev_limit = 1
         flix555_limit = 1
         if url == None: return sources
         r = client.request(url)
         r = dom_parser2.parse_dom(r, 'div', {'class': 'll-item'})
         r = [(dom_parser2.parse_dom(i, 'a', req='href'), \
               dom_parser2.parse_dom(i, 'div', {'class': 'notes'})) \
              for i in r if i]
         r = [(i[0][0].attrs['href'], i[0][0].content,
               i[1][0].content if i[1] else 'None') for i in r]
         for i in r:
             try:
                 url = i[0]
                 url = client.replaceHTMLCodes(url)
                 url = url.encode('utf-8')
                 valid, host = source_utils.is_host_valid(i[1], hostDict)
                 if not valid: continue
                 host = client.replaceHTMLCodes(host)
                 host = host.encode('utf-8')
                 if 'vshare' in host:
                     if vshare_limit < 1:
                         continue
                     else:
                         vshare_limit -= 1
                 if 'openload' in host:
                     if openload_limit < 1:
                         continue
                     else:
                         openload_limit -= 1
                 if 'speedvid' in host:
                     if speedvid_limit < 1:
                         continue
                     else:
                         speedvid_limit -= 1
                 if 'vidoza' in host:
                     if vidoza_limit < 1:
                         continue
                     else:
                         vidoza_limit -= 1
                 if 'vidlox' in host:
                     if vidlox_limit < 1:
                         continue
                     else:
                         vidlox_limit -= 1
                 if 'vidtodo' in host:
                     if vidtodo_limit < 1:
                         continue
                     else:
                         vidtodo_limit -= 1
                 if 'mango' in host:
                     if mango_limit < 1:
                         continue
                     else:
                         mango_limit -= 1
                 if 'streamplay' in host:
                     if streamplay_limit < 1:
                         continue
                     else:
                         streamplay_limit -= 1
                 if 'clipwatch' in host:
                     if clipwatch_limit < 1:
                         continue
                     else:
                         clipwatch_limit -= 1
                 if 'vidcloud' in host:
                     if vidcloud_limit < 1:
                         continue
                     else:
                         vidcloud_limit -= 1
                 if 'vev' in host:
                     if vev_limit < 1:
                         continue
                     else:
                         vev_limit -= 1
                 if 'flix555' in host:
                     if flix555_limit < 1:
                         continue
                     else:
                         flix555_limit -= 1
                 info = []
                 quality, info = source_utils.get_release_quality(
                     i[2], i[2])
                 info = ' | '.join(info)
                 if results_limit < 1:
                     continue
                 else:
                     results_limit -= 1
                 sources.append({
                     'source': host,
                     'quality': quality,
                     'language': 'en',
                     'url': url,
                     'info': info,
                     'direct': False,
                     'debridonly': False
                 })
             except:
                 pass
         return sources
     except:
         return sources
示例#18
0
文件: scnsrc.py 项目: schubic/install
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []
            if url is None:
                return sources
            if debrid.status() is False:
                raise Exception()

            hostDict = hostprDict + hostDict

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])
            title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                'title']
            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']
            query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if \
                'tvshowtitle' in data else '%s' % (data['title'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
            url = self.search_link % urllib.quote_plus(query)
            url = urlparse.urljoin(self.base_link, url)
            headers = {'Referer': self.base_link}
            r = self.scraper.get(url, headers=headers).content

            search_results = dom_parser2.parse_dom(r, 'h2')
            search_results = [
                dom_parser2.parse_dom(i.content, 'a', req=['href'])
                for i in search_results
            ]
            search_results = [(i[0].content, i[0].attrs['href'])
                              for i in search_results]

            items = []
            for search_result in search_results:
                try:
                    headers = {'Referer': url}
                    r = self.scraper.get(search_result[1],
                                         headers=headers).content
                    links = dom_parser2.parse_dom(r,
                                                  'a',
                                                  req=[
                                                      'href',
                                                      'rel',
                                                  ])
                    links = [i.attrs['href'] for i in links]
                    for url in links:
                        try:
                            if hdlr in url.upper() and cleantitle.get(
                                    title) in cleantitle.get(url):
                                items.append(url)
                        except:
                            pass
                except:
                    pass

            seen_urls = set()
            for item in items:
                try:
                    url = str(item)
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    if url in seen_urls:
                        continue
                    seen_urls.add(url)

                    if any(x in url for x in
                           ['.part', 'extras', 'subs', 'dubbed', 'dub', 'MULTISUBS', 'sample', 'youtube', 'trailer']) \
                            or any(url.endswith(x) for x in ['.rar', '.zip', '.iso', '.sub', '.idx', '.srt']):
                        raise Exception()
                    quality, info = source_utils.get_release_quality(url, url)
                    host = re.findall(
                        '([\w]+[.][\w]+)$',
                        urlparse.urlparse(url.strip().lower()).netloc)[0]
                    if host in hostDict:
                        host = client.replaceHTMLCodes(host)
                        host = host.encode('utf-8')
                        sources.append({
                            'source': host,
                            'quality': quality,
                            'language': 'en',
                            'url': url,
                            'info': info,
                            'direct': False,
                            'debridonly': True
                        })
                except:
                    pass

            return sources
        except:
            return sources
示例#19
0
文件: eztv.py 项目: schubic/install
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if url is None: return sources
         if debrid.status() is False: raise Exception()
         data = urlparse.parse_qs(url)
         data = dict([(i, data[i][0]) if data[i] else (i, '')
                      for i in data])
         title = data['tvshowtitle']
         hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode']))
         query = '%s S%02dE%02d' % (
             data['tvshowtitle'], int(data['season']),
             int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                 data['title'], data['year'])
         query = re.sub('(\\\|/| -|:|;|\*|\?|"|<|>|\|)', ' ', query)
         url = self.search_link % (urllib.quote_plus(query).replace(
             '+', '-'))
         url = urlparse.urljoin(self.base_link, url)
         html = client.request(url)
         try:
             results = client.parseDOM(
                 html, 'table', attrs={'class': 'forum_header_border'})
             for result in results:
                 if 'magnet:' in result:
                     results = result
                     break
         except Exception:
             return sources
         rows = re.findall(
             '<tr name="hover" class="forum_header_border">(.+?)</tr>',
             results, re.DOTALL)
         if rows is None:
             return sources
         for entry in rows:
             try:
                 try:
                     columns = re.findall('<td\s.+?>(.+?)</td>', entry,
                                          re.DOTALL)
                     derka = re.findall(
                         'href="magnet:(.+?)" class="magnet" title="(.+?)"',
                         columns[2], re.DOTALL)[0]
                     name = derka[1]
                     link = 'magnet:%s' % (str(
                         client.replaceHTMLCodes(derka[0]).split('&tr')[0]))
                     t = name.split(hdlr)[0]
                     if not cleantitle.get(re.sub(
                             '(|)', '', t)) == cleantitle.get(title):
                         continue
                 except Exception:
                     continue
                 y = re.findall(
                     '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                     name)[-1].upper()
                 if not y == hdlr:
                     continue
                 try:
                     seeders = int(
                         re.findall('<font color=".+?">(.+?)</font>',
                                    columns[5], re.DOTALL)[0])
                 except Exception:
                     continue
                 if self.min_seeders > seeders:
                     continue
                 quality, info = source_utils.get_release_quality(
                     name, name)
                 try:
                     size = re.findall(
                         '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))',
                         name)[-1]
                     div = 1 if size.endswith(('GB', 'GiB')) else 1024
                     size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                     size = '%.2f GB' % size
                     info.append(size)
                 except Exception:
                     pass
                 info = ' | '.join(info)
                 sources.append({
                     'source': 'Torrent',
                     'quality': quality,
                     'language': 'en',
                     'url': link,
                     'info': info,
                     'direct': False,
                     'debridonly': True
                 })
             except Exception:
                 continue
         check = [i for i in sources if not i['quality'] == 'CAM']
         if check:
             sources = check
         return sources
     except Exception:
         return sources
示例#20
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if url is None:
             return sources
         if debrid.status() is False:
             raise Exception()
         data = urlparse.parse_qs(url)
         data = dict([(i, data[i][0]) if data[i] else (i, '') for i in data])
         title = data['tvshowtitle'] if 'tvshowtitle' in data else data['title']
         hdlr = 'S%02dE%02d' % (int(data['season']), int(data['episode'])) if 'tvshowtitle' in data else data['year']
         query = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode'])) if \
             'tvshowtitle' in data else '%s' % (data['title'])
         url = self.search_link % urllib.quote_plus(query).lower()
         url = urlparse.urljoin(self.base_link, url)
         headers = {'Referer': url}
         r = self.scraper.get(url, headers=headers).content
         items = dom_parser2.parse_dom(r, 'h2')
         items = [dom_parser2.parse_dom(i.content, 'a', req=['href', 'rel', 'data-wpel-link']) for i in items]
         items = [(i[0].content, i[0].attrs['href']) for i in items]
         hostDict = hostprDict + hostDict
         for item in items:
             try:
                 name = item[0]
                 name = client.replaceHTMLCodes(name)
                 query = query.lower().replace(' ', '-')
                 if not query in item[1]:
                     continue
                 url = item[1]
                 headers = {'Referer': url}
                 r = self.scraper.get(url, headers=headers).content
                 links = dom_parser2.parse_dom(r, 'a', req=['href', 'rel', 'data-wpel-link'])
                 links = [i.attrs['href'] for i in links]
                 for url in links:
                     try:
                         if hdlr in name.upper() and cleantitle.get(title) in cleantitle.get(name):
                             fmt = re.sub('(.+)(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*)(\.|\)|\]|\s)', '', name.upper())
                             fmt = re.split('\.|\(|\)|\[|\]|\s|\-', fmt)
                             fmt = [i.lower() for i in fmt]
                             if any(i.endswith(('subs', 'sub', 'dubbed', 'dub')) for i in fmt): raise Exception()
                             if any(i in ['extras'] for i in fmt): raise Exception()
                             quality, info = source_utils.get_release_quality(name, url)
                             try:
                                 size = re.findall('((?:\d+\.\d+|\d+\,\d+|\d+) (?:GB|GiB|MB|MiB))', name[2])[-1]
                                 div = 1 if size.endswith(('GB', 'GiB')) else 1024
                                 size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                                 size = '%.2f GB' % size
                                 info.append(size)
                             except:
                                 pass
                             info = ' | '.join(info)
                             if not any(x in url for x in ['.rar', '.zip', '.iso']):
                                 url = client.replaceHTMLCodes(url)
                                 url = url.encode('utf-8')
                                 host = \
                                     re.findall('([\w]+[.][\w]+)$', urlparse.urlparse(url.strip().lower()).netloc)[0]
                                 if host in hostDict:
                                     host = client.replaceHTMLCodes(host)
                                     host = host.encode('utf-8')
                                     sources.append(
                                         {'source': host, 'quality': quality, 'language': 'en', 'url': url,
                                          'info': info, 'direct': False, 'debridonly': True})
                     except:
                         pass
             except:
                 pass
         check = [i for i in sources if not i['quality'] == 'CAM']
         if check:
             sources = check
         return sources
     except:
         return
示例#21
0
    def sources(self, url, hostDict, hostprDict):
        sources = []
        try:
            if url is None:
                return sources

            if debrid.status() is False:
                raise Exception()

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            post = {'query': data['imdb']}
            url = urlparse.urljoin(self.base_link, 'engine/ajax/search.php')
            r = self.scraper.post(url, data=post).content
            urls = client.parseDOM(r, 'a', ret='href')
            urls = [i for i in urls if not data['imdb'] in i]

            hostDict = hostprDict + hostDict
            links = []
            for u in urls:
                try:
                    data = self.scraper.get(u).content
                    data = re.findall('</iframe>(.+?)QuoteEEnd--><br /><br',
                                      data, re.DOTALL)[0]
                    links += re.findall(
                        '''start--><b>(.+?)</b>.+?<b><a href=['"](.+?)['"]''',
                        data, re.DOTALL)

                except Exception:
                    pass
            links = [(i[0], i[1]) for i in links if not 'vip' in i[0].lower()]
            for name, url in links:
                try:
                    name = re.sub('<.+?>', '', name)
                    if '4K' in name:
                        quality = '4K'
                    elif '1080p' in name:
                        quality = '1080p'
                    elif '720p' in name:
                        quality = '720p'
                    else:
                        quality = 'SD'

                    info = []
                    if '3D' in name or '.3D.' in url:
                        info.append('3D')
                        quality = '1080p'
                    if any(i in ['hevc', 'h265', 'x265'] for i in name):
                        info.append('HEVC')

                    info = ' | '.join(info)

                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')
                    if any(x in url for x in ['.rar', '.zip', '.iso', 'turk']):
                        raise Exception()

                    if 'ftp' in url:
                        host = 'CDN'
                        direct = True
                    else:
                        valid, host = source_utils.is_host_valid(url, hostDict)
                        if not valid: raise Exception()
                        host = host
                        direct = False

                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')

                    sources.append({
                        'source': host,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': direct,
                        'debridonly': True
                    })
                except Exception:
                    pass

            return sources
        except Exception:
            return sources
示例#22
0
    def sources(self, url, hostDict, hostprDict):
        try:
            self._sources = []

            if url is None:
                return self._sources

            if debrid.status() is False: raise Exception()

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
                'title']

            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
                data['tvshowtitle'], int(data['season']),
                int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                    data['title'], data['year'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)

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

            r = self.scraper.get(url).content

            posts = client.parseDOM(r, 'div', attrs={'class': 'item'})

            hostDict = hostprDict + hostDict

            items = []

            for post in posts:
                try:
                    tit = client.parseDOM(post, 'img', ret='alt')[0]
                    c = client.parseDOM(post, 'a', ret='href')[0]
                    name = tit
                    name = client.replaceHTMLCodes(name)

                    t = re.sub(
                        '(\.|\(|\[|\s)(\d{4}|S\d+E\d+|S\d+|3D)(\.|\)|\]|\s|)(.+|)',
                        '',
                        name,
                        flags=re.I)

                    if not cleantitle.get(t) == cleantitle.get(title):
                        raise Exception()

                    try:
                        y = re.findall(
                            '(?:\.|\(|\[|\s*|)(S\d+E\d+|S\d+)(?:\.|\)|\]|\s*|)',
                            name, re.I)[-1].upper()
                    except Exception:
                        y = re.findall(
                            '(?:\.|\(|\[|\s*|)(\d{4})(?:\.|\)|\]|\s*|)', name,
                            re.I)[0].upper()

                    if not y == hdlr: raise Exception()

                    try:
                        s = re.findall(
                            '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))',
                            t)[0]
                    except BaseException:
                        s = '0'

                    items += [(tit, c, s)]
                except Exception:
                    pass
            threads = []
            for item in items:
                threads.append(
                    workers.Thread(self._get_sources, item, hostDict))
            [i.start() for i in threads]
            [i.join() for i in threads]

            return self._sources
        except Exception:
            return self._sources
示例#23
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []
            if url is None: return sources
            if debrid.status() is False: raise Exception()

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            url = self.searchMovie(data['title'], data['year'])
            if url is None: return sources

            r = client.request(url)
            data = client.parseDOM(r, 'div', attrs={'class': 'playex'})[0]
            frames = client.parseDOM(data, 'iframe', ret='src')
            frames += re.compile('''<iframe\s*src=['"](.+?)['"]''',
                                 re.DOTALL).findall(data)
            quality = client.parseDOM(r, 'span', attrs={'class':
                                                        'qualityx'})[0]
            for frame in frames:
                url = frame.split('=')[1] if frame.startswith('<') else frame
                url = client.replaceHTMLCodes(url)
                url = url.encode('utf-8')

                valid, host = source_utils.is_host_valid(url, hostDict)

                if valid:
                    quality, info = source_utils.get_release_quality(
                        quality, url)
                    info = ' | '.join(info)
                    sources.append({
                        'source': host,
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'info': info,
                        'direct': False,
                        'debridonly': False
                    })

                elif url.endswith('mp4'):
                    url += '|User-Agent=%s' % urllib.quote_plus(client.agent())
                    sources.append({
                        'source': 'MP4',
                        'quality': quality,
                        'language': 'en',
                        'url': url,
                        'direct': True,
                        'debridonly': False
                    })

                elif 'mystream' in url:
                    data = client.request(url)
                    links = dom_parser2.parse_dom(data,
                                                  'source',
                                                  req=['src', 'label'])
                    for link in links:
                        label = link.attrs['label']
                        url = link.attrs[
                            'src'] + '|User-Agent=%s' % urllib.quote_plus(
                                client.agent())

                        sources.append({
                            'source': 'MYSTREAM',
                            'quality': label,
                            'language': 'en',
                            'url': url,
                            'direct': True,
                            'debridonly': False
                        })

                else:
                    continue
            return sources
        except Exception:
            return sources
示例#24
0
    def _get_sources(self, item, hostDict):
        try:
            quality, info = source_utils.get_release_quality(item[0], item[1])
            size = item[2] if item[2] != '0' else item[0]

            try:
                size = re.findall(
                    '((?:\d+\,\d+\.\d+|\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))',
                    size)[-1]
                div = 1 if size.endswith(('GB', 'GiB')) else 1024
                size = float(re.sub('[^0-9|/.|/,]', '', size.replace(
                    ',', '.'))) / div
                size = '%.2f GB' % size
                info.append(size)

            except Exception:
                pass

            data = self.scraper.get(item[1]).content

            try:
                r = client.parseDOM(data, 'li', attrs={'class': 'elemento'})
                r = [(dom_parser2.parse_dom(i, 'a', req='href')[0],
                      dom_parser2.parse_dom(i, 'img', req='alt')[0],
                      dom_parser2.parse_dom(i, 'span', {'class': 'd'})[0])
                     for i in r]
                urls = [('http:' + i[0].attrs['href']
                         if not i[0].attrs['href'].startswith('http') else
                         i[0].attrs['href'], i[1].attrs['alt'], i[2].content)
                        for i in r if i[0] and i[1]]

                for url, host, qual in urls:

                    try:
                        if any(x in url
                               for x in ['.rar', '.zip', '.iso', ':Upcoming']):
                            raise Exception()
                        url = client.replaceHTMLCodes(url)
                        url = url.encode('utf-8')

                        valid, host = source_utils.is_host_valid(
                            host, hostDict)
                        if not valid: continue
                        host = client.replaceHTMLCodes(host)
                        host = host.encode('utf-8')
                        quality, info = source_utils.get_release_quality(
                            qual, quality)
                        info.append('HEVC')
                        info = ' | '.join(info)
                        self._sources.append({
                            'source': host,
                            'quality': quality,
                            'language': 'en',
                            'url': url,
                            'info': info,
                            'direct': False,
                            'debridonly': True
                        })
                    except Exception:
                        pass
            except Exception:
                pass

        except BaseException:
            return
示例#25
0
    def sources(self, url, hostDict, hostprDict):
        try:
            sources = []

            if url is None:
                return sources

            if debrid.status() is False:
                raise Exception()

            data = urlparse.parse_qs(url)
            data = dict([(i, data[i][0]) if data[i] else (i, '')
                         for i in data])

            title = (data['tvshowtitle']
                     if 'tvshowtitle' in data else data['title'])
            hdlr = 'S%02dE%02d' % (int(data['season']), int(
                data['episode'])) if 'tvshowtitle' in data else data['year']

            query = '%s S%02dE%02d' % (
                data['tvshowtitle'], int(data['season']), int(data['episode'])
            ) if 'tvshowtitle' in data else '%s' % (data['title'])
            query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', '', query)

            query = query.replace("&", "and")
            query = query.replace("  ", " ")
            query = query.replace(" ", "-")

            query = urllib.quote_plus(query)
            url = '%s/?s=%s&submit=Find' % (self.base_link, query)

            resp = self.scraper.get(url)

            capture = re.findall(
                r'<script id="rlsbb_script" data-code-rlsbb="(\d*)" .*? src="(.*?)"><',
                resp.text)[0]
            rlsbb_code = capture[0]
            script_url = capture[1]

            resp = self.scraper.get(script_url)
            location_code = re.findall(r'\'/lib/search\' (.*?);', resp.text)[0]

            location_maths = re.findall(
                r'( \(.*?\) )| (\'.*?\') |\+ (\d*) \+|(\'\d*.php\')',
                location_code)

            location_maths = [
                x for i in location_maths for x in i if str(x) != ''
            ]

            location_builder = parseJSString(location_maths)

            url = '%s%s' % (self.searchbase_link, self.search_link %
                            (location_builder, query, rlsbb_code))

            r = self.scraper.get(url).content

            try:
                results = json.loads(r)['results']
            except:
                return None

            if 'tvshowtitle' in data:
                regex = r'.*?(%s) .*?(s%se%s)' % (
                    data['tvshowtitle'].lower(), str(data['season']).zfill(2),
                    str(data['episode']).zfill(2))
            else:
                regex = r'.*?(%s) .*?(%s)' % (data['title'], data['year'])

            post_urls = []

            for post in results:

                if 'old' in post['domain']:
                    continue
                capture = re.findall(regex, post['post_title'].lower())
                capture = [i for i in capture if len(i) > 1]
                if len(capture) >= 1:
                    post_urls.append('http://%s/%s' %
                                     (post['domain'], post['post_name']))

            if len(post_urls) == 0:
                return None

            items = []
            for url in post_urls:
                r = self.scraper.get(url).content
                posts = client.parseDOM(r, "div", attrs={"class": "content"})
                hostDict = hostprDict + hostDict
                for post in posts:
                    try:
                        u = client.parseDOM(post, 'a', ret='href')
                        for i in u:
                            try:
                                if hdlr in i.upper() and cleantitle.get(
                                        title) in cleantitle.get(i):
                                    items.append(i)
                            except:
                                pass
                    except:
                        pass

            seen_urls = set()

            for item in items:
                try:
                    url = str(item)
                    url = client.replaceHTMLCodes(url)
                    url = url.encode('utf-8')

                    if url in seen_urls:
                        continue
                    seen_urls.add(url)

                    host = url.replace("\\", "")
                    host2 = host.strip('"')
                    host = re.findall(
                        '([\w]+[.][\w]+)$',
                        urlparse.urlparse(host2.strip().lower()).netloc)[0]

                    if host not in hostDict:
                        continue

                    if any(x in host2 for x in ['.rar', '.zip', '.iso']):
                        continue

                    quality, info = source_utils.get_release_quality(url)

                    info = ' | '.join(info)
                    host = client.replaceHTMLCodes(host)
                    host = host.encode('utf-8')
                    sources.append({
                        'source': host,
                        'quality': quality,
                        'language': 'en',
                        'url': host2,
                        'info': info,
                        'direct': False,
                        'debridonly': False
                    })

                except:
                    pass
            check = [i for i in sources if not i['quality'] == 'CAM']
            if check:
                sources = check
            return sources
        except:
            return sources
示例#26
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if url == None: return sources
         if debrid.status() is False: raise Exception()
         data = urlparse.parse_qs(url)
         data = dict([(i, data[i][0]) if data[i] else (i, '')
                      for i in data])
         title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
             'title']
         hdlr = 'S%02dE%02d' % (int(data['season']), int(
             data['episode'])) if 'tvshowtitle' in data else data['year']
         query = '%s S%02dE%02d' % (
             data['tvshowtitle'], int(data['season']),
             int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                 data['title'], data['year'])
         query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
         url = self.search_link % urllib.quote_plus(query)
         url = urlparse.urljoin(self.base_link, url)
         html = client.request(url)
         posts = client.parseDOM(html, 'item')
         hostDict = hostprDict + hostDict
         items = []
         for post in posts:
             try:
                 t = client.parseDOM(post, 'title')[0]
                 u = client.parseDOM(post, 'a', ret='href')
                 s = re.search(
                     '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))',
                     post)
                 s = s.groups()[0] if s else '0'
                 items += [(t, i, s) for i in u]
             except:
                 pass
         for item in items:
             try:
                 url = item[1]
                 if any(x in url for x in ['.rar', '.zip', '.iso']):
                     raise Exception()
                 url = client.replaceHTMLCodes(url)
                 url = url.encode('utf-8')
                 valid, host = source_utils.is_host_valid(url, hostDict)
                 if not valid: raise Exception()
                 host = client.replaceHTMLCodes(host)
                 host = host.encode('utf-8')
                 name = item[0]
                 name = client.replaceHTMLCodes(name)
                 t = re.sub(
                     '(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)',
                     '',
                     name,
                     flags=re.I)
                 if not cleantitle.get(t) == cleantitle.get(title):
                     raise Exception()
                 y = re.findall(
                     '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                     name)[-1].upper()
                 if not y == hdlr: raise Exception()
                 quality, info = source_utils.get_release_quality(name, url)
                 try:
                     size = re.findall(
                         '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))',
                         item[2])[-1]
                     div = 1 if size.endswith(('GB', 'GiB')) else 1024
                     size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                     size = '%.2f GB' % size
                     info.append(size)
                 except:
                     pass
                 info = ' | '.join(info)
                 sources.append({
                     'source': host,
                     'quality': quality,
                     'language': 'en',
                     'url': url,
                     'info': info,
                     'direct': False,
                     'debridonly': True
                 })
             except:
                 pass
         check = [i for i in sources if not i['quality'] == 'CAM']
         if check: sources = check
         return sources
     except:
         return
示例#27
0
文件: zoogle.py 项目: schubic/install
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if url is None: return sources
         if debrid.status() is False: raise Exception()
         data = urlparse.parse_qs(url)
         data = dict([(i, data[i][0]) if data[i] else (i, '')
                      for i in data])
         title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
             'title']
         hdlr = 'S%02dE%02d' % (int(data['season']), int(
             data['episode'])) if 'tvshowtitle' in data else data['year']
         category = '+category%3ATV' if 'tvshowtitle' in data else '+category%3AMovies'
         query = '%s S%02dE%02d' % (
             data['tvshowtitle'], int(data['season']),
             int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                 data['title'], data['year'])
         query = re.sub('(\\\|/| -|:|;|\*|\?|"|<|>|\|)', ' ', query)
         url = self.search_link % urllib.quote_plus(query)
         url = urlparse.urljoin(self.base_link, url) + str(category)
         html = client.request(url)
         html = html.replace('&nbsp;', ' ')
         try:
             results = \
                 client.parseDOM(html, 'table', attrs={'class': 'table table-condensed table-torrents vmiddle'})[0]
         except Exception:
             return sources
         rows = re.findall('<tr(.+?)</tr>', results, re.DOTALL)
         if rows is None:
             return sources
         for entry in rows:
             try:
                 try:
                     name = re.findall('<a class=".+?>(.+?)</a>', entry,
                                       re.DOTALL)[0]
                     name = client.replaceHTMLCodes(name).replace(
                         '<hl>', '').replace('</hl>', '')
                     if not cleantitle.get(title) in cleantitle.get(name):
                         continue
                 except Exception:
                     continue
                 y = re.findall(
                     '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                     name)[-1].upper()
                 if not y == hdlr:
                     continue
                 try:
                     seeders = int(
                         re.findall(
                             'class="progress prog trans90" title="Seeders: (.+?) \|',
                             entry, re.DOTALL)[0])
                 except Exception:
                     continue
                 if self.min_seeders > seeders:
                     continue
                 try:
                     link = 'magnet:%s' % (re.findall(
                         'href="magnet:(.+?)"', entry, re.DOTALL)[0])
                     link = str(
                         client.replaceHTMLCodes(link).split('&tr')[0])
                 except Exception:
                     continue
                 quality, info = source_utils.get_release_quality(
                     name, name)
                 try:
                     size = re.findall(
                         '((?:\d+\.\d+|\d+\,\d+|\d+)\s*(?:GB|GiB|MB|MiB))',
                         entry)[-1]
                     div = 1 if size.endswith(('GB', 'GiB')) else 1024
                     size = float(re.sub('[^0-9|/.|/,]', '', size)) / div
                     size = '%.2f GB' % size
                     info.append(size)
                 except Exception:
                     pass
                 info = ' | '.join(info)
                 sources.append({
                     'source': 'Torrent',
                     'quality': quality,
                     'language': 'en',
                     'url': link,
                     'info': info,
                     'direct': False,
                     'debridonly': True
                 })
             except Exception:
                 continue
         check = [i for i in sources if not i['quality'] == 'CAM']
         if check:
             sources = check
         return sources
     except Exception:
         return self._sources
示例#28
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         openload_limit = 1
         vshare_limit = 1
         flashx_limit = 1
         thevideobee_limit = 1
         entervideo_limit = 1
         megamp4_limit = 1
         vidtodo_limit = 1
         r = self.scraper.get(url).content
         try:
             v = re.findall('document.write\(Base64.decode\("(.+?)"\)',
                            r)[0]
             b64 = base64.b64decode(v)
             url = client.parseDOM(b64, 'iframe', ret='src')[0]
             try:
                 host = re.findall(
                     '([\w]+[.][\w]+)$',
                     urlparse.urlparse(url.strip().lower()).netloc)[0]
                 host = client.replaceHTMLCodes(host)
                 host = host.encode('utf-8')
                 valid, host = source_utils.is_host_valid(host, hostDict)
                 if valid:
                     sources.append({
                         'source': host,
                         'quality': 'SD',
                         'language': 'en',
                         'url': url.replace('\/', '/'),
                         'direct': False,
                         'debridonly': False
                     })
             except:
                 pass
         except:
             pass
         r = client.parseDOM(r, 'div', {'class': 'server_line'})
         r = [(client.parseDOM(i, 'a', ret='href')[0],
               client.parseDOM(i, 'p', attrs={'class':
                                              'server_servername'})[0])
              for i in r]
         if r:
             for i in r:
                 try:
                     host = re.sub('Server|Link\s*\d+', '', i[1]).lower()
                     url = i[0]
                     host = client.replaceHTMLCodes(host)
                     host = host.encode('utf-8')
                     if 'other' in host: continue
                     valid, host = source_utils.is_host_valid(
                         host, hostDict)
                     if 'openload' in host:
                         if openload_limit < 1:
                             continue
                         else:
                             openload_limit -= 1
                     if 'vshare' in host:
                         if vshare_limit < 1:
                             continue
                         else:
                             vshare_limit -= 1
                     if 'flashx' in host:
                         if flashx_limit < 1:
                             continue
                         else:
                             flashx_limit -= 1
                     if 'thevideobee' in host:
                         if thevideobee_limit < 1:
                             continue
                         else:
                             thevideobee_limit -= 1
                     if 'entervideo' in host:
                         if entervideo_limit < 1:
                             continue
                         else:
                             entervideo_limit -= 1
                     if 'megamp4' in host:
                         if megamp4_limit < 1:
                             continue
                         else:
                             megamp4_limit -= 1
                     if 'vidtodo' in host:
                         if vidtodo_limit < 1:
                             continue
                         else:
                             vidtodo_limit -= 1
                     if valid:
                         sources.append({
                             'source': host,
                             'quality': 'SD',
                             'language': 'en',
                             'url': url.replace('\/', '/'),
                             'direct': False,
                             'debridonly': False
                         })
                 except:
                     pass
         return sources
     except Exception:
         return
示例#29
0
 def sources(self, url, hostDict, hostprDict):
     try:
         sources = []
         if url == None: return sources
         if debrid.status() == False: raise Exception()
         hostDict = hostprDict + hostDict
         data = urlparse.parse_qs(url)
         data = dict([(i, data[i][0]) if data[i] else (i, '')
                      for i in data])
         title = data['tvshowtitle'] if 'tvshowtitle' in data else data[
             'title']
         hdlr = '%sS%02dE%02d' % (
             data['year'], int(data['season']), int(data['episode'])
         ) if 'tvshowtitle' in data else data['year']
         query = '%s %s S%02dE%02d' % (
             data['tvshowtitle'], data['year'], int(data['season']),
             int(data['episode'])) if 'tvshowtitle' in data else '%s %s' % (
                 data['title'], data['year'])
         query = re.sub('(\\\|/| -|:|;|\*|\?|"|\'|<|>|\|)', ' ', query)
         try:
             url = self.search_link % urllib.quote_plus(query)
             url = urlparse.urljoin(self.base_link, url)
             r = self.scraper.get(url).content
             posts = client.parseDOM(r, 'div', attrs={'class': 'post'})
             items = []
             dupes = []
             for post in posts:
                 try:
                     t = client.parseDOM(post, 'a')[0]
                     t = re.sub('<.+?>|</.+?>', '', t)
                     x = re.sub(
                         '(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)',
                         '', t)
                     if not cleantitle.get(title) in cleantitle.get(x):
                         raise Exception()
                     y = re.findall(
                         '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                         t)[-1].upper()
                     if not y == hdlr: raise Exception()
                     if len(dupes) > 2: raise Exception()
                     dupes += [x]
                     u = client.parseDOM(post, 'a', ret='href')[0]
                     r = self.scraper.get(u).content
                     u = client.parseDOM(r, 'a', ret='href')
                     u = [(i.strip('/').split('/')[-1], i) for i in u]
                     items += u
                 except:
                     pass
         except:
             pass
         for item in items:
             try:
                 name = item[0]
                 name = client.replaceHTMLCodes(name)
                 t = re.sub(
                     '(\.|\(|\[|\s)(\d{4}|S\d*E\d*|S\d*|3D)(\.|\)|\]|\s|)(.+|)',
                     '', name)
                 if not cleantitle.get(t) == cleantitle.get(title):
                     raise Exception()
                 y = re.findall(
                     '[\.|\(|\[|\s](\d{4}|S\d*E\d*|S\d*)[\.|\)|\]|\s]',
                     name)[-1].upper()
                 if not y == hdlr: raise Exception()
                 quality, info = source_utils.get_release_quality(
                     name, item[1])
                 url = item[1]
                 if any(x in url for x in ['.rar', '.zip', '.iso']):
                     raise Exception()
                 url = client.replaceHTMLCodes(url)
                 url = url.encode('utf-8')
                 host = re.findall(
                     '([\w]+[.][\w]+)$',
                     urlparse.urlparse(url.strip().lower()).netloc)[0]
                 if not host in hostDict: raise Exception()
                 host = client.replaceHTMLCodes(host)
                 host = host.encode('utf-8')
                 sources.append({
                     'source': host,
                     'quality': quality,
                     'language': 'en',
                     'url': url,
                     'info': info,
                     'direct': False,
                     'debridonly': True
                 })
             except:
                 pass
         return sources
     except:
         return