From ca358e0b877eb537ab50995f73f86d733cc83662 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Wed, 5 May 2021 21:41:23 +0100 Subject: [PATCH] Fix MoreThan provider and add provider option only allow releases that are site trusted. Add Python 3.9 to Travis. --- .travis.yml | 3 ++- CHANGES.md | 8 +++++++- sickbeard/providers/morethan.py | 38 +++++++++++++++++++++----------------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index f0440fb..4213d7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ jobs: - python: '2.7' - python: '3.7' - python: '3.8' + - python: '3.9' before_install: - export BOTO_CONFIG=/dev/null # Workaround for https://github.com/travis-ci/travis-ci/issues/7940 @@ -18,7 +19,7 @@ before_install: install: - pip install -r requirements.txt - pip install coveralls - + before_script: - cd ./tests script: coverage run --source=.. --omit=../lib/* ./all_tests.py diff --git a/CHANGES.md b/CHANGES.md index c851873..7ba8053 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,10 @@ -### 0.23.18 (2020-05-03 23:10:00 UTC) +### 0.23.19 (2020-05-05 21:40:00 UTC) + +* Fix MoreThan provider and add provider option only allow releases that are site trusted +* Add Python 3.9 to Travis + + +### 0.23.18 (2020-05-03 23:10:00 UTC) * Change allow Python 3.8.10 and 3.9.5 * Remove PiSexy provider diff --git a/sickbeard/providers/morethan.py b/sickbeard/providers/morethan.py index 1d6d021..3f327b7 100644 --- a/sickbeard/providers/morethan.py +++ b/sickbeard/providers/morethan.py @@ -33,23 +33,27 @@ from six import iteritems class MoreThanProvider(generic.TorrentProvider): def __init__(self): - generic.TorrentProvider.__init__(self, 'MoreThan', cache_update_iv=15) + generic.TorrentProvider.__init__(self, 'MoreThan') - self.url_base = 'https://www.morethan.tv/' + self.url_base = 'https://www.morethantv.me/' self.urls = {'config_provider_home_uri': self.url_base, - 'login_action': self.url_base + 'login.php', - 'search': self.url_base + 'torrents.php?searchstr=%s&' + '&'.join([ - 'tags_type=1', 'order_by=time', 'order_way=desc', - 'filter_cat[2]=1', 'action=basic', 'searchsubmit=1'])} + 'login_action': self.url_base + 'login', + 'search': self.url_base + 'torrents.php?searchtext=' + '&'.join([ + '%s', '%s', 'order_by=time', 'order_way=desc'])} + + self.categories = {'Episode': [3, 4], 'Season': [5, 6]} + self.categories['Cache'] = self.categories['Episode'] + self.categories['Season'] self.url = self.urls['config_provider_home_uri'] self.username, self.password, self.minseed, self.minleech = 4 * [None] + self.confirmed = False def _authorised(self, **kwargs): - return super(MoreThanProvider, self)._authorised(logged_in=(lambda y=None: self.has_all_cookies('session')), - post_params={'keeplogged': '1', 'form_tmpl': True}) + return super(MoreThanProvider, self)._authorised(logged_in=(lambda y=None: self.has_all_cookies('sid')), + post_params={'keeploggedin': '1', 'form_tmpl': True, + 'cinfo': '1920|1200|24|0'}) def _search_provider(self, search_params, **kwargs): @@ -60,13 +64,14 @@ class MoreThanProvider(generic.TorrentProvider): items = {'Cache': [], 'Season': [], 'Episode': [], 'Propers': []} rc = dict([(k, re.compile('(?i)' + v)) - for (k, v) in iteritems({'info': 'view', 'get': 'download', 'name': 'showname', 'nuked': 'nuked'})]) + for (k, v) in iteritems({'info': r'torrents.php\?id', 'get': 'download', 'nuked': 'nuked'})]) for mode in search_params: for search_string in search_params[mode]: search_string = unidecode(search_string) - search_url = self.urls['search'] % search_string + search_url = self.urls['search'] % (search_string, + self._categories_string(mode, template='filter_cat[%s]=1')) - # fetches 15 results by default, and up to 100 if allowed in user profile + # fetches 50 results by default, and up to 100 if allowed in user profile html = self.get_url(search_url) if self.should_skip(): return results @@ -89,16 +94,15 @@ class MoreThanProvider(generic.TorrentProvider): if 5 > len(cells) or tr.find('img', alt=rc['nuked']): continue try: - head = head if None is not head else self._header_row(tr) + head = head if None is not head else self._header_row(tr, {'size': r'by=size'}) seeders, leechers, size = [try_int(n, n) for n in [ cells[head[x]].get_text().strip() for x in ('seed', 'leech', 'size')]] - if self._reject_item(seeders, leechers): + if self._reject_item(seeders, leechers, + verified=self.confirmed and not + any(tr.select('.icon_torrent_okay'))): continue - title = tr.find('a', title=rc['info']).get_text().strip() - if title.lower().startswith('season '): - title = '%s %s' % (tr.find('div', class_=rc['name']).get_text().strip(), title) - + title = tr.find('a', href=rc['info']).get_text().strip() download_url = self._link(tr.find('a', href=rc['get'])['href']) except (AttributeError, TypeError, ValueError): continue