diff --git a/src/searchengine/nova/engines/piratebay.py b/src/searchengine/nova/engines/piratebay.py index 070714d50..5e52710e7 100644 --- a/src/searchengine/nova/engines/piratebay.py +++ b/src/searchengine/nova/engines/piratebay.py @@ -1,7 +1,8 @@ -#VERSION: 2.10 +#VERSION: 2.11 #AUTHORS: Fabien Devaux (fab@gnux.info) #CONTRIBUTORS: Christophe Dumez (chris@qbittorrent.org) # Arthur (custparasite@gmx.se) +# Diego de las Heras (diegodelasheras@gmail.com) # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -35,7 +36,7 @@ from helpers import download_file class piratebay(object): """ Search engine class """ - url = 'https://thepiratebay.se' + url = 'https://thepiratebay.gd' name = 'The Pirate Bay' supported_categories = {'all': '0', 'music': '100', 'movies': '200', 'games': '400', 'software': '300'} @@ -69,6 +70,9 @@ class piratebay(object): self.save_item = "name" elif link.startswith("magnet"): self.current_item["link"] = link + # end of the 'name' item + self.current_item['name'] = self.current_item['name'].strip() + self.save_item = None def handle_start_tag_font(self, attrs): """ Handler for start tag font """ @@ -110,7 +114,6 @@ class piratebay(object): elif tag == "div": self.result_query = "center" == attrs[0][1] - def handle_endtag(self, tag): """ Parser's end tag handler """ if self.result_tbody: @@ -134,21 +137,29 @@ class piratebay(object): def handle_data(self, data): """ Parser's data handler """ - if self.save_item == "size": - temp_data = data.split() - if "Size" in temp_data: - self.current_item[self.save_item] = temp_data[2] - elif "ULed" in temp_data: - temp_string = self.current_item[self.save_item] - self.current_item[self.save_item] = " ".join((temp_string, temp_data[0][:-1])) - elif self.save_item: - self.current_item[self.save_item] = data - self.save_item = None + if self.save_item: + if self.save_item == "size": + temp_data = data.split() + if "Size" in temp_data: + self.current_item[self.save_item] = temp_data[2] + elif "ULed" in temp_data: + temp_string = self.current_item[self.save_item] + self.current_item[self.save_item] = " ".join((temp_string, temp_data[0][:-1])) + + elif self.save_item == "name": + # names with special characters like '&' are splitted in several pieces + if 'name' not in self.current_item: + self.current_item['name'] = '' + self.current_item['name'] += data + + else: + self.current_item[self.save_item] = data + self.save_item = None def search(self, what, cat='all'): """ Performs search """ - connection = https("thepiratebay.se") + connection = https("thepiratebay.gd") #prepare query. 7 is filtering by seeders cat = cat.lower() diff --git a/src/searchengine/nova/engines/versions.txt b/src/searchengine/nova/engines/versions.txt index 79d2d1163..ffe64ff48 100644 --- a/src/searchengine/nova/engines/versions.txt +++ b/src/searchengine/nova/engines/versions.txt @@ -1,6 +1,6 @@ torrentreactor: 1.33 mininova: 1.51 -piratebay: 2.10 +piratebay: 2.11 extratorrent: 1.2 kickasstorrents: 1.26 btdigg: 1.24 diff --git a/src/searchengine/nova3/engines/piratebay.py b/src/searchengine/nova3/engines/piratebay.py index 752c06f07..bb7f38fe8 100644 --- a/src/searchengine/nova3/engines/piratebay.py +++ b/src/searchengine/nova3/engines/piratebay.py @@ -1,7 +1,8 @@ -#VERSION: 2.10 +#VERSION: 2.11 #AUTHORS: Fabien Devaux (fab@gnux.info) #CONTRIBUTORS: Christophe Dumez (chris@qbittorrent.org) # Arthur (custparasite@gmx.se) +# Diego de las Heras (diegodelasheras@gmail.com) # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -35,7 +36,7 @@ from helpers import download_file class piratebay(object): """ Search engine class """ - url = 'https://thepiratebay.se' + url = 'https://thepiratebay.gd' name = 'The Pirate Bay' supported_categories = {'all': '0', 'music': '100', 'movies': '200', 'games': '400', 'software': '300'} @@ -69,6 +70,9 @@ class piratebay(object): self.save_item = "name" elif link.startswith("magnet"): self.current_item["link"] = link + # end of the 'name' item + self.current_item['name'] = self.current_item['name'].strip() + self.save_item = None def handle_start_tag_font(self, attrs): """ Handler for start tag font """ @@ -110,7 +114,6 @@ class piratebay(object): elif tag == "div": self.result_query = "center" == attrs[0][1] - def handle_endtag(self, tag): """ Parser's end tag handler """ if self.result_tbody: @@ -134,21 +137,29 @@ class piratebay(object): def handle_data(self, data): """ Parser's data handler """ - if self.save_item == "size": - temp_data = data.split() - if "Size" in temp_data: - self.current_item[self.save_item] = temp_data[2] - elif "ULed" in temp_data: - temp_string = self.current_item[self.save_item] - self.current_item[self.save_item] = " ".join((temp_string, temp_data[0][:-1])) - elif self.save_item: - self.current_item[self.save_item] = data - self.save_item = None + if self.save_item: + if self.save_item == "size": + temp_data = data.split() + if "Size" in temp_data: + self.current_item[self.save_item] = temp_data[2] + elif "ULed" in temp_data: + temp_string = self.current_item[self.save_item] + self.current_item[self.save_item] = " ".join((temp_string, temp_data[0][:-1])) + + elif self.save_item == "name": + # names with special characters like '&' are splitted in several pieces + if 'name' not in self.current_item: + self.current_item['name'] = '' + self.current_item['name'] += data + + else: + self.current_item[self.save_item] = data + self.save_item = None def search(self, what, cat='all'): """ Performs search """ - connection = https("thepiratebay.se") + connection = https("thepiratebay.gd") #prepare query. 7 is filtering by seeders cat = cat.lower() diff --git a/src/searchengine/nova3/engines/versions.txt b/src/searchengine/nova3/engines/versions.txt index 6b2b0c5ea..911973db5 100644 --- a/src/searchengine/nova3/engines/versions.txt +++ b/src/searchengine/nova3/engines/versions.txt @@ -1,6 +1,6 @@ torrentreactor: 1.33 mininova: 1.51 -piratebay: 2.10 +piratebay: 2.11 extratorrent: 1.2 kickasstorrents: 1.26 btdigg: 1.23