Fixed titrari.ro provider

This commit is contained in:
Bogdan Ilisei 2021-10-11 03:50:46 +03:00 committed by GitHub
parent 779cac1448
commit 17dd5ddde5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 3 deletions

View File

@ -104,7 +104,9 @@ class TitrariProvider(Provider, ProviderSubtitleArchiveMixin):
def initialize(self):
self.session = Session()
self.session.headers['User-Agent'] = AGENT_LIST[randint(0, len(AGENT_LIST) - 1)]
# Hardcoding the UA to bypass the 30s throttle that titrari.ro uses for IP/UA pair
self.session.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4535.2 Safari/537.36'
# self.session.headers['User-Agent'] = AGENT_LIST[randint(0, len(AGENT_LIST) - 1)]
def terminate(self):
self.session.close()
@ -184,11 +186,28 @@ class TitrariProvider(Provider, ProviderSubtitleArchiveMixin):
else:
return None
# titrari.ro seems to require all parameters now
# z2 = comment (empty)
# z3 = fps (-1: any, 0: N/A, 1: 23.97 FPS etc.)
# z4 = CD count (-1: any)
# z5 = imdb_id (empty or integer)
# z6 = sort order (0: unsorted, 1: by date, 2: by name)
# z7 = title (empty or string)
# z8 = language (-1: all, 1: ron, 2: eng)
# z9 = genre (All: all, Action: action etc.)
# z11 = type (0: any, 1: movie, 2: series)
def getQueryParams(self, imdb_id, title):
queryParams = {
'page': self.query_advanced_search,
'z8': '1'
'z7': '',
'z2': '',
'z5': '',
'z3': '-1',
'z4': '-1',
'z8': '-1',
'z9': 'All',
'z11': '0',
'z6': '0'
}
if imdb_id is not None:
queryParams["z5"] = imdb_id