Skip to content

Commit

Permalink
fix: directdl
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed Dec 5, 2019
1 parent 84e73ed commit 35f763f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"author": "Unknown",
"version":"2.5.4",
"version":"2.5.5",
"name":"a4kScrapers",
"update_directory": "https://github.com/a4k-openproject/a4kScrapers/archive/",
"remote_meta": "https://raw.githubusercontent.com/newt-sc/a4kScrapers/master/meta.json",
Expand Down
3 changes: 2 additions & 1 deletion providerModules/a4kScrapers/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time
import traceback
import sys
import re

from .third_party import source_utils, cfscrape
from .third_party.source_utils import tools
Expand Down Expand Up @@ -164,7 +165,7 @@ def get(self, url, headers={}, allow_redirects=True):
)
)

tools.log('GET: %s' % url, 'info')
tools.log('GET: %s' % re.sub(r'\?key=(.+?)&', '?', url), 'info')
request = lambda: cfscrape.CloudflareScraper().get(url, headers=headers, timeout=self._timeout, allow_redirects=allow_redirects)
request.url = url

Expand Down
2 changes: 1 addition & 1 deletion providerModules/a4kScrapers/third_party/cfscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def solve_cf_challenge(self, resp, **original_kwargs):
headers["Referer"] = resp.url

try:
params = cloudflare_kwargs["data"] = OrderedDict(
params = cloudflare_kwargs["data" if submit_method == 'POST' else 'params'] = OrderedDict(
re.findall(r'name="(r|s|jschl_vc|pass)"(?: [^<>]*)? value="(.+?)"', body)
)

Expand Down
3 changes: 2 additions & 1 deletion providerModules/a4kScrapers/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json

from .third_party import source_utils
from .utils import database
from .utils import database, decode

def _get_json(filename):
json_path = os.path.join(os.path.dirname(__file__), filename)
Expand All @@ -29,6 +29,7 @@ def _get_urls_in_array_format(urls_as_objects):

trackers_config = urls['trackers']
hosters_config = urls['hosters']
hosters_config[list(hosters_config.keys())[1]]['search'] = hosters_config[list(hosters_config.keys())[1]]['search'].replace(hosters_config[list(hosters_config.keys())[1]]['search'][9:25], decode('wqV6wqzCmcKbwrfClMKjwqbCosKswpFswqLCmMKa'))
trackers = _get_urls_in_array_format(trackers_config)
hosters = _get_urls_in_array_format(hosters_config)

Expand Down
2 changes: 1 addition & 1 deletion providers/a4kScrapers/en/hosters/directdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def search(self, hoster_url, query):
results = response.text
results = core.json.loads(results)

if results is None or results['error'] or len(results['results']) == 0:
if results is None or results.get('error', None) or len(results['results']) == 0:
return []

results = results['results']
Expand Down

0 comments on commit 35f763f

Please sign in to comment.