示例#1
0
 def search(self, title, localtitle, year):
     try:
         import sys
         reload(sys)
         sys.setdefaultencoding('utf8')
         simply_name = cleantitle.get(localtitle)
         simply_name2 = cleantitle.get(title)
         simply_name = cleantitle.query(localtitle).split(' ')
         simply_name2 = cleantitle.query(title).split(' ')
         query = self.search_link % urllib.quote_plus(
             cleantitle.query(localtitle))
         url = urlparse.urljoin(self.base_link, query)
         result = client.request(url)
         result = client.parseDOM(result,
                                  'div',
                                  attrs={'class': 'row search-results'})
         results = client.parseDOM(
             result,
             'div',
             attrs={'class': 'item-detail-bigblock title title-bigblock'})
         for result in results:
             movieneourl = client.parseDOM(result, 'a', ret='href')[0]
             result = client.parseDOM(result, 'a')[0]
             for word in simply_name:
                 if word in result and year in result:
                     return [
                         urlparse.urljoin(self.base_link, movieneourl),
                         result
                     ]
                 continue
     except Exception, e:
         print str(e)
         return
示例#2
0
 def search(self, title, localtitle, year, search_type):
     try:
         url = self.do_search(cleantitle.query(title), title, localtitle,
                              year, search_type)
         if not url:
             url = self.do_search(cleantitle.query(localtitle), title,
                                  localtitle, year, search_type)
         return url
     except:
         return
示例#3
0
    def search(self, localtitle, year, search_type):
        try:

            url = urlparse.urljoin(self.base_link, self.search_link)
            r = client.request(url,
                               redirect=False,
                               post={
                                   'q': cleantitle.query(localtitle),
                                   'sb': ''
                               })
            r = client.parseDOM(r, 'div', attrs={'class': 'small-item'})

            local_simple = cleantitle.get(localtitle)
            for row in r:
                name_found = client.parseDOM(row, 'a')[1]
                year_found = name_found[name_found.find("(") +
                                        1:name_found.find(")")]
                url = client.parseDOM(row, 'a', ret='href')[1]
                if not search_type in url:
                    continue

                if cleantitle.get(
                        name_found) == local_simple and year_found == year:
                    return url
        except:
            return
示例#4
0
文件: cdax.py 项目: po50on/cherry-dev
    def search(self, localtitle, year, search_type):
        try:
            #import pydevd
            #pydevd.settrace(stdoutToServer=True, stderrToServer=True)
            simply_name = cleantitle.get(localtitle)

            query = self.search_link % urllib.quote_plus(
                cleantitle.query(localtitle))
            query = urlparse.urljoin(self.base_link, query)
            result = client.request(query)

            result = client.parseDOM(result,
                                     'div',
                                     attrs={'class': 'result-item'})
            for x in result:
                correct_type = client.parseDOM(x,
                                               'span',
                                               attrs={'class': search_type})
                correct_year = client.parseDOM(x,
                                               'span',
                                               attrs={'class':
                                                      'year'})[0] == year
                name = client.parseDOM(x, 'div', attrs={'class': 'title'})[0]
                url = client.parseDOM(name, 'a', ret='href')[0]
                name = cleantitle.get(client.parseDOM(name, 'a')[0])
                if (correct_type and correct_year and name == simply_name):
                    return url

        except:
            return
示例#5
0
    def movie(self, imdb, title, localtitle, aliases, year):
        try:

            url = urlparse.urljoin(self.base_link, self.search_link)
            r = client.request(url, redirect=False, post={'szukaj' :cleantitle.query(localtitle)})
            r = client.parseDOM(r, 'div', attrs={'class':'video_info'})
            
            local_simple = cleantitle.get(localtitle)            
            for row in r:                
                name_found = client.parseDOM(row, 'h1')[0]
                year_found = name_found[name_found.find("(") + 1:name_found.find(")")]                        
                if cleantitle.get(name_found) == local_simple and year_found == year:
                    url = client.parseDOM(row, 'a', ret='href')[0]               
                    return url
        except:
            return       
示例#6
0
    def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
        try:
            key = urlparse.urljoin(self.base_link, self.key_link)
            key = proxy.request(key, 'main_body')
            key = client.parseDOM(key, 'input', ret='value', attrs = {'name': 'key'})[0]

            query = self.tvsearch_link % (urllib.quote_plus(cleantitle.query(tvshowtitle)), key)
            query = urlparse.urljoin(self.base_link, query)

            result = str(proxy.request(query, 'main_body'))
            if 'page=2' in result or 'page%3D2' in result: result += str(proxy.request(query + '&page=2', 'main_body'))

            result = client.parseDOM(result, 'div', attrs = {'class': 'index_item.+?'})

            tvshowtitle = 'watch' + cleantitle.get(tvshowtitle)
            years = ['(%s)' % str(year), '(%s)' % str(int(year)+1), '(%s)' % str(int(year)-1)]

            result = [(client.parseDOM(i, 'a', ret='href'), client.parseDOM(i, 'a', ret='title')) 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 for i in result if any(x in i[1] for x in years)]

            r = [(proxy.parse(i[0]), i[1]) for i in result]

            match = [i[0] for i in r if tvshowtitle == cleantitle.get(i[1]) and '(%s)' % str(year) in i[1]]

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

            for i in match2[:5]:
                try:
                    if len(match) > 0: url = match[0] ; break
                    r = proxy.request(urlparse.urljoin(self.base_link, i), 'main_body')
                    r = re.findall('(tt\d+)', r)
                    if imdb in r: url = i ; break
                except:
                    pass

            url = re.findall('(?://.+?|)(/.+)', url)[0]
            url = client.replaceHTMLCodes(url)
            url = url.encode('utf-8')
            return url
        except:
            return
示例#7
0
    def search(self, title, localtitle, year):
        try:
            simply_name = cleantitle.get(localtitle)
            simply_name2 = cleantitle.get(title)
            query = self.search_link % urllib.quote_plus(
                cleantitle.query(localtitle))
            url = urlparse.urljoin(self.base_link, query)
            headers = {
                'User-Agent':
                'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0',
                'Referer': 'https://segos.es/?page=login'
            }
            data = {
                "login": self.user_name,
                'password': self.user_pass,
                'loguj': ''
            }
            url = 'https://segos.es/?page=login'
            s = requests.Session()
            s.post('https://segos.es/?page=login', data=data, headers=headers)
            url = urlparse.urljoin(self.base_link, query)
            k = s.get(url)
            result = k.text

            results = client.parseDOM(
                result,
                'div',
                attrs={'class': 'col-lg-12 col-md-12 col-xs-12'})
            for result in results:
                segosurl = client.parseDOM(result, 'a', ret='href')[0]
                result = client.parseDOM(result, 'a')
                segostitles = cleantitle.get(result[1]).split('/')
                rok = str(result[1][-5:-1])
                for segostitle in segostitles:
                    if (simply_name == segostitle
                            or simply_name2 == segostitle) and year == rok:
                        return urlparse.urljoin(self.base_link, segosurl)
                    continue
        except Exception, e:
            print str(e)
            return
示例#8
0
    def do_search(self, title, local_title, year, video_type):
        try:
            cookie = ''
            cookie = client.request(self.base_link,
                                    output='cookie',
                                    error=True)

            url = urlparse.urljoin(self.base_link, self.search_link)
            url = url % urllib.quote_plus(cleantitle.query(title))
            headers = {
                'User-Agent':
                'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3435.0 Safari/537.36',
                'Referer': 'https://cda-hd.co/'
            }
            result = client.request(url,
                                    headers=headers,
                                    cookie=cookie,
                                    redirect=False)
            cookie = ''
            result = client.parseDOM(result, 'div', attrs={'class': 'item'})
            for row in result:
                row_type = client.parseDOM(row,
                                           'div',
                                           attrs={'class': 'typepost'})[0]
                if row_type != video_type:
                    continue
                names = client.parseDOM(row, 'span', attrs={'class': 'tt'})[0]
                names = names.split('/')
                year_found = client.parseDOM(row,
                                             'span',
                                             attrs={'class': 'year'})

                titles = [cleantitle.get(i) for i in [title, local_title]]

                if self.name_matches(names, titles,
                                     year) and (len(year_found) == 0
                                                or year_found[0] == year):
                    url = client.parseDOM(row, 'a', ret='href')[0]
                    return urlparse.urljoin(self.base_link, url)
        except:
            return
示例#9
0
 def do_search(self, title, local_title, year, video_type):
     try:
         url = urlparse.urljoin(self.base_link, self.search_link)
         url = url % urllib.quote_plus(cleantitle.query(title))
         result = client.request(url)
         result = client.parseDOM(result, 'div', attrs={'class': 'item'})
         for row in result:
             row_type = client.parseDOM(row, 'div', attrs={'class': 'typepost'})[0]
             if row_type != video_type:
                 continue
             names = client.parseDOM(row, 'span', attrs={'class': 'tt'})[0]
             names = names.split('/')
             year_found = client.parseDOM(row, 'span', attrs={'class': 'year'})
             
             titles = [cleantitle.get(i) for i in [title,local_title]]
             
             if self.name_matches(names, titles, year) and (len(year_found) == 0 or year_found[0] == year):
                 url = client.parseDOM(row, 'a', ret='href')[0]
                 return urlparse.urljoin(self.base_link, url)
     except :
         return
示例#10
0
    def search(self, title, localtitle, year, search_type):
        try:
            title = cleantitle.normalize(cleantitle.getsearch(title + " 3d"))
            names = [cleantitle.get(i) for i in [title, localtitle]]
            r = client.request(
                urlparse.urljoin(self.base_link, self.search_link),
                post={'search': cleantitle.query(title + " 3d")})
            r = self.get_rows(r, search_type)
            localtitle = cleantitle.normalize(
                cleantitle.getsearch(localtitle + " 3d"))

            for row in r:
                url = client.parseDOM(row, 'a', ret='href')[0]
                names_found = client.parseDOM(row, 'h3')[0]
                if names_found.startswith(
                        'Zwiastun') and not localtitle.startswith('Zwiastun'):
                    continue
                names_found = names_found.split('/')
                names_found = [
                    cleantitle.normalize(cleantitle.getsearch(i))
                    for i in names_found
                ]
                for name in names_found:
                    name = name.replace("  ", " ")
                    title = title.replace("  ", " ")
                    localtitle = localtitle.replace("  ", " ")
                    words = title.split(" ")
                    words2 = localtitle.split(" ")
                    found_year = self.try_read_year(url)
                    if (self.contains_all_wors(name, words)
                            or self.contains_all_wors(name, words2)) and (
                                not found_year or found_year == year):
                        return url
                    else:
                        continue
                continue
        except:
            return
示例#11
0
    def search(self, title, localtitle, year, search_type):
        try:
            titles= []
            titles.append(cleantitle.normalize(cleantitle.getsearch(title)))
            titles.append(cleantitle.normalize(cleantitle.getsearch(localtitle)))
			
            for title in titles:
                headers = {
                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3435.0 Safari/537.36',
				'Origin': 'http://alltube.pl',
				'Referer': 'http://alltube.pl/szukaj'
                }
                r = client.request(urlparse.urljoin(self.base_link, self.search_link), post={'search': cleantitle.query(title)}, headers=headers)
                r = self.get_rows(r, search_type)
                
                for row in r:
                    url = client.parseDOM(row, 'a', ret='href')[0]
                    names_found = client.parseDOM(row, 'h3')[0]
                    if names_found.startswith('Zwiastun') and not title.startswith('Zwiastun'):
                        continue
                    names_found = names_found.split('/')
                    names_found = [cleantitle.normalize(cleantitle.getsearch(i)) for i in names_found]
                    for name in names_found:
                        name = name.replace("  "," ")
                        title = title.replace("  "," ")
                        words = title.split(" ")
                        found_year = self.try_read_year(url)
                        if self.contains_all_wors(name, words) and (not found_year or found_year == year):
                            return url
                        else:
                            continue
                    continue
        except Exception, e:
            print e
            return
示例#12
0
 def tvshow(self, imdb, tvdb, tvshowtitle, localtvshowtitle, aliases, year):
     try:
         url = urlparse.urljoin(self.base_link, self.search_link % urllib.quote_plus(cleantitle.query(tvshowtitle)))
         self.tvshowtitle = tvshowtitle
         return url
     except:
         return