def search_episode(info): title= ' S%02dE%02d' % (info['season'], info['episode']) if settings.time_noti > 0 : provider.notify(message='Searching: ' + info['title'].encode("utf-8").title() + title +'...', header=None, time=settings.time_noti, image=settings.icon) url_search = "%s/show/%s" % (settings.url ,info['imdb_id']) provider.log.info(url_search) response = provider.GET(url_search) results=[] if str(response.data)!='': filters.use_TV() filters.information() items = provider.parse_json(response.data) for episode in items['episodes']: if (episode['episode']==info['episode'] and episode['season']==info['season']): for resolution in episode['torrents']: resASCII =resolution.encode('utf-8') name = resASCII + ' - ' + items['title'] + ' - ' + episode['title'].encode('utf-8') + ' - ' + 'S%02dE%02d'% (info['season'], info['episode']) if filters.included(resASCII, filters.quality_allow) and not filters.included(resASCII, filters.quality_deny): res_val=values3[resASCII] magnet = episode['torrents'][resolution]['url'] if magnet[:4].lower()=='http': magnet = common.TorrentToMagnet(magnet,items['title'],info['season'],info['episode']) if magnet is not None: info_magnet = common.Magnet(magnet) results.append({'name': name + ' - ' + settings.name_provider, 'uri': magnet}) else: provider.log.warning(name + ' ***Blocked File by Keyword, Name or Size***') return results
def search(query): global __key__ if len(__key__)< 1: __addon__.openSettings() __key__ = getkey() params = {"key": __key__} if "imdb_id" in query: params["imdb"] = query['imdb_id'].replace("tt","") if "season" in query: params["search_str"] = "%(title)s [Season %(season)2d/Episode%(episode)2d]" % query if getsettings() != ",": params['categtags'] = getsettings() if "title" in query: title = query["title"] else: title = query params["search_str"] = query.encode("utf8") response = provider.GET("http://87.248.186.252/rss.php", params) notify("Total files:" + str(len(re.findall(r'magnet:\?[^\'"\s<>\[\]]+', response.data))), title.encode("utf8") ,10000, __addon__.getAddonInfo('icon')) return provider.extract_magnets(response.data)
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)]
def search(query): busqueda_completa = "%s" % query pagina_busqueda = __proxy__ + 'usearch/' resp = provider.GET(pagina_busqueda, params={ "q": busqueda_completa.encode('utf-8'), }) return provider.extract_magnets(resp.data)
def search_movie(info): filters.use_movie() if settings.time_noti > 0: provider.notify(message='Searching: ' + info['title'].title().encode("utf-8") + '...', header=None, time=settings.time_noti, image=settings.icon) url_search = "%s/v2/list_movies.json?query_term=%s" % (settings.url, info['imdb_id']) provider.log.info(url_search) response = provider.GET(url_search) return extract_magnets_json(response.data)
def search_episode(episode): imdb_id = episode.get("imdb_id") name = episode.get("title") season = episode.get("season") episodio = episode.get("episode") url_pelicula = "http://api.themoviedb.org/3/find/%s?api_key=57983e31fb435df4df77afb854740ea9&language=%s&external_source=imdb_id" % ( imdb_id, IDIOMA) pelicula = urllib2.urlopen(url_pelicula) texto1 = json.loads(pelicula.read()) texto2 = texto1['tv_results'] texto3 = texto2[0] nombre = texto3.get("name") if nombre == "24" and season == 9 and IDIOMA == 'es': nombre = u"24 vive otro dia" name = u"24 live other day" season = 1 nombre = nombre.replace(u'á', "a") nombre = nombre.replace(u'é', "e") nombre = nombre.replace(u'í', "i") nombre = nombre.replace(u'ó', "o") nombre = nombre.replace(u'ú', "u") temporada = "" pag_bus = "" suf_idioma = "" if IDIOMA == 'es': suf_idioma = pag_esp elif IDIOMA == 'it': suf_idioma = pag_ita elif IDIOMA == 'ru': suf_idioma = pag_rus elif IDIOMA == 'fr': suf_idioma = pag_fra if nombre.lower() <> name.lower(): nombre2 = '"' + name + '"' + suf_idioma nombre = '("' + nombre + '" OR ' + nombre2 + ')' else: nombre = '"' + name + '"' + suf_idioma nombre = nombre.replace(":", " ") capitulo = "%s%dX%02d%s%d%02d%s" % (" (", season, episodio, " OR ", season, episodio, " )") busqueda_completa = nombre + capitulo + "/" pagina_busqueda = __proxy__ + 'usearch/' resp = provider.GET(pagina_busqueda, params={ "q": busqueda_completa.encode('utf-8'), }) return provider.extract_magnets(resp.data)
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.') provider.log.info("Search movie : title %s, year %s" % (movie['title'], movie['year'])) return search("22222%s" % (movie['title']))
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)
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'])
def translator(imdb_id, language): import unicodedata url_themoviedb = "http://api.themoviedb.org/3/find/%s?api_key=9f4da017d29142fbadf3d21a37e59704" \ "&language=%s&external_source=imdb_id" % (imdb_id, language) response = provider.GET(url_themoviedb) if response != (None, None): movie = provider.parse_json(response.data) title0 = movie['movie_results'][0]['title'].replace(u'\xf1', '*') title_normalize = unicodedata.normalize('NFKD', title0) title = title_normalize.encode('ascii', 'ignore').replace(':', '') title = title.decode('utf-8').replace('*', u'\xf1').encode('utf-8') else: title = 'themoviedb.org is unreachable' return title
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 []
def search_episode(episode): provider.log.info("Search episode : name %(title)s, season %(season)02d, episode %(episode)02d, imdb_id %(imdb_id)s" % episode) if episode['imdb_id']!= 'tt0436992' and episode['imdb_id']!='tt0944947' : # Disable french title for Doctor Who 'tt0436992' (return "Dr Who") and # Game of thrones 'tt0944947' (Le trone de fer). May be some other are bad with their FR title :/ 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.debug('FRENCH title : %s' % episode['title']) else : provider.log.error('Error when calling TMDB. Use Pulsar movie data.') return search("11111%(title)s S%(season)02dE%(episode)02d" % episode)
def search(query): imdb_id = query.imdb_id if "imdb_id" in query else "" query = "" if "imdb_id" in query else query query_url = __BASE_URL__ + __LANGUAGE__ + "/cp/" resp = provider.GET(query_url, params={ "imdbid": imdb_id, "search": query, "user": __USERNAME__, "passkey": __PASS_KEY__, "pulsar": "1" }) return resp.json()['results']
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
def search(query): url_search = "http://getstrike.net/api/torrents/search/?q=%s" % (query) provider.log.info(url_search) response = provider.GET(url_search) results = [] if str(response.data) != '': items = provider.parse_json(response.data) nbrTorrents = items[0]['results'] for torrent in range(0, nbrTorrents): hash = items[1][torrent]['torrent_hash'] name = items[1][torrent]['torrent_title'] link = items[1][torrent]['download_link'] magnet = 'magnet:?xt=urn:btih:%s' % (hash) results.append({'name': name, 'uri': magnet, 'info_hash': hash}) return results
def search(query): query += ' ' + extra if time_noti > 0: provider.notify(message='Searching: ' + query + '...', header=None, time=1500, image=icon) url_search = "%s/search/0/0/000/4/%s" % (url, query.replace(' ', '%20') ) # search string 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)
def search(query): query += ' ' + extra if time_noti > 0: provider.notify(message="Searching: " + query + '...', header=None, time=time_noti, image=icon) url_search = "%s/files/?category=0&subcategory=All&quality=All&seeded=2&external=2&query=%s&to=1&uid=0&sort=S" \ % (url, query.replace(' ', '%20')) 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)
def getkey(): user = __addon__.getSetting("user") password = __addon__.getSetting("password") postData = {'username': user, 'password' : password, 'autologin' : '1'} response = provider.POST("http://87.248.186.252/takelogin.php", postData) if response.data.find('user_box') > 0: response = provider.GET("http://87.248.186.252/browse.php") data = response.data.decode("utf-8") for key in re.findall(r'rss\.php\?key=[^\'"\s<>\[\]]+', data): notify("Successfully logged in", "User: "******"utf8") , 10000, __addon__.getAddonInfo('icon')) __addon__.setSetting(id='key', value=key.replace('rss.php?key=','')) return key.replace('rss.php?key=','') else: notify("", "Login failed " + user.encode("utf8") ,10000) __addon__.setSetting(id='key', value="")
def parse_season(url, episode): result = [] response = provider.GET(url) # Get torrent (if any) from table - 1 line per episode table = common.parseDOM(response.data, 'table', attrs={"class": "table_corps"}) liens = common.parseDOM(table, 'tr', attrs={"class": "bords"}) provider.log.info(liens) if liens: # Get the first known episode start = int(common.parseDOM(liens[0], 'td')[0].rstrip('.')) try: return [{ "uri": '%s%s' % (__baseUrl__, torrent) for torrent in common.parseDOM( liens[episode - start], 'a', ret='href') }] except IndexError: # Pulsar show episode that aren't published yet, so not present in OMG results. # If this future episode is selected, return Notification instead of IndexError provider.notify("Episode actuellement indisponible.") return result
def search_movie(info): global quality_allow, quality_deny, min_size, max_size quality_allow = movie_allow quality_deny = movie_deny min_size = movie_min_size max_size = movie_max_size # define query query = (info['title'] + ' ' + str(info['year']) + extra) if time_noti > 0: provider.notify(message='Searching in %s: ' % lang + query + '...', header=None, time=time_noti, image=icon) url_search = "%s/files/?category=1&subcategory=All&language=%s" \ "&quality=All&seeded=2&external=2&query=%s&to=1&uid=0&sort=S" \ % (url, lang_id[lang], query.replace(' ', '%20')) 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)
def search_episode(episode): provider.log.debug("Search episode : name %(title)s, season %(season)02d, episode %(episode)02d" % episode) 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' % 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'] = episode['title'].join('|').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.') # Get settings for TVShows terms = pref_terms if(episode['season']): terms += '&term[45][]=%(season)02d' % episode if(episode['episode']): terms += '&term[46][]=%(episode)02d' % episode return search(episode['title'], CAT_TV, terms)
def directLink(url, q): provider.log.debug('directLink URL : %s' % url) response = provider.GET(url) q.put([{ "uri": magnet } for magnet in re.findall(r'magnet:\?[^\'"\s<>\[\]]+', response.data)])
def search(query): # Will issue a GET call to http://foo.bar/search?q=query (properly urlencoded) resp = provider.GET("http://foo.bar/search", params={ "q": query, }) return provider.extract_magnets(resp.data)
def search_movie(movie): # Busqueda de titulo en idioma de audio ------------------------ if IDIOMA <> 'en': inicio_proceso = time.time() imdb_id = movie.get("imdb_id") name = movie.get("title") url_pelicula = "http://api.themoviedb.org/3/find/%s?api_key=57983e31fb435df4df77afb854740ea9&language=%s&external_source=imdb_id" % ( imdb_id, IDIOMA) pelicula = urllib2.urlopen(url_pelicula) texto1 = json.loads(pelicula.read()) texto2 = texto1['movie_results'] texto3 = texto2[0] nombre = texto3.get("title") nombre = nombre.replace(u'á', "a") nombre = nombre.replace(u'é', "e") nombre = nombre.replace(u'í', "i") nombre = nombre.replace(u'ó', "o") nombre = nombre.replace(u'ú', "u") else: nombre = name # ------------------------------------------------------------- var_1 = "%s" % name var_2 = "%s" % nombre suf_idioma = "" if IDIOMA == 'es': suf_idioma = pag_esp elif IDIOMA == 'it': suf_idioma = pag_ita elif IDIOMA == 'ru': suf_idioma = pag_rus elif IDIOMA == 'fr': suf_idioma = pag_fra nombre2 = '"' + name + '"' + suf_idioma var_1 = var_1.lower() var_2 = var_2.lower() if var_1 == var_2: nombre = nombre2 else: nombre = '"' + nombre + '"' #----Calidad ------------------------------------ if only_HD == "true": nombre = nombre + alta_definicion else: if use_screener == "true": nombre = nombre + screener if use_3D == "false": nombre = nombre + sin_3d #---------------------------------------------------------- nombre = nombre.replace(":", " ") pagina_busqueda = __proxy__ + 'usearch/' busqueda_completa = nombre + u' category:movies' busqueda_completa = busqueda_completa.encode('utf-8') resp = provider.GET(pagina_busqueda, params={ "q": busqueda_completa, }) return provider.extract_magnets(resp.data)
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)
def search(query): resp = provider.GET("http://kickass.to/search", params={ "q": query, }) return provider.extract_magnets(resp.data)