Move reference fetching code into a sub-library

This commit is contained in:
Lucas Verney 2015-12-23 23:46:37 +01:00
parent 97fef88498
commit c880fe27a8
10 changed files with 15 additions and 14 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "opendetex"] [submodule "opendetex"]
path = opendetex path = reference_fetcher/opendetex
url = https://github.com/Phyks/opendetex url = https://github.com/Phyks/opendetex

View File

@ -8,19 +8,19 @@ For building `opendetex` (which is a necessary dependency), you will need
* Clone this repository: `git clone https://github.com/Phyks/arxiv_metadata`. * Clone this repository: `git clone https://github.com/Phyks/arxiv_metadata`.
* Init submodules (`opendetex`): `git submodule init; git submodule update`. * Init submodules (`opendetex`): `git submodule init; git submodule update`.
* Build `opendetex`: `cd opendetex; make`. * Build `opendetex`: `cd reference_fetcher/opendetex; make`.
* You are ready to go. * You are ready to go.
## Usage ## Usage
* `./main.py some_file.bbl` to get a list of DOIs associated to each `\bibitem`. * `./fetch_references.py some_file.bbl` to get a list of DOIs associated to each `\bibitem`.
* `./main.py arxiv_eprint_id` to get a list of DOIs associated to each reference from the provided arXiv eprint. * `./fetch_references.py arxiv_eprint_id` to get a list of DOIs associated to each reference from the provided arXiv eprint.
## Example ## Example
``` ```
$ ./main.py 1401.2910 $ ./fetch_references.py 1401.2910
``` ```
``` ```
@ -67,7 +67,7 @@ $ ./main.py 1401.2910
``` ```
$ ./main.py /tmp/test.bbl $ ./fetch_reference.py /tmp/test.bbl
``` ```
``` ```

View File

@ -3,8 +3,8 @@ import os
import sys import sys
# Local import # Local import
import arxiv from ..reference_fetcher import arxiv
import bbl from ..reference_fetcher import bbl
if __name__ == "__main__": if __name__ == "__main__":

View File

View File

@ -1,11 +1,12 @@
""" """
This file contains all the arXiv-specific functions. This file contains all the arXiv-specific functions.
""" """
import bbl
import io import io
import requests import requests
import tarfile import tarfile
from . import bbl
def sources_from_arxiv(eprint): def sources_from_arxiv(eprint):
""" """

View File

@ -1,14 +1,14 @@
""" """
This files contains all the functions to deal with bbl files. This files contains all the functions to deal with bbl files.
""" """
import doi
import math import math
import os import os
import requests import requests
import subprocess import subprocess
import regex from . import doi
import tools from . import regex
from . import tools
def clean_bibitem(bibitem): def clean_bibitem(bibitem):

View File

@ -3,8 +3,8 @@ This file contains all the DOI-related functions.
""" """
import requests import requests
import regex from . import regex
import tools from . import tools
def extract_doi_links(urls): def extract_doi_links(urls):