def get_popular(self): base = "https://torrentapi.org/pubapi_v2.php?" token_params = { "get_token": "get_token", "app_id": "nephele", } url_token = base + self.urlencode(token_params) data_token = self.parse_json(url_token, cache=False) sleep(2) params = { "token": data_token["token"], "mode": "list", "sort": "seeders", "category": "14;48;17;44;45;47;42;46", "limit": 100, "app_id": "nephele", } url = base + self.urlencode(params) data_movies = self.parse_json(url, cache=False) tries = 1 while "error" in data_movies and tries < 10: print("Error returned, retrying in 1 sec") sleep(2) data_movies = self.parse_json(url, cache=False) tries += 1 names = [item["filename"] for item in data_movies["torrent_results"]] movies = [torrent_to_movie(name) for name in names] movies = remove_bad_torrent_matches(movies) return movies
def get_popular(self): names = [] query = quote("720p | 1080p | DVDRip") for page in range(Provider.PAGES_TO_FETCH): url = "https://thepiratebay.org/search/%s/%s/99/207" % (query, page) names += self.parse_html(url, ".detLink", cache=False) movies = [torrent_to_movie(name) for name in names] movies = remove_bad_torrent_matches(movies) return movies
def clear_cache(name): APP.debug("Clearing \"%s\" from movie db..." % name) movie = torrent_to_movie(name) record = APP.Movie.get_data(movie) if not record: APP.output("Could not find movie in db: %s" % name) return clear_webcache(record) APP.output("Deleted movie from database: %s" % record["title"]) APP.Movie.remove("id", record["id"])
def get_popular(self): names = [] base = "https://kickasstorrents.to/highres-movies/" # New mirrors can be found at https://thekickasstorrents.com/ for page in range(Provider.PAGES_TO_FETCH): if page == 0: url = base else: url = base + "%s/" % (page + 1) names += self.parse_html(url, "#mainSearchTable .data .cellMainLink", cache=False) movies = [torrent_to_movie(name) for name in names] movies = remove_bad_torrent_matches(movies) return movies
def main(arguments): APP.settings["DEBUG"] = arguments["--debug"] directory = arguments["<directory>"] filenames = get_filenames(directory) movies = [torrent_to_movie(name) for name in filenames] movies = remove_bad_torrent_matches(movies) update_moviedata(movies, APP) records = [] for movie in movies: data = APP.Movie.get_data(movie) if not data or data in records: continue records.append(data) output(records)
def main(arguments): APP.settings["DEBUG"] = arguments["--debug"] directory = arguments["<directory>"] filenames = get_filenames(directory) movies = [torrent_to_movie(name) for name in filenames] movies = remove_bad_torrent_matches(movies) update_moviedata(movies, APP) records = [] for movie in movies: data = APP.Movie.get_data(movie) if not data or data in records: continue records.append(data) output(records, int(arguments["--limit"]), arguments["--filter"])
def clear_cache(name): if platform.system() == 'Windows': name = name.decode("windows-1252") APP.debug("Clearing \"%s\" from movie db..." % name) movie = torrent_to_movie(name) clear_webcache(movie) record = APP.Movie.get_data(movie) if not record: APP.output("Could not find movie in db: %s" % name) return # Querying with and without year can give different URLs if not movie["year"] and record["year"]: movie["year"] = record["year"] clear_webcache(movie) APP.output("Deleted movie from database: %s" % record["title"]) APP.Movie.remove("id", record["id"])
def equals_clean_movie_name(value, name): return torrent_to_movie(value)["name"] == name