Skip to content

Commit

Permalink
Merge pull request #13 from MinionAttack/development
Browse files Browse the repository at this point in the history
Fix proxy issues and names with -
  • Loading branch information
MinionAttack committed Sep 7, 2021
2 parents c875e2e + c69f92b commit 35a324e
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion actions/movies_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def process_movies_options(message: str) -> SendInformation:
year = datetime.datetime.now().year
quality = ''

parameters = message[8:].split('-')[1:]
parameters = message[7:].split(' -')[1:]
for parameter in parameters:
parameter = parameter.strip()

Expand Down
2 changes: 1 addition & 1 deletion actions/series_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def process_series_options(message: str) -> SendInformation:
episode = ''
quality = ''

parameters = message[8:].split('-')[1:]
parameters = message[7:].split(' -')[1:]
for parameter in parameters:
parameter = parameter.strip()

Expand Down
2 changes: 1 addition & 1 deletion actions/subtitles_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def process_subtitles_options(message: str) -> SendInformation:
# Set default value
limit = SUBTITLES_LISTED_BY_DEFAULT

parameters = message[11:].split('-')[1:]
parameters = message[10:].split(' -')[1:]
for parameter in parameters:
parameter = parameter.strip()

Expand Down
2 changes: 1 addition & 1 deletion providers/YIFY.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
def search_subtitles_by_imdb(movie_id: str, language: str) -> List[ByIMDb]:
movie_url = YIFY_API + movie_id
# The User-Agent has to be specified to avoid the "requests.exceptions.TooManyRedirects" exception.
headers = {'User-Agent': BROWSER_USER_AGENT}
headers = {'User-Agent': BROWSER_USER_AGENT, 'Upgrade-Insecure-Requests': '1', 'DNT': '1'}
request = handle_request(movie_url, headers, None)

if (request is not None) and (request.status_code == 200):
Expand Down
4 changes: 2 additions & 2 deletions providers/YTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from src.utils import handle_request

# Use a proxy to evade ISP's blocking policies.
YTS_API = 'https://yts.unblockit.uno/api/v2/list_movies.json?'
YTS_API = 'https://yts.torrentbay.to/api/v2/list_movies.json?'
# Results per page, between 1 and 50, default is 20.
LIMIT = 50
INITIAL_PAGE = 1
Expand All @@ -19,7 +19,7 @@

def search_movie_by_imdb(movie_id: str, quality_specified: str) -> ByIMDb:
# The User-Agent has to be specified to avoid Http Error: 403 Client Error
headers = {'User-Agent': BROWSER_USER_AGENT}
headers = {'User-Agent': BROWSER_USER_AGENT, 'Upgrade-Insecure-Requests': '1', 'DNT': '1'}
payload = {'limit': LIMIT, 'page': INITIAL_PAGE, 'query_term': movie_id}

request = handle_request(YTS_API, headers, payload)
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ APScheduler==3.6.3 # python-telegram-bot depends on this version
certifi==2021.5.30
cffi==1.14.6
chardet==4.0.0
cryptography==3.4.7
cryptography==3.4.8
cssselect==1.1.0
decorator==5.0.9
idna==3.2
Expand All @@ -14,5 +14,5 @@ PyYAML==5.4.1
requests==2.26.0
six==1.16.0
tornado==6.1
tzlocal==2.1
urllib3==1.26.6
tzlocal==3.0
urllib3==1.26.6
2 changes: 1 addition & 1 deletion resources/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

AVAILABLE_HELP_COMMANDS = ['start', 'status', 'help', 'series', 'movies', 'subtitles']

BROWSER_USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0'
BROWSER_USER_AGENT = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0'

SUBTITLES_LISTED_BY_DEFAULT = 5

Expand Down

0 comments on commit 35a324e

Please sign in to comment.