Skip to content

Commit f7fe20d

Browse files
warrmrmedariox
authored andcommitted
Feature/torrent day custom url fix uk (#7326)
* added custom url, to torrentday * lint * Update CHANGELOG.md
1 parent 959d340 commit f7fe20d

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Mark episodes as "watched"
1212
- Added pagination
1313
- Added search field, that searches columns like Title, File and Episode number
14+
- Added ability to use custom domain for TorrentDay provider ([#7326](https://github.com/pymedusa/Medusa/pull/7326))
1415

1516
#### Fixes
1617
- Fixed AnimeBytes daily search, for multi-ep results ([#7190](https://github.com/pymedusa/Medusa/pull/7190))

medusa/providers/torrent/json/torrentday.py

+16-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
from requests.compat import urljoin
1818

19+
import validators
20+
1921
log = BraceAdapter(logging.getLogger(__name__))
2022
log.logger.addHandler(logging.NullHandler())
2123

@@ -29,11 +31,7 @@ def __init__(self):
2931

3032
# URLs
3133
self.url = 'https://www.torrentday.com'
32-
self.urls = {
33-
'login': urljoin(self.url, '/torrents/'),
34-
'search': urljoin(self.url, '/t.json'),
35-
'download': urljoin(self.url, '/download.php/')
36-
}
34+
self.custom_url = None
3735

3836
# Proper Strings
3937

@@ -73,6 +71,19 @@ def search(self, search_strings, age=0, ep_obj=None, **kwargs):
7371
:returns: A list of search results (structure)
7472
"""
7573
results = []
74+
75+
if self.custom_url:
76+
if not validators.url(self.custom_url):
77+
log.warning('Invalid custom url: {0}', self.custom_url)
78+
return results
79+
self.url = self.custom_url
80+
81+
self.urls = {
82+
'login': urljoin(self.url, '/torrents/'),
83+
'search': urljoin(self.url, '/t.json'),
84+
'download': urljoin(self.url, '/download.php/')
85+
}
86+
7687
if not self.login():
7788
return results
7889

0 commit comments

Comments
 (0)