Skip to content

Commit

Permalink
Merge branch 'feature/build_matrix'
Browse files Browse the repository at this point in the history
  • Loading branch information
GjjvdBurg committed Sep 9, 2021
2 parents 1fdcae2 + 5c2ddba commit 60866bf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/test_p2r.sh
Expand Up @@ -49,7 +49,7 @@ pip install pre-commit

echo -e "Install package"

pip install -e .[test]
pip install --upgrade --upgrade-strategy eager -e .[test]

echo -e "Run pre-commit"

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Expand Up @@ -14,12 +14,16 @@ jobs:
p2r-test:
name: Unit tests for paper2remarkable
runs-on: [ 'ubuntu-latest' ]
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
py: [ '3.6', '3.9' ]

steps:
- name: Install Python 3.6
- name: Install Python ${{ matrix.py }}
uses: actions/setup-python@v2
with:
python-version: '3.6'
python-version: ${{ matrix.py }}

- name: Checkout code
uses: actions/checkout@v2
Expand Down
7 changes: 4 additions & 3 deletions paper2remarkable/providers/science_direct.py
Expand Up @@ -108,25 +108,26 @@ def _get_pdf_url(self, url):
page = get_page_with_retry(tmp_url)
soup = bs4.BeautifulSoup(page, "html.parser")
script = soup.find_all("script")[5]
script_text = script.decode()

# Extract the embedded information from the script
phrase_1 = 'i.subtle.digest("SHA-256",e("'
try:
rem = script.text[script.text.index(phrase_1) + len(phrase_1) :]
rem = script_text[script_text.index(phrase_1) + len(phrase_1) :]
token = rem[: rem.index('"')]
except ValueError:
raise URLResolutionError("ScienceDirect", url)

phrase_2 = 'i.subtle.encrypt(c,t,e("'
try:
rem = script.text[script.text.index(phrase_2) + len(phrase_2) :]
rem = script_text[script_text.index(phrase_2) + len(phrase_2) :]
data = rem[: rem.index('"')]
except ValueError:
raise URLResolutionError("ScienceDirect", url)

phrase_3 = 'window.location="'
try:
rem = script.text[script.text.index(phrase_3) + len(phrase_3) :]
rem = script_text[script_text.index(phrase_3) + len(phrase_3) :]
location = rem[: rem.index('",r()')]
except ValueError:
raise URLResolutionError("ScienceDirect", url)
Expand Down

0 comments on commit 60866bf

Please sign in to comment.