diff --git a/CHANGELOG.md b/CHANGELOG.md index d13bf61..593db54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +* [v2.66.0](https://github.com/a4k-openproject/a4kScrapers/releases/tag/a4kScrapers-2.66.0): + * additional scrape of eztv based on their api supporting imdb ids + * [v2.65.0](https://github.com/a4k-openproject/a4kScrapers/releases/tag/a4kScrapers-2.65.0): * remove bitcq - dead * remove scenerls - dropping hosters support diff --git a/meta.json b/meta.json index 738bece..bbd1f7d 100644 --- a/meta.json +++ b/meta.json @@ -1,6 +1,6 @@ { "author": "Unknown", - "version":"2.65.0", + "version":"2.66.0", "name":"a4kScrapers", "update_directory": "https://github.com/a4k-openproject/a4kScrapers/archive/", "remote_meta": "https://raw.githubusercontent.com/newt-sc/a4kScrapers/master/meta.json", diff --git a/providerModules/a4kScrapers/test_utils.py b/providerModules/a4kScrapers/test_utils.py index 3f3d8ec..4f8d6ed 100644 --- a/providerModules/a4kScrapers/test_utils.py +++ b/providerModules/a4kScrapers/test_utils.py @@ -171,7 +171,7 @@ def _disable_warnings(): def test_torrent(self, scraper_module, scraper, url=None): _disable_warnings() - if scraper in ['showrss', 'eztv']: + if scraper in ['showrss', 'eztv', 'eztv_api']: return _episode(scraper_module, scraper, url, test=self) return _movie(scraper_module, scraper, url, test=self) diff --git a/providerModules/a4kScrapers/urls.json b/providerModules/a4kScrapers/urls.json index 7bb681f..f583f5e 100644 --- a/providerModules/a4kScrapers/urls.json +++ b/providerModules/a4kScrapers/urls.json @@ -30,8 +30,8 @@ }, "-ext": { "search": "", "domains": [{ "base": "" }] }, "-extratorrent": { "search": "", "domains": [{ "base": "" }] }, - "eztv": { - "search": "/search/%s", + "eztv_api": { + "search": "/api/get-torrents?limit=100&imdb_id=%s", "domains": [ { "base": "https://eztv.re" }, { "base": "https://eztv.ag" }, @@ -40,6 +40,16 @@ { "base": "https://eztv.unblocked.llc" } ] }, + "eztv": { + "search": "/search/%s", + "domains": [ + { "base": "https://eztv.re" }, + { "base": "https://eztv.ag" }, + { "base": "https://eztv.it" }, + { "base": "https://eztv.ch" }, + { "base": "https://eztv.unblocked.llc" } + ] + }, "glo": { "search": "/search_results.php?search=%s&cat={{category}}&incldead=0&inclexternal=0&lang=1&sort=seeders&order=desc", "cat_movie": "1", diff --git a/providers/a4kScrapers/en/torrent/eztv_api.py b/providers/a4kScrapers/en/torrent/eztv_api.py new file mode 100644 index 0000000..dbd4c1c --- /dev/null +++ b/providers/a4kScrapers/en/torrent/eztv_api.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- + +from providerModules.a4kScrapers import core + +class sources(core.DefaultSources): + def __init__(self, *args, **kwargs): + super(sources, self).__init__(__name__, *args, single_query=True, **kwargs) + self._filter = core.Filter(fn=self._filter_fn, type='single') + + def _filter_fn(self, title, clean_title): + if self.is_movie_query(): + return False + + if self.scraper.filter_single_episode.fn(title, clean_title): + self._filter.type = self.scraper.filter_single_episode.type + return True + + if self.scraper.filter_single_special_episode.fn(title, clean_title): + self._filter.type = self.scraper.filter_single_special_episode.type + return True + + if self.scraper.filter_show_pack.fn(title, clean_title): + self._filter.type = self.scraper.filter_show_pack.type + return True + + if self.scraper.filter_season_pack.fn(title, clean_title): + self._filter.type = self.scraper.filter_season_pack.type + return True + + return False + + def _get_scraper(self, title): + return super(sources, self)._get_scraper(title, custom_filter=self._filter) + + def _search_request(self, url, query, page=1, prev_total=0): + query = core.quote_plus(self._imdb.replace('tt', '')) + response = self._request.get(url.base + (url.search % query) + ('&page=%s' % page)) + + if response.status_code != 200: + return [] + + try: + results = core.json.loads(response.text) + except Exception as e: + self._request.exc_msg = 'Failed to parse json: %s' % response.text + return [] + + if not results or not results.get('torrents', None) or len(results['torrents']) == 0: + return [] + + torrents = results['torrents'] + total = len(torrents) + prev_total + if total < results['torrents_count']: + more_results = self._search_request(url, None, page+1, total) + torrents += more_results + + return torrents + + def _soup_filter(self, response): + return response + + def _title_filter(self, el): + return el['filename'] + + def _info(self, el, url, torrent): + torrent['hash'] = el['hash'] + torrent['size'] = int(el['size_bytes']) / 1024 / 1024 + torrent['seeds'] = el['seeds'] + + return torrent + + def movie(self, title, year, imdb=None): + return [] + + def episode(self, simple_info, all_info): + self._imdb = all_info.get('info', {}).get('tvshow.imdb_id', None) + if self._imdb is None: + self._imdb = all_info.get('showInfo', {}).get('ids', {}).get('imdb', None) + return super(sources, self).episode(simple_info, all_info)