Skip to content

Commit

Permalink
release: v2.66.0
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed Sep 11, 2021
1 parent dce5454 commit bd93665
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion meta.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion providerModules/a4kScrapers/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
14 changes: 12 additions & 2 deletions providerModules/a4kScrapers/urls.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand All @@ -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",
Expand Down
79 changes: 79 additions & 0 deletions providers/a4kScrapers/en/torrent/eztv_api.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit bd93665

Please sign in to comment.