コード例 #1
0
ファイル: main.py プロジェクト: Sheppounet/script.pulsar.omg
def search_episode(episode): 
    provider.log.debug("Search episode : name %(title)s, season %(season)02d, episode %(episode)02d" % episode)
    # Pulsar 0.2 doesn't work well with foreing title.  Get the FRENCH title from TMDB
    provider.log.debug('Get FRENCH title from TMDB for %s' % episode['imdb_id'])
    response = provider.GET("%s/find/%s?api_key=%s&language=fr&external_source=imdb_id" % (tmdbUrl, episode['imdb_id'], tmdbKey))
    provider.log.debug(response)
    if response != (None, None):
        name_normalize = unicodedata.normalize('NFKD',response.json()['tv_results'][0]['name'])
        episode['title'] = ''.join(c for c in name_normalize if (not unicodedata.combining(c)))
        provider.log.info('FRENCH title :  %s' % episode['title'])
    else :
        provider.log.error('Error when calling TMDB. Use Pulsar movie data.')
    resp = provider.GET("%s/%s?ajax&query=%s" % (__baseUrl__, ACTION_SEARCH, provider.quote_plus(episode['title'])))
    for result in resp.json():
        if result["category"] == CATEGORY_SERIES :
            # Get show's individual url
            url = "%s/%s?query=%s" % (__baseUrl__, ACTION_SEARCH, provider.quote_plus(result["label"]))
            if episode['season'] is not 1 :
                # Get model url for requested season
                provider.log.debug('Season URL: %s' % url)
                response = provider.HEAD(url)
                # Replace "season" data in url.  Ex.  :
                # http://www.omgtorrent.com/series/true-blood_saison_7_53.html
                url = response.geturl().replace("_1_","_%s_" % episode['season'])
            # Parse season specific page
            return parse_season(url,episode['episode'])
コード例 #2
0
def search(query, cat_id=CAT_VIDEO, terms=None):
    result = []
    threads = []
    q = Queue.Queue()
    provider.log.debug("QUERY : %s" % query)
    query_normalize = unicodedata.normalize('NFKD',query)
    query = ''.join(c for c in query_normalize if (not unicodedata.combining(c)))
    response = call('/torrents/search/%s&cid=%s%s' % (provider.quote_plus(query), cat_id, terms))
    provider.log.debug("Search results : %s" % response)
    # Pulsar send GET requests & t411 api needs POST
    # Must use the bencode tool :(
    
    for t in response['torrents'] :

        # Call each individual page in parallel
        thread = Thread(target=torrent2magnet, args = (t, q, user_credentials['token']))
        thread.start()
        threads.append(thread)

    # And get all the results
    for t in threads :
        t.join()
    while not q.empty():
        item = q.get()
        result.append({
                       "size": item["size"], 
                       "seeds": item["seeds"], 
                       "peers": item["peers"], 
                       "name": item["name"],
                       "trackers": item["trackers"],
                       "info_hash": item["info_hash"],
                       "is_private": True})
    return result
コード例 #3
0
def search_episode(info):
    info['title'] = common.exception(info['title'])
    if info['absolute_number'] == 0:
        query = info['title'] + ' %sx%02d'% (info['season'], info['episode'])  # define query
    else:
        query = info['title'] + ' %02d' % info['absolute_number']  # define query anime
    query = query.encode('utf-8')
    filters.title = query
    if settings.time_noti > 0: provider.notify(message="Searching: " + query.title() + '...', header=None, time=settings.time_noti, image=settings.icon)
    query = provider.quote_plus(query)
    url_search = "%s/buscar.php?busqueda=%s" % (settings.url,query)
    provider.log.info(url_search)
    if browser.open(url_search):
        results = []
        data = browser.content
        search_serie = re.search('/series/(.*?)/" title', data)
        if search_serie is not None:
            url_search = '%s/series/%s/' % (settings.url, search_serie.group(1))
            browser.open(url_search)
            data = browser.content
            cont = 0
            lname = re.search(filters.title.replace(' ', '.') + '(.*?).torrent', data, re.IGNORECASE)
            if lname is not None:
                torrent = '%s/torrents_tor/%s' % (settings.url, lname.group())
                name = lname.group().replace('.torrent', '') + ' S%02dE%02d'% (info['season'], info['episode']) + ' - ' + settings.name_provider #find name in the torrent
                results.append({"name": name, "uri":  torrent, "seeds": 10000, "peers": 5000})  # return le torrent
                cont = 1
            provider.log.info('>>>>>> ' + str(cont) + ' torrents sent to Pulsar<<<<<<<')
    else:
        provider.log.error('>>>>>>>%s<<<<<<<' % browser.status)
        provider.notify(message=browser.status, header=None, time=5000, image=settings.icon)
    return results
コード例 #4
0
def search(query):
    provider.log.info("QUERY : %s" % query)
    query_normalize = unicodedata.normalize('NFKD', query)
    query = ''.join(c for c in query_normalize
                    if (not unicodedata.combining(c)))
    # Replace non-alphanum caracters by -, then replace the custom "5number" tags by true folder
    query = re.sub('[^0-9a-zA-Z]+', '-', query)
    query = provider.quote_plus(query)
    query = query.replace('11111',
                          ACTION_SERIES).replace('22222', ACTION_FILMS)
    provider.log.info("GET : %s/%s/%s.html" %
                      (__baseUrl__, ACTION_SEARCH, query))
    resp = provider.GET("%s/%s/%s.html" % (__baseUrl__, ACTION_SEARCH, query))
    # REGEX to find wanted links - 2 capturing groups
    # - (?:films|series) : match only films or series, ?: is to exclude this group from capturing, which generate a tuple as return
    # - Use the class to exclude ads "top downloaded" links
    # - >(.*?)< to get the media name
    # It brings back a tuple : torrent[0] = uri, torrent[1] = name
    p = re.compile(
        ur'(/dl-torrent/(?:films|series)/\S*\.html).*?class="titre">(.*?)<')
    # Uncomment if needed to get optimal perfs
    #for torrent in re.findall(p, resp.data) :
    #    provider.log.debug("REGEX FOUND %s" % torrent[0])
    return [{
        "name":
        torrent[1],
        "uri":
        __baseUrl__ + "/telechargement/" +
        torrent[0].rpartition('/')[2].replace(".html", ".torrent")
    } for torrent in re.findall(p, resp.data)]
コード例 #5
0
ファイル: main.py プロジェクト: Inter95/tutvguia
def search(query):
    provider.log.info("QUERY : %s" % query)
    query_normalize = unicodedata.normalize("NFKD", query)
    query = "".join(c for c in query_normalize if (not unicodedata.combining(c)))
    # Replace non-alphanum caracters by -, then replace the custom "5number" tags by true folder
    query = re.sub("[^0-9a-zA-Z]+", "-", query)
    query = provider.quote_plus(query)
    query = query.replace("11111", ACTION_SERIES).replace("22222", ACTION_FILMS)
    provider.log.info("GET : %s/%s/%s.html" % (__baseUrl__, ACTION_SEARCH, query))
    resp = provider.GET("%s/%s/%s.html" % (__baseUrl__, ACTION_SEARCH, query))
    # REGEX to find wanted links - 2 capturing groups
    # - (?:films|series) : match only films or series, ?: is to exclude this group from capturing, which generate a tuple as return
    # - Use the class to exclude ads "top downloaded" links
    # - >(.*?)< to get the media name
    # It brings back a tuple : torrent[0] = uri, torrent[1] = name
    p = re.compile(ur'(/dl-torrent/(?:films|series)/\S*\.html).*?class="titre">(.*?)<')
    # Uncomment if needed to get optimal perfs
    # for torrent in re.findall(p, resp.data) :
    #    provider.log.debug("REGEX FOUND %s" % torrent[0])
    return [
        {
            "name": torrent[1],
            "uri": __baseUrl__ + "/telechargement/" + torrent[0].rpartition("/")[2].replace(".html", ".torrent"),
        }
        for torrent in re.findall(p, resp.data)
    ]
コード例 #6
0
def search(query):
    global filters
    query = query.lower()
    filters.title = query  # to do filtering by name
    if settings.extra <> '': query += ' ' + settings.extra
    if settings.time_noti > 0:
        provider.notify(message="Searching: " +
                        query.encode('utf-8', 'ignore').title() + '...',
                        header=None,
                        time=settings.time_noti,
                        image=settings.icon)
    query = provider.quote_plus(
        query.lstrip())  #Esto añade los %20 de los espacios
    url_search = "%s/index.php?page=buscar&q=%s&ordenar=Nombre&inon=Ascendente&idioma=1" % (
        settings.url, query)
    provider.log.info(url_search)
    if browser.open(url_search):
        results = extract_torrents(browser.content, query)
    else:
        provider.log.error('>>>>>>>%s<<<<<<<' % browser.status)
        provider.notify(message=browser.status,
                        header=None,
                        time=5000,
                        image=settings.icon)
        results = []
    return results
コード例 #7
0
ファイル: main.py プロジェクト: brra/script.pulsar.TPB
def search(query):
    pre1 =  __proxy__
    pre2 =  '/search/%s'
    url = pre1 + pre2
    resp = provider.GET(url % provider.quote_plus(query), params={
                        "q": query,
                        })
    return provider.extract_magnets(resp.data)
コード例 #8
0
def get_titles(title, tvdb_id):
    url_tvdb = "http://www.thetvdb.com/api/GetSeries.php?seriesname=%s" % provider.quote_plus(title)
    provider.log.info(url_tvdb)
    if browser.open(url_tvdb):
        pat = re.compile('<seriesid>%d</seriesid>.*?<AliasNames>(.*?)</AliasNames>' % tvdb_id, re.I | re.S)
        show = pat.search(browser.content) # find all aliases
        if show:
            aliases = show.group(1).strip()
            provider.log.info("Aliases: " + aliases)
            return [ title ] + aliases.split('|')
    return [ title ]		
コード例 #9
0
ファイル: main.py プロジェクト: Inter95/tutvguia
def get_titles(title, tvdb_id):
    url_tvdb = "http://www.thetvdb.com/api/GetSeries.php?seriesname=%s" % provider.quote_plus(title)
    provider.log.info(url_tvdb)
    if browser.open(url_tvdb):
        pat = re.compile('<seriesid>%d</seriesid>.*?<AliasNames>(.*?)</AliasNames>' % tvdb_id, re.I | re.S)
        show = pat.search(browser.content) # find all aliases
        if show:
            aliases = show.group(1).strip()
            provider.log.info("Aliases: " + aliases)
            return [ title ] + aliases.split('|')
    return [ title ]		
コード例 #10
0
def search_episode(info):
    info['title'] = common.exception(info['title'])
    if info['absolute_number'] == 0:
        query = info['title'] + ' %sx%02d' % (info['season'], info['episode']
                                              )  # define query
    else:
        query = info['title'] + ' %02d' % info[
            'absolute_number']  # define query anime
    query = query.encode('utf-8')
    filters.title = query
    if settings.time_noti > 0:
        provider.notify(message="Searching: " + query.title() + '...',
                        header=None,
                        time=settings.time_noti,
                        image=settings.icon)
    query = provider.quote_plus(query)
    url_search = "%s/buscar.php?busqueda=%s" % (settings.url, query)
    provider.log.info(url_search)
    if browser.open(url_search):
        results = []
        data = browser.content
        search_serie = re.search('/series/(.*?)/" title', data)
        if search_serie is not None:
            url_search = '%s/series/%s/' % (settings.url,
                                            search_serie.group(1))
            browser.open(url_search)
            data = browser.content
            cont = 0
            lname = re.search(
                filters.title.replace(' ', '.') + '(.*?).torrent', data,
                re.IGNORECASE)
            if lname is not None:
                torrent = '%s/torrents_tor/%s' % (settings.url, lname.group())
                name = lname.group(
                ).replace('.torrent', '') + ' S%02dE%02d' % (
                    info['season'], info['episode']
                ) + ' - ' + settings.name_provider  #find name in the torrent
                results.append({
                    "name": name,
                    "uri": torrent,
                    "seeds": 10000,
                    "peers": 5000
                })  # return le torrent
                cont = 1
            provider.log.info('>>>>>> ' + str(cont) +
                              ' torrents sent to Pulsar<<<<<<<')
    else:
        provider.log.error('>>>>>>>%s<<<<<<<' % browser.status)
        provider.notify(message=browser.status,
                        header=None,
                        time=5000,
                        image=settings.icon)
    return results
コード例 #11
0
def search(info):
  query = info['query'] + ' ' + extra
  provider.notify(message = "Searching: " + query.title() + '...', header = None, time = 1500, image=icon)
  query = provider.quote_plus(query)
  url_search = "%s/search/?search=%s&srt=seeds&order=desc" % (url,query)
  provider.log.info(url_search)
  response = provider.GET(url_search)
  if response == (None, None):
    provider.log.error('404 Page not found')
    return []
  else:
    return extract_torrents(response.data)
コード例 #12
0
def search_movie(movie):
    if(titreVF == 'true') :
        #Pulsar 0.2 doesn't work well with foreing title. Get the FRENCH title from TMDB
        provider.log.debug('Get FRENCH title from TMDB for %s' % movie['imdb_id'])
        response = provider.GET("%s/movie/%s?api_key=%s&language=fr&external_source=imdb_id&append_to_response=alternative_titles" % (tmdbUrl, movie['imdb_id'], tmdbKey))
        if response != (None, None):
            title_normalize = unicodedata.normalize('NFKD',response.json()['title'])
            movie['title'] = movie['title'].join('|').join(c for c in title_normalize if (not unicodedata.combining(c)))
            provider.log.info('FRENCH title :  %s' % movie['title'])
        else :
            provider.log.error('Error when calling TMDB. Use Pulsar movie data.')

    return search(provider.quote_plus(movie['title']), CAT_MOVIE, pref_terms)
コード例 #13
0
def search_episode(episode):
    provider.log.debug(
        "Search episode : name %(title)s, season %(season)02d, episode %(episode)02d"
        % episode)
    # Pulsar 0.2 doesn't work well with foreing title.  Get the FRENCH title from TMDB
    provider.log.debug('Get FRENCH title from TMDB for %s' %
                       episode['imdb_id'])
    response = provider.GET(
        "%s/find/%s?api_key=%s&language=fr&external_source=imdb_id" %
        (tmdbUrl, episode['imdb_id'], tmdbKey))
    provider.log.debug(response)
    if response != (None, None):
        name_normalize = unicodedata.normalize(
            'NFKD',
            response.json()['tv_results'][0]['name'])
        episode['title'] = ''.join(c for c in name_normalize
                                   if (not unicodedata.combining(c)))
        provider.log.info('FRENCH title :  %s' % episode['title'])
    else:
        provider.log.error('Error when calling TMDB. Use Pulsar movie data.')
    resp = provider.GET(
        "%s/%s?ajax&query=%s" %
        (__baseUrl__, ACTION_SEARCH, provider.quote_plus(episode['title'])))
    for result in resp.json():
        if result["category"] == CATEGORY_SERIES:
            # Get show's individual url
            url = "%s/%s?query=%s" % (__baseUrl__, ACTION_SEARCH,
                                      provider.quote_plus(result["label"]))
            if episode['season'] is not 1:
                # Get model url for requested season
                provider.log.debug('Season URL: %s' % url)
                response = provider.HEAD(url)
                # Replace "season" data in url.  Ex.  :
                # http://www.omgtorrent.com/series/true-blood_saison_7_53.html
                url = response.geturl().replace("_1_",
                                                "_%s_" % episode['season'])
            # Parse season specific page
            return parse_season(url, episode['episode'])
コード例 #14
0
def search(query):
    global filters
    filters.title = query  # to do filtering by name
    if settings.time_noti > 0: provider.notify(message="Searching: " + query.title() + '...', header=None, time=settings.time_noti, image=settings.icon)
    query = provider.quote_plus(query)
    url_search = "%s/buscar.php?busqueda=%s" % (settings.url,query)
    provider.log.info(url_search)
    if browser.open(url_search):
        results = extract_torrents(browser.content)
    else:
        provider.log.error('>>>>>>>%s<<<<<<<' % browser.status)
        provider.notify(message=browser.status, header=None, time=5000, image=settings.icon)
        results = []
    return results
コード例 #15
0
def search(query):
    provider.log.debug("QUERY : %s" % query)
    if (query['query']):
        query = query['query']
    query_normalize = unicodedata.normalize('NFKD', query)
    query = ''.join(c for c in query_normalize
                    if (not unicodedata.combining(c)))
    url = "%s/%s?query=%s" % (__baseUrl__, ACTION_SEARCH,
                              provider.quote_plus(query))
    provider.log.info("SEARCH : %s" % url)
    response = provider.GET(url)
    if response.geturl() is not url:
        # Redirection 30x followed to individual page - Return the magnet link
        provider.log.info(
            'Redirection 30x followed to individual page - Return the magnet link'
        )
        return provider.extract_magnets(response.data)
        #return [{"uri": magnet} for magnet in re.findall(r'magnet:\?[^\'"\s<>\[\]]+', response.data)]
    else:
        # Multiple torrent page - Parse page to get individual page
        provider.log.info('Multiple torrent page - Parsing')
        # Parse the table result
        table = common.parseDOM(response.data,
                                'table',
                                attrs={"class": "table_corps"})
        liens = common.parseDOM(table,
                                'a',
                                attrs={"class": "torrent"},
                                ret='href')
        provider.log.debug('liens : %s' % liens)
        threads = []
        magnets = []
        q = Queue.Queue()

        # Call each individual page in parallel
        for lien in liens:
            thread = Thread(target=directLink,
                            args=('%s%s' % (__baseUrl__, lien), q))
            thread.start()
            threads.append(thread)

        # And get all the results
        for t in threads:
            t.join()
        while not q.empty():
            magnets.append(q.get()[0])

        provider.log.info('Magnets List : %s' % magnets)
        return magnets
コード例 #16
0
def search(query):
    global filters
    filters.title = query  # to do filtering by name
    query += ' ' + settings.extra
    if settings.time_noti > 0: provider.notify(message="Searching: " + query.title() + '...', header=None, time=settings.time_noti, image=settings.icon)
    query = provider.quote_plus(query.rstrip())
    url_search = "%s/?page=search&cats=%s&term=%s&sort=2" % (settings.url, category, query)  # change in each provider
    provider.log.info(url_search)
    if browser.open(url_search):
        results = extract_torrents(browser.content)
    else:
        provider.log.error('>>>>>>>%s<<<<<<<' % browser.status)
        provider.notify(message=browser.status, header=None, time=5000, image=settings.icon)
        results = []
    return results
コード例 #17
0
def search(query):
    global filters
    filters.title = query  # to do filtering by name
    query += ' ' + settings.extra
    if settings.time_noti > 0: provider.notify(message="Searching: " + query.title() + '...', header=None, time=settings.time_noti, image=settings.icon)
    query = provider.quote_plus(query.rstrip())
    param = r'?filter%5B0%5D%5Bt%5D=nyaa_class&filter%5B0%5D%5Bv%5D=' + category if category else ''
    url_search = "%s/search/%s%s" % (settings.url, query, param)  # change in each provider
    provider.log.info(url_search)
    if browser.open(url_search):
        results = extract_torrents(browser.content)
    else:
        provider.log.error('>>>>>>>%s<<<<<<<' % browser.status)
        provider.notify(message=browser.status, header=None, time=5000, image=settings.icon)
        results = []
    return results
コード例 #18
0
def search(query):
    global filters
    query = common.normalize(query)
    filters.title = query  # to do filtering by name
    query += ' ' + settings.extra
    if settings.time_noti > 0: provider.notify(message="Searching: " + query.title() + '...', header=None, time=settings.time_noti, image=settings.icon)
    query = provider.quote_plus(query)
    url_search = "%s/newtemp/include/ajax/ajax.search.php?search=%s" % (settings.url,query.replace(' ','%20'))  # change in each provider
    provider.log.info(url_search)
    if browser.open(url_search):
        results = extract_torrents(browser.content)
    else:
        provider.log.error('>>>>>>>%s<<<<<<<' % browser.status)
        provider.notify(message=browser.status, header=None, time=5000, image=settings.icon)
        results = []
    return results
コード例 #19
0
def search(query):
    global filters
    query = query.lower()
    filters.title = query  # to do filtering by name
    if settings.extra <> '': query += ' ' + settings.extra
    if settings.time_noti > 0: provider.notify(message="Searching: " + query.encode('utf-8','ignore').title() + '...', header=None, time=settings.time_noti, image=settings.icon)
    query = provider.quote_plus(query.lstrip()) #Esto añade los %20 de los espacios    
    url_search = "%s/index.php?page=buscar&q=%s&ordenar=Nombre&inon=Ascendente&idioma=1" % (settings.url,query)
    provider.log.info(url_search)
    if browser.open(url_search):
        results = extract_torrents(browser.content, query)
    else:
        provider.log.error('>>>>>>>%s<<<<<<<' % browser.status)
        provider.notify(message=browser.status, header=None, time=5000, image=settings.icon)
        results = []
    return results
コード例 #20
0
ファイル: main.py プロジェクト: Sheppounet/script.pulsar.omg
def search_movie(movie):
    # Pulsar 0.2 doesn't work well with foreing title.  Get the FRENCH title from TMDB
    provider.log.debug('Get FRENCH title from TMDB for %s' % movie['imdb_id'])
    response = provider.GET("%s/movie/%s?api_key=%s&language=fr&external_source=imdb_id&append_to_response=alternative_titles" % (tmdbUrl, movie['imdb_id'], tmdbKey))
    if response != (None, None):
        title_normalize = unicodedata.normalize('NFKD',response.json()['title'])
        movie['title'] = ''.join(c for c in title_normalize if (not unicodedata.combining(c)))
        provider.log.info('FRENCH title :  %s' % movie['title'])
    else :
        provider.log.error('Error when calling TMDB. Use Pulsar movie data.')
    resp = provider.GET("%s/%s?ajax&query=%s" % (__baseUrl__, ACTION_SEARCH, provider.quote_plus(movie['title'])))
    for result in resp.json():
        if result["category"] == CATEGORY_FILMS:
            # Get movie's page
            return search(result["label"])
    # If no result
    return []
コード例 #21
0
def search(query):
    global filters
    filters.title = query  # to do filtering by name
    if settings.time_noti > 0:
        provider.notify(message="Searching: " + query.title() + '...',
                        header=None,
                        time=settings.time_noti,
                        image=settings.icon)
    query = provider.quote_plus(query)
    url_search = "%s/buscar.php?busqueda=%s" % (settings.url, query)
    provider.log.info(url_search)
    if browser.open(url_search):
        results = extract_torrents(browser.content)
    else:
        provider.log.error('>>>>>>>%s<<<<<<<' % browser.status)
        provider.notify(message=browser.status,
                        header=None,
                        time=5000,
                        image=settings.icon)
        results = []
    return results
コード例 #22
0
ファイル: main.py プロジェクト: Inter95/tutvguia
def search_episode(info):
    info["title"] = common.exception(info["title"])
    if info["absolute_number"] == 0:
        query = info["title"] + " %sx%02d" % (info["season"], info["episode"])  # define query
    else:
        query = info["title"] + " %02d" % info["absolute_number"]  # define query anime
    query = query.encode("utf-8")
    filters.title = query
    if settings.time_noti > 0:
        provider.notify(
            message="Searching: " + query.title() + "...", header=None, time=settings.time_noti, image=settings.icon
        )
    query = provider.quote_plus(query)
    url_search = "%s/buscar.php?busqueda=%s" % (settings.url, query)
    provider.log.info(url_search)
    if browser.open(url_search):
        results = []
        data = browser.content
        search_serie = re.search('/series/(.*?)/" title', data)
        if search_serie is not None:
            url_search = "%s/series/%s/" % (settings.url, search_serie.group(1))
            browser.open(url_search)
            data = browser.content
            cont = 0
            lname = re.search(filters.title.replace(" ", ".") + "(.*?).torrent", data, re.IGNORECASE)
            if lname is not None:
                torrent = "%s/torrents_tor/%s" % (settings.url, lname.group())
                name = (
                    lname.group().replace(".torrent", "")
                    + " S%02dE%02d" % (info["season"], info["episode"])
                    + " - "
                    + settings.name_provider
                )  # find name in the torrent
                results.append({"name": name, "uri": torrent, "seeds": 10000, "peers": 5000})  # return le torrent
                cont = 1
            provider.log.info(">>>>>> " + str(cont) + " torrents sent to Pulsar<<<<<<<")
    else:
        provider.log.error(">>>>>>>%s<<<<<<<" % browser.status)
        provider.notify(message=browser.status, header=None, time=5000, image=settings.icon)
    return results
コード例 #23
0
ファイル: main.py プロジェクト: Inter95/tutvguia
def search(query):
    provider.log.debug("QUERY : %s" % query)
    if(query['query']) : 
        query = query['query']
    query_normalize = unicodedata.normalize('NFKD',query)
    query = ''.join(c for c in query_normalize if (not unicodedata.combining(c)))
    url = "%s/%s?query=%s" % (__baseUrl__, ACTION_SEARCH, provider.quote_plus(query))
    provider.log.info("SEARCH : %s" % url)
    response = provider.GET(url)
    if response.geturl() is not url:
        # Redirection 30x followed to individual page - Return the magnet link
        provider.log.info('Redirection 30x followed to individual page - Return the magnet link')
        return provider.extract_magnets(response.data)
        #return [{"uri": magnet} for magnet in re.findall(r'magnet:\?[^\'"\s<>\[\]]+', response.data)]
    else:
        # Multiple torrent page - Parse page to get individual page
        provider.log.info('Multiple torrent page - Parsing')
        # Parse the table result
        table = common.parseDOM(response.data, 'table', attrs = { "class": "table_corps" })
        liens = common.parseDOM(table, 'a', attrs = { "class": "torrent" }, ret = 'href')
        provider.log.debug('liens : %s' % liens)
        threads = []
        magnets = []
        q = Queue.Queue()

        # Call each individual page in parallel
        for lien in liens :
            thread = Thread(target=directLink, args = ('%s%s' % (__baseUrl__, lien), q))
            thread.start()
            threads.append(thread)

        # And get all the results
        for t in threads :
            t.join()
        while not q.empty():
            magnets.append(q.get()[0])

        provider.log.info('Magnets List : %s' % magnets)
        return magnets
コード例 #24
0
def search_movie(movie):
    # Pulsar 0.2 doesn't work well with foreing title.  Get the FRENCH title from TMDB
    provider.log.debug('Get FRENCH title from TMDB for %s' % movie['imdb_id'])
    response = provider.GET(
        "%s/movie/%s?api_key=%s&language=fr&external_source=imdb_id&append_to_response=alternative_titles"
        % (tmdbUrl, movie['imdb_id'], tmdbKey))
    if response != (None, None):
        title_normalize = unicodedata.normalize('NFKD',
                                                response.json()['title'])
        movie['title'] = ''.join(c for c in title_normalize
                                 if (not unicodedata.combining(c)))
        provider.log.info('FRENCH title :  %s' % movie['title'])
    else:
        provider.log.error('Error when calling TMDB. Use Pulsar movie data.')
    resp = provider.GET(
        "%s/%s?ajax&query=%s" %
        (__baseUrl__, ACTION_SEARCH, provider.quote_plus(movie['title'])))
    for result in resp.json():
        if result["category"] == CATEGORY_FILMS:
            # Get movie's page
            return search(result["label"])
    # If no result
    return []
コード例 #25
0
def search(query):
    global filters
    query = common.normalize(query)
    filters.title = query  # to do filtering by name
    query += ' ' + settings.extra
    if settings.time_noti > 0:
        provider.notify(message="Searching: " + query.title() + '...',
                        header=None,
                        time=settings.time_noti,
                        image=settings.icon)
    query = provider.quote_plus(query)
    url_search = "%s/newtemp/include/ajax/ajax.search.php?search=%s" % (
        settings.url, query.replace(' ', '%20'))  # change in each provider
    provider.log.info(url_search)
    if browser.open(url_search):
        results = extract_torrents(browser.content)
    else:
        provider.log.error('>>>>>>>%s<<<<<<<' % browser.status)
        provider.notify(message=browser.status,
                        header=None,
                        time=5000,
                        image=settings.icon)
        results = []
    return results
コード例 #26
0
def search(query):
    response = provider.GET("https://yts.re/api/listimdb.json?imdb_id=%s" %
                            provider.quote_plus(query))
    print 'YIFI - Time: ' + str((time.time() - start))
    return provider.extract_magnets(response.data)
コード例 #27
0
def search(query):
    resp = provider.GET("https://kickass.to/usearch/%s%20" % provider.quote_plus(query))
    return provider.extract_magnets(resp.data)
コード例 #28
0
def search(query):
    response = provider.GET("https://yts.re/api/listimdb.json?imdb_id=%s" % provider.quote_plus(query))
    print 'YIFI - Time: ' + str((time.time() - start))
    return provider.extract_magnets(response.data)