Skip to content

Commit

Permalink
Merge pull request #8030 from pymedusa/release/release-0.3.16
Browse files Browse the repository at this point in the history
Release 0.3.16
  • Loading branch information
medariox authored Apr 27, 2020
2 parents 8f6b666 + 418f649 commit d9c31da
Show file tree
Hide file tree
Showing 82 changed files with 10,687 additions and 1,831 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
## 0.3.16 (2020-04-27)

#### New Features
- Added Keep link as post processing method ([#7986](https://github.com/pymedusa/Medusa/pull/7986))
- Added EZTV as torrent provider ([#8004](https://github.com/pymedusa/Medusa/pull/8004))

#### Fixes
- Fixed PrivateHD and CinemaZ provider login ([#7991](https://github.com/pymedusa/Medusa/pull/7991))
- Fixed occasional subliminal exception ([#7989](https://github.com/pymedusa/Medusa/pull/7989))

-----

## 0.3.15 (2020-04-13)

#### Improvements
- Add show names with dashes to guessit expected titles ([#7918](https://github.com/pymedusa/Medusa/pull/7918))
- Provider YggTorrents: Add 'saison' as a season pack search keyword ([#7920](https://github.com/pymedusa/Medusa/pull/7920))
- Show Snatched or Downloaded release name when manually picking a subtitle ([#7955](https://github.com/pymedusa/Medusa/pull/7955))

#### Fixes
- Fixed root dirs not always shown on Home page ([#7921](https://github.com/pymedusa/Medusa/pull/7921))
Expand Down
156 changes: 154 additions & 2 deletions dredd/api-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ paths:
The Episode endpoint returns information about the Episodes from a given Series.
parameters:
- $ref: '#/parameters/series-id'
name: seriesid
- name: season
in: query
required: false
Expand Down Expand Up @@ -995,6 +994,91 @@ paths:
400:
$ref: '#/responses/error'
x-disabled: true
/history:
get:
summary: Return history entries to a specific show
description: |
The history endpoint returns logged activities stored in the history table, like episodes snatched and downloaded. Or downloaded subtitles for an episode.
parameters:
- $ref: '#/parameters/page'
- $ref: '#/parameters/limit'
- $ref: '#/parameters/sort'
responses:
200:
$ref: '#/responses/pagination_history'
x-disabled: true
400:
$ref: '#/responses/error'
description: Invalid series id or pagination parameters
x-request:
path-params:
seriesid: asdf
x-disabled: true
404:
$ref: '#/responses/error'
description: Series not found
x-request:
path-params:
seriesid: tvdb999999999
x-disabled: true
/history/{seriesid}:
get:
summary: Return history entries to a specific show
description: |
The history endpoint returns logged activities stored in the history table, like episodes snatched and downloaded. Or downloaded subtitles for an episode.
parameters:
- $ref: '#/parameters/series-id'
- $ref: '#/parameters/page'
- $ref: '#/parameters/limit'
- $ref: '#/parameters/sort'
responses:
200:
$ref: '#/responses/pagination_history'
x-disabled: true
400:
$ref: '#/responses/error'
description: Invalid series id or pagination parameters
x-request:
path-params:
seriesid: asdf
x-disabled: true
404:
$ref: '#/responses/error'
description: Series not found
x-request:
path-params:
seriesid: tvdb999999999
x-disabled: true
/history/{seriesid}/episode/{episodeid}:
get:
summary: Return history entries for a specific episode
description: |
The histories episode endpoint returns history entries for a specific episode
parameters:
- $ref: '#/parameters/series-id'
- $ref: '#/parameters/episode-id'
responses:
200:
description: Array of History entries
schema:
type: array
items:
$ref: '#/definitions/History'
x-disabled: true
400:
$ref: '#/responses/error'
description: Invalid series id or pagination parameters
x-request:
path-params:
seriesid: asdf
x-disabled: true
404:
$ref: '#/responses/error'
description: Series not found
x-request:
path-params:
seriesid: tvdb999999999
x-disabled: true

definitions:
Series:
Expand Down Expand Up @@ -2721,6 +2805,51 @@ definitions:
overview:
type: string
description: Episode status/quality overview string

History:
description: History object
type: object
properties:
id:
type: integer
format: int32
description: Internal id for the history row
series:
type: string
description: Series slug (if available)
status:
type: integer
format: int32
description: Status (numberic)
statusName:
type: string
description: Status description
actionDate:
type: integer
format: int32
description: Date of when the history entrie was stored
resource:
type: string
description: Description of what was stored
example:
- The release name for a statusName of "Downloaded" or "Snatched"
- The language of a subitle downloaded fo ra statusName of "Subtitled"
size:
type: integer
description: Snatched or Downloaded filesize
season:
type: integer
description: Season number
episode:
type: integer
description: Episode number
manuallySearched:
type: boolean
description: Specifies if an episode was snatched or downloaded through a manual search
provider:
type: string
description: Provider of the history record. For example, the provider id if origin from snatch/download.

parameters:
detailed:
name: detailed
Expand Down Expand Up @@ -2762,7 +2891,7 @@ parameters:
x-example: tvdb301824
type: string
episode-id:
name: episode-id
name: episodeid
in: path
required: true
description: The episode id to retrieve. E.g. s02e03, e34 or 2016-12-31
Expand Down Expand Up @@ -2925,3 +3054,26 @@ responses:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
pagination_history:
description: A paged array of history records
headers:
X-Pagination-Page:
type: integer
format: int32
description: The page number
X-Pagination-Limit:
type: integer
format: int32
description: The pagination limit
X-Pagination-Count:
type: integer
format: int32
description: The total items count
Link:
type: string
description: "The pagination links: next, last, first and previous"
schema:
type: array
items:
$ref: '#/definitions/History'

2 changes: 1 addition & 1 deletion dredd/dredd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dry-run: null
hookfiles: dredd/dredd_hook.py
language: python
server: python dredd/dredd_hook.py
server-wait: 20
server-wait: 30
init: false
names: false
only: []
Expand Down
19 changes: 10 additions & 9 deletions ext/cloudscraper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

# ------------------------------------------------------------------------------- #

__version__ = '1.2.33'
__version__ = '1.2.34'

# ------------------------------------------------------------------------------- #

Expand Down Expand Up @@ -102,6 +102,7 @@ def __init__(self, *args, **kwargs):
self.debug = kwargs.pop('debug', False)
self.delay = kwargs.pop('delay', None)
self.cipherSuite = kwargs.pop('cipherSuite', None)
self.ssl_context = kwargs.pop('ssl_context', None)
self.interpreter = kwargs.pop('interpreter', 'native')
self.recaptcha = kwargs.pop('recaptcha', {})
self.allow_brotli = kwargs.pop(
Expand Down Expand Up @@ -134,7 +135,8 @@ def __init__(self, *args, **kwargs):
self.mount(
'https://',
CipherSuiteAdapter(
cipherSuite=self.cipherSuite
cipherSuite=self.cipherSuite,
ssl_context=self.ssl_context
)
)

Expand Down Expand Up @@ -253,7 +255,7 @@ def is_IUAM_Challenge(resp):
resp.headers.get('Server', '').startswith('cloudflare')
and resp.status_code in [429, 503]
and re.search(
r'action="/.*?__cf_chl_jschl_tk__=\S+".*?name="jschl_vc"\svalue=.*?',
r'<form id="challenge-form" action="/.*?__cf_chl_jschl_tk__=\S+"',
resp.text,
re.M | re.DOTALL
)
Expand Down Expand Up @@ -340,12 +342,11 @@ def IUAM_Challenge_Response(self, body, url, interpreter):
"Cloudflare IUAM detected, unfortunately we can't extract the parameters correctly."
)

payload = OrderedDict(
re.findall(
r'name="(r|jschl_vc|pass)"\svalue="(.*?)"',
formPayload['form']
)
)
payload = OrderedDict()
for challengeParam in re.findall(r'<input\s(.*?)>', formPayload['form']):
inputPayload = dict(re.findall(r'(\S+)="(\S+)"', challengeParam))
if inputPayload.get('name') in ['r', 'jschl_vc', 'pass']:
payload.update({inputPayload['name']: inputPayload['value']})

except AttributeError:
self.simpleException(
Expand Down
6 changes: 6 additions & 0 deletions ext/cloudscraper/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ class CloudflareIUAMError(CloudflareException):
"""


class CloudflareSolveError(CloudflareException):
"""
Raise an error when issue with solving Cloudflare challenge
"""


class CloudflareReCaptchaError(CloudflareException):
"""
Raise an error for problem extracting reCaptcha paramters
Expand Down
79 changes: 79 additions & 0 deletions ext/cloudscraper/help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import json
import platform
import requests
import ssl
import sys
import urllib3

from collections import OrderedDict
from . import __version__ as cloudscraper_version

# ------------------------------------------------------------------------------- #


def getPossibleCiphers():
try:
context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
context.set_ciphers('ALL')
return sorted([cipher['name'] for cipher in context.get_ciphers()])
except AttributeError:
return 'get_ciphers() is unsupported'

# ------------------------------------------------------------------------------- #


def _pythonVersion():
interpreter = platform.python_implementation()
interpreter_version = platform.python_version()

if interpreter == 'PyPy':
interpreter_version = '{}.{}.{}'.format(
sys.pypy_version_info.major,
sys.pypy_version_info.minor,
sys.pypy_version_info.micro
)
if sys.pypy_version_info.releaselevel != 'final':
interpreter_version = '{}{}'.format(
interpreter_version,
sys.pypy_version_info.releaselevel
)

return {
'name': interpreter,
'version': interpreter_version
}

# ------------------------------------------------------------------------------- #


def systemInfo():
try:
platform_info = {
'system': platform.system(),
'release': platform.release(),
}
except IOError:
platform_info = {
'system': 'Unknown',
'release': 'Unknown',
}

return OrderedDict([
('platform', platform_info),
('interpreter', _pythonVersion()),
('cloudscraper', cloudscraper_version),
('requests', requests.__version__),
('urllib3', urllib3.__version__),
('OpenSSL', OrderedDict(
[
('version', ssl.OPENSSL_VERSION),
('ciphers', getPossibleCiphers())
]
))
])

# ------------------------------------------------------------------------------- #


if __name__ == '__main__':
print(json.dumps(systemInfo(), indent=4))
8 changes: 5 additions & 3 deletions ext/cloudscraper/interpreters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import logging
import abc

from ..exceptions import CloudflareSolveError

if sys.version_info >= (3, 4):
ABC = abc.ABC # noqa
else:
Expand All @@ -10,7 +12,6 @@
# ------------------------------------------------------------------------------- #

interpreters = {}
BUG_REPORT = 'Cloudflare may have changed their technique, or there may be a bug in the script.'

# ------------------------------------------------------------------------------- #

Expand Down Expand Up @@ -50,5 +51,6 @@ def solveChallenge(self, body, domain):
try:
return float(self.eval(body, domain))
except Exception:
logging.error('Error executing Cloudflare IUAM Javascript. {}'.format(BUG_REPORT))
raise
raise CloudflareSolveError(
'Error trying to solve Cloudflare IUAM Javascript, they may have changed their technique.'
)
Loading

0 comments on commit d9c31da

Please sign in to comment.