alinush / ck

A Python tool to manage and tag your bibliography (.bib and .pdf) files on Dropbox
13 stars 3 forks source link

ScienceDirect fails #4

Closed alinush closed 4 years ago

alinush commented 4 years ago

Describe the bug

alint@alint-a01 [~/repos/bibtags/by-tags] (master %) $ ck add https://www.sciencedirect.com/science/article/pii/0022000084900709 GM84
Traceback (most recent call last):
  File "/Users/alint/repos/ck/ck", line 937, in <module>
    ck(obj={})
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/alint/repos/ck/ck", line 248, in ck_add_cmd
    handler(opener, soup, parsed_url, ck_bib_dir, destpdffile, destbibfile, parser, user_agent, verbosity)
  File "/Users/alint/repos/ck/citationkeys/urlhandlers.py", line 166, in sciencedirect_handler
    pdf_redirect_url = elem['content']
TypeError: 'NoneType' object is not subscriptable

To Reproduce ck add https://www.sciencedirect.com/science/article/pii/0022000084900709 GM84

Expected behavior Should've downloaded PDF and .bib file, but failed w/ exception.

Desktop (please complete the following information):

alinush commented 4 years ago

Fixed in 79002cd5cf16cc8180de7f26154693bc2a8b9af0.

Apparently, some papers are missing the tag with the PDF URL in the , but fortunately I could still find a link to the PDF in the HTML.