papers-cli 2.11__tar.gz → 2.12.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {papers_cli-2.11 → papers_cli-2.12.1}/PKG-INFO +1 -1
- {papers_cli-2.11 → papers_cli-2.12.1}/papers/__main__.py +1 -1
- {papers_cli-2.11 → papers_cli-2.12.1}/papers/_version.py +2 -2
- {papers_cli-2.11 → papers_cli-2.12.1}/papers/extract.py +22 -1
- {papers_cli-2.11 → papers_cli-2.12.1}/papers_cli.egg-info/PKG-INFO +1 -1
- {papers_cli-2.11 → papers_cli-2.12.1}/.gitattributes +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/.github/workflows/pypi.yml +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/.github/workflows/tests.yml +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/.gitignore +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/LICENSE +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/README.md +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers/__init__.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers/bib.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers/config.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers/duplicate.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers/encoding.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers/filename.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers/latexenc.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers/utils.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers_cli.egg-info/SOURCES.txt +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers_cli.egg-info/dependency_links.txt +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers_cli.egg-info/entry_points.txt +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers_cli.egg-info/requires.txt +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/papers_cli.egg-info/top_level.txt +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/pyproject.toml +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/requirements.txt +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/setup.cfg +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/setup.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/__init__.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/common.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/config.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/download.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/downloadedpapers/.gitignore +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/downloadedpapers/bg-8-515-2011.txt +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/test_add.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/test_biblio.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/test_duplicates.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/test_encoding.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/test_extract.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/test_filecheck.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/test_install.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/test_list.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/test_misc.py +0 -0
- {papers_cli-2.11 → papers_cli-2.12.1}/tests/test_undo.py +0 -0
|
@@ -569,7 +569,7 @@ def addcmd(parser, o, config):
|
|
|
569
569
|
logger.error("No entry added: use --doi, --metadata, --key, --attachment, --title, --author, --journal, --year to add a new entry")
|
|
570
570
|
raise PapersExit()
|
|
571
571
|
|
|
572
|
-
metadata.setdefault('ID', biblio.
|
|
572
|
+
metadata.setdefault('ID', biblio.keyformat(metadata))
|
|
573
573
|
metadata.setdefault('ENTRYTYPE', 'article')
|
|
574
574
|
if o.edit:
|
|
575
575
|
metadata = edit_entries(metadata)
|
|
@@ -4,6 +4,7 @@ import subprocess as sp
|
|
|
4
4
|
import re
|
|
5
5
|
import tempfile
|
|
6
6
|
|
|
7
|
+
import requests
|
|
7
8
|
from crossref.restful import Works, Etiquette
|
|
8
9
|
import bibtexparser
|
|
9
10
|
|
|
@@ -78,6 +79,7 @@ def readpdf_image(pdf, first=None, last=None):
|
|
|
78
79
|
return txt
|
|
79
80
|
|
|
80
81
|
REGEXP = re.compile(r'[doi,doi.org/][\s\.\:]{0,2}(10\.\d{4}[\d\:\.\-\/a-z]+)[A-Z\s,\n]')
|
|
82
|
+
ARXIV = re.compile(r'arxiv:\s*(\d{4}\.\d{4,5})')
|
|
81
83
|
|
|
82
84
|
def parse_doi(txt):
|
|
83
85
|
# based on: https://doeidoei.wordpress.com/2009/10/22/regular-expression-to-match-a-doi-digital-object-identifier/
|
|
@@ -94,7 +96,15 @@ def parse_doi(txt):
|
|
|
94
96
|
matches = REGEXP.findall(' '+txt.lower()+' ')
|
|
95
97
|
|
|
96
98
|
if not matches:
|
|
97
|
-
|
|
99
|
+
|
|
100
|
+
# try arxiv pattern
|
|
101
|
+
match = ARXIV.search(txt.lower())
|
|
102
|
+
if match:
|
|
103
|
+
arxiv_id = match.group(1)
|
|
104
|
+
matches = [ f"10.48550/arXiv.{arxiv_id}" ]
|
|
105
|
+
|
|
106
|
+
else:
|
|
107
|
+
raise DOIParsingError('parse_doi::no matches')
|
|
98
108
|
|
|
99
109
|
match = matches[0]
|
|
100
110
|
|
|
@@ -218,8 +228,19 @@ def fetch_crossref_by_doi(doi):
|
|
|
218
228
|
raise DOIRequestError(repr(doi)+': '+repr(error))
|
|
219
229
|
return response.json()
|
|
220
230
|
|
|
231
|
+
@cached('arxiv.json')
|
|
232
|
+
def fetch_bibtex_by_arxiv(arxiv_id):
|
|
233
|
+
url = f"https://arxiv.org/bibtex/{arxiv_id}"
|
|
234
|
+
response = requests.get(url)
|
|
235
|
+
if response.status_code == 200:
|
|
236
|
+
return response.text
|
|
237
|
+
else:
|
|
238
|
+
return f"Error: Unable to fetch BibTeX (HTTP {response.status_code})"
|
|
239
|
+
|
|
221
240
|
# @cached('crossref-bibtex.json')
|
|
222
241
|
def fetch_bibtex_by_doi(doi):
|
|
242
|
+
if "arxiv" in doi.lower():
|
|
243
|
+
return fetch_bibtex_by_arxiv(doi.split("arXiv.")[1])
|
|
223
244
|
json_data = fetch_crossref_by_doi(doi)
|
|
224
245
|
return crossref_to_bibtex(json_data['message'])
|
|
225
246
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|