diff options
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | paper2remarkable/utils.py | 8 |
2 files changed, 6 insertions, 8 deletions
@@ -3,12 +3,8 @@ [](https://pypi.org/project/paper2remarkable) -*Note: ``paper2remarkable`` is the new name for the ``arxiv2remarkable`` -script. The name was changed because it better captures what the program -does.* - ``paper2remarkable`` is a command line program for quickly and easily -transferring an academic paper to your reMarkable: +transferring an academic paper to your [reMarkable](https://remarkable.com/): ``` $ p2r https://arxiv.org/abs/1811.11242 diff --git a/paper2remarkable/utils.py b/paper2remarkable/utils.py index cc8a417..de27973 100644 --- a/paper2remarkable/utils.py +++ b/paper2remarkable/utils.py @@ -96,15 +96,17 @@ def get_page_with_retry(url, tries=5): def follow_redirects(url): - """Follow redirects from the URL (at most 10)""" + """Follow redirects from the URL (at most 100)""" it = 0 - while it < 10: - req = requests.head(url, allow_redirects=False) + jar = {} + while it < 100: + req = requests.head(url, allow_redirects=False, cookies=jar) if req.status_code == 200: break if not "Location" in req.headers: break url = req.headers["Location"] + jar = req.cookies it += 1 return url |
