Package: pygetpapers
Research Papers right from pythonWhat is pygetpaperspygetpapers is a tool to assist text miners. It makes requests to open access scientific text repositories, analyses the hits, and systematically downloads the articles without further interaction.Comes with the packagespygetpapersanddownloadtoolswhich provide various functions to download, process and save research papers and their metadata.The main medium of its interaction with users is through a command-line interface.pygetpapershas a modular design which makes maintenance easy and simple. This also allows adding support for more repositories simple.The developer documentation has been setup atreadthedocsHistorygetpapersis a tool written by Rik Smith-Unna funded by ContentMine athttps://github.com/ContentMine/getpapers. The OpenVirus community requires a Python version and Ayush Garg has written an implementation from scratch, with some enhancements.Formats supported by pygetpaperspygetpapers gives fulltexts in xml and pdf format.The metadata for papers can be saved in many formats including JSON, CSV, HTML.Queries can be saved in form of an ini configuration file.The additional files for papers can also be downloaded. References and citations for papers are given in XML format.Log files can be saved in txt format.Repository StructureThe main code is located in the pygetpapers directory. All the supporting modules for different repositories are described in the pygetpapers/repository directory.ArchitectureAbout the author and communitypygetpapershas been developed by Ayush Garg under the dear guidance of the OpenVirus community and Peter Murray Rust. Ayush is currently a high school student who believes that the world can only truly progress when knowledge is open and accessible by all.Testers from OpenVirus have given a lot of useful feedback to Ayush without which this project would not have been possible.The community has taken time to ensure that everyone can contribute to this project. So, YOU, the developer, reader and researcher can also contribute by testing, developing, and sharing.InstallationEnsure thatpipis installed along with python. Download python from:https://www.python.org/downloads/and select the option Add Python to Path while installing.Check outhttps://pip.pypa.io/en/stable/installing/if difficulties installing pip. Also, checkouthttps://packaging.python.org/en/latest/tutorials/installing-packages/to learn more about installing packages inpython.Method one (recommended):Enter the command:pip install pygetpapersEnsure pygetpapers has been installed by reopening the terminal and typing the commandpygetpapersYou should see a help message come up.Method two (Install Directly From Head):Ensure git cli is installed and is available in path. Check out (https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)Enter the command:pip install git+https://github.com/petermr/pygetpapers.gitEnsure pygetpapers has been installed by reopening the terminal and typing the commandpygetpapersYou should see a help message come up.Usagepygetpapersis a commandline tool. You can ask for help by running:pygetpapers --helpusage: pygetpapers [-h] [--config CONFIG] [-v] [-q QUERY] [-o OUTPUT]
                   [--save_query] [-x] [-p] [-s] [-z] [--references REFERENCES]
                   [-n] [--citations CITATIONS] [-l LOGLEVEL] [-f LOGFILE]
                   [-k LIMIT] [-r] [-u] [--onlyquery] [-c] [--makehtml]
                   [--synonym] [--startdate STARTDATE] [--enddate ENDDATE]
                   [--terms TERMS] [--notterms NOTTERMS] [--api API]
                   [--filter FILTER]

Welcome to Pygetpapers version 0.0.9.3. -h or --help for help

optional arguments:
  -h, --help            show this help message and exit
  --config CONFIG       config file path to read query for pygetpapers
  -v, --version         output the version number
  -q QUERY, --query QUERY
                        query string transmitted to repository API. Eg.
                        "Artificial Intelligence" or "Plant Parts". To escape
                        special characters within the quotes, use backslash.
                        Incase of nested quotes, ensure that the initial quotes
                        are double and the qutoes inside are single. For eg:
                        `'(LICENSE:"cc by" OR LICENSE:"cc-by") AND
                        METHODS:"transcriptome assembly"' ` is wrong. We should
                        instead use `"(LICENSE:'cc by' OR LICENSE:'cc-by') AND
                        METHODS:'transcriptome assembly'"`
  -o OUTPUT, --output OUTPUT
                        output directory (Default: Folder inside current working directory named current date and time)
  --save_query          saved the passed query in a config file
  -x, --xml             download fulltext XMLs if available or save metadata as
                        XML
  -p, --pdf             [E][A] download fulltext PDFs if available (only eupmc
                        and arxiv supported)
  -s, --supp            [E] download supplementary files if available (only eupmc
                        supported)
  -z, --zip             [E] download files from ftp endpoint if available (only
                        eupmc supported)
  --references REFERENCES
                        [E] Download references if available. (only eupmc
                        supported)Requires source for references
                        (AGR,CBA,CTX,ETH,HIR,MED,PAT,PMC,PPR).
  -n, --noexecute       [ALL] report how many results match the query, but don't
                        actually download anything
  --citations CITATIONS
                        [E] Download citations if available (only eupmc
                        supported). Requires source for citations
                        (AGR,CBA,CTX,ETH,HIR,MED,PAT,PMC,PPR).
  -l LOGLEVEL, --loglevel LOGLEVEL
                        [All] Provide logging level. Example --log warning
                        <<info,warning,debug,error,critical>>, default='info'
  -f LOGFILE, --logfile LOGFILE
                        [All] save log to specified file in output directory as
                        well as printing to terminal
  -k LIMIT, --limit LIMIT
                        [All] maximum number of hits (default: 100)
  -r, --restart         [E] Downloads the missing flags for the corpus.Searches
                        for already existing corpus in the output directory
  -u, --update          [E][B][M][C] Updates the corpus by downloading new
                        papers. Requires -k or --limit (If not provided, default
                        will be used) and -q or --query (must be provided) to be
                        given. Searches for already existing corpus in the output
                        directory
  --onlyquery           [E] Saves json file containing the result of the query in
                        storage. (only eupmc supported)The json file can be given
                        to --restart to download the papers later.
  -c, --makecsv         [All] Stores the per-document metadata as csv.
  --makehtml            [All] Stores the per-document metadata as html.
  --synonym             [E] Results contain synonyms as well.
  --startdate STARTDATE
                        [E][B][M] Gives papers starting from given date. Format:
                        YYYY-MM-DD
  --enddate ENDDATE     [E][B][M] Gives papers till given date. Format: YYYY-MM-
                        DD
  --terms TERMS         [All] Location of the file which contains terms
                        serperated by a comma or an ami dict which will beOR'ed
                        among themselves and AND'ed with the query
  --notterms NOTTERMS   [All] Location of the txt file which contains terms
                        serperated by a comma or an ami dict which will beOR'ed
                        among themselves and NOT'ed with the query
  --api API             API to search [eupmc,
                        crossref,arxiv,biorxiv,medrxiv,rxivist] (default: eupmc)
  --filter FILTER       [C] filter by key value pair (only crossref supported)Queries are build using-qflag. The query format can be found athttp://europepmc.org/docs/EBI_Europe_PMC_Web_Service_Reference.pdfA condensed guide can be found athttps://github.com/petermr/pygetpapers/wiki/query-formatRepository-specific flagsTo convey the repository specificity, we've used the first letter of the repository in square brackets in its description.What is CProject?A CProject is a directory structure that theAMItoolset uses to gather and process data. Each paper gets its folder.A CTree is a subdirectory of a CProject that deals with a single paper.Tutorialpygetpaperswas on version0.0.9.3when the tutorials were documented.pygetpaperssupports multiple APIs including eupmc, crossref,arxiv,biorxiv,medrxiv,rxivist-bio,rxivist-med. By default, it queries EPMC. You can specify the API by using--apiflag.You can also follow thiscolab notebookas part of the tutorial.FeaturesEPMCcrossrefarxivbiorxivmedarxivrxvistFulltext formatsxml, pdfNApdfxmlxmlxmlMetdata formatsjson, html, csvjson, xml, csvjson, csv, html, xmljson, csv, htmljson, csv, htmljson, html, csv--queryyesyesyesNANANA--updateyesNANAyesyes--restartyesNANANANANA--citationyesNANANANANA--referencesyesNANANANANA--termsyesyesyesNANANAEPMC (Default API)Example QueryLet's break down the following query:pygetpapers -q "METHOD: invasive plant species" -k 10 -o "invasive_plant_species_test" -c --makehtml -x --save_queryFlagWhat it doesIn this casepygetpapers...-qspecifies the queryqueries for 'invasive plant species' in METHODS section-knumber of hits (default 100)limits hits to 10-ospecifies output directoryoutputs to invasive_plant_species_test-xdownloads fulltext xml-csaves per-paper metadata into a single csvsaves single  CSV namedeurope_pmc.csv--makehtmlsaves per-paper metadata into a single HTML filesaves single HTML namedeurope_pmc.html--save_querysaves the given query in aconfig.iniin output directorysaves query tosaved_config.inipygetpapers, by default, writes metadata to a JSON file within:individual paper directory for corresponding paper (epmc_result.json)working directory for all downloaded papers (epmc_results.json)OUTPUT:INFO: Final query is METHOD: invasive plant species
INFO: Total Hits are 17910
0it [00:00, ?it/s]WARNING: Keywords not found for paper 1
WARNING: Keywords not found for paper 4
1it [00:00, 164.87it/s]
INFO: Saving XML files to C:\Users\shweata\invasive_plant_species_test\*\fulltext.xml
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:21<00:00,  2.11s/it]Scope the number of hits for a queryIf you are just scoping the number of hits for a given query, you can use-nflag as shown below.pygetpapers -n -q "essential oil"OUTPUT:INFO: Final query is essential oil
INFO: Total number of hits for the query are 190710Update an existing CProject withnew papersby feeding the metadata JSONThe--updatecommand is used to update a CProject with a new set of papers on same or different query.
If let's say you have a corpus of a 30 papers on 'essential oil' (like before) and would like to download 20 more papers to the same CProject directory, you use--updatecommand.To update your Cproject, you would give it the-oflag the already existing CProject name. Additionally, you should also add--updateflag.
INPUT:pygetpapers -q "invasive plant species" -k 10 -x -o lantana_test_5 --updateOUTPUT:INFO: Final query is invasive plant species
INFO: Please ensure that you are providing the same --api as the one in the corpus or you may get errors
INFO: Total Hits are 32956
0it [00:00, ?it/s]WARNING: html url not found for paper 5
WARNING: pdf url not found for paper 5
WARNING: Keywords not found for paper 6
WARNING: Keywords not found for paper 7
WARNING: Author list not found for paper 10
1it [00:00, 166.68it/s]
INFO: Saving XML files to C:\Users\shweata\lantana_test_5\*\fulltext.xml
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [01:03<00:00,  3.16s/it]How is--updatedifferent from just downloading x number of papers to the same output directory?By using--updatecommand you can be sure that you don't overwrite the existing papers.Restart downloading papers to an existing CProject--restartflag can be used for two purposes:To download papers in different format. Let's say you downloaded XMLs in the first round. If you want to download pdfs for same set of papers, you use this flag.Continue the download from the stage where it broke. This feature would particularly come in handy if you are on poor lines.
Let's start off by forcefully interrupting the download.INPUT:pygetpapers -q "pinus" -k 10 -o pinus_10 -xOUTPUT:INFO: Final query is pinus
INFO: Total Hits are 32086
0it [00:00, ?it/s]WARNING: html url not found for paper 10
WARNING: pdf url not found for paper 10
1it [00:00, 63.84it/s]
INFO: Saving XML files to C:\Users\shweata\pinus_10\*\fulltext.xml
 60%|██████████████████████████████████████████████████████████████████████████████▌                                                    | 6/10 [00:20<00:13,  3.42s/it]
Traceback (most recent call last):
...
KeyboardInterrupt
^CIf you take a look at the CProject directory, there are 6 papers downloaded so far.C:.
│   eupmc_results.json
│
├───PMC8157994
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8180188
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8198815
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8216501
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8309040
│       eupmc_result.json
│       fulltext.xml
│
└───PMC8325914
        eupmc_result.json
        fulltext.xmlTo download the rest, we can use--restartflag.INPUTpygetpapers -q "pinus" -o pinus_10 --restart -xOUTPUT:INFO: Saving XML files to C:\Users\shweata\pinus_10\*\fulltext.xml
 80%|████████████████████████████████████████████████████████████████████████████████████████████████████████▊                          | 8/10 [00:27<00:07,  3.51s/it 90%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉             | 9/10 [00:38<00:05,  5.95s/it100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:40<00:00,  4.49s/it100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:40<00:00,  4.01s/it]Now if we inspect the CProject directory, we see that we have 10 papers as specified.C:.
│   eupmc_results.json
│
├───PMC8157994
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8180188
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8198815
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8199922
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8216501
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8309040
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8309338
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8325914
│       eupmc_result.json
│       fulltext.xml
│
├───PMC8399312
│       eupmc_result.json
│       fulltext.xml
│
└───PMC8400686
        eupmc_result.json
        fulltext.xmlUnder the hood,pygetpaperslooks foreupmc_results.json, reads it and resumes the download.You could also use--restartto download the fulltext or metadata in different format other than the ones that you've already downloaded. For example, if I want all the fulltext PDFs of the 10 papers onpinus, I can run:INPUT:pygetpapers -q "pinus" -o pinus_10 --restart -p --makehtmlOUTPUT:>pygetpapers -q "pinus" -o pinus_10 --restart -p --makehtml
100%|█████████████████████████████████████████████| 10/10 [03:26<00:00, 20.68s/it]Now, if we take a look at the CProject:C:.
│   eupmc_results.json
│
├───PMC8157994
│       eupmc_result.html
│       eupmc_result.json
│       fulltext.pdf
│       fulltext.xml
│
├───PMC8180188
│       eupmc_result.html
│       eupmc_result.json
│       fulltext.pdf
│       fulltext.xml
│
├───PMC8198815
│       eupmc_result.html
│       eupmc_result.json
│       fulltext.pdf
│       fulltext.xml
...We find that each paper now has fulltext PDFs and metadata in HTML.Difference between--restartand--updateIf you aren't looking download new set of papers but would want to download a papers in different format for existing papers,--restartis the flag you'd want to useIf you are looking to download a new set of papers to an existing Cproject, then you'd use--updatecommand. You should note that the format in which you download papers would only apply to the new set of papers and not for the old.Downloading citations and references for papers, if available--referencesand--citationsflags can be used to download the references and citations respectively.It also requires source for references (AGR,CBA,CTX,ETH,HIR,MED,PAT,PMC,PPR)pygetpapers -q "lantana" -k 10 -o "test" -c -x --citation PMCDownloading only the metadataIf you are looking to download just the metadata in the supported formats--onlyqueryis the flag you use. It saves the metadata in the output directory.You can use--restartfeature to download the fulltexts for these papers.
INPUT:pygetpapers --onlyquery -q "lantana" -k 10 -o "lantana_test" -cOUTPUT:INFO: Final query is lantana
INFO: Total Hits are 1909
0it [00:00, ?it/s]WARNING: html url not found for paper 1
WARNING: pdf url not found for paper 1
WARNING: Keywords not found for paper 2
WARNING: Keywords not found for paper 3
WARNING: Author list not found for paper 5
WARNING: Author list not found for paper 8
WARNING: Keywords not found for paper 9
1it [00:00, 407.69it/s]Download papers within certain start and end date rangeBy using--startdateand--enddateyou can specify the date range within which the papers you want to download were first published.pygetpapers -q "METHOD:essential oil" --startdate "2020-01-02" --enddate "2021-09-09"Saving query for later useTo save a query for later use, you can use--save_query. What it does is that it saves the query in a.inifile in the output directory.pygetpapers -q "lantana" -k 10 -o "lantana_query_config"--save_queryHereis an example config filepygetpapersoutputsFeed query usingconfig.inifileUsing can use theconfig.inifile you created using--save_query, you re-run the query. To do so, you will give--configflag the absolute path of thesaved_config.inifile.pygetpapers --config "C:\Users\shweata\lantana_query_config\saved_config.ini"Querying using a term list--termsflagIf your query is complex with multiple ORs, you can use--termsfeature. To do so, you will:Create a.txtfile with list of terms separated by commas or anami-dictionary(Click hereto learn how to create dictionaries).Give the--termsflag the absolute path of the.txtfile orami-dictionary(XML)-qis optional.The terms would be OR'ed with each other ANDed with the query, if given.INPUT:pygetpapers -q "essential oil" --terms C:\Users\shweata\essential_oil_terms.txt -k 10 -o "terms_test_essential_oil" -xOUTPUT:C:\Users\shweata>pygetpapers -q "essential oil" --terms C:\Users\shweata\essential_oil_terms.txt -k 10 -o "terms_test_essential_oil"
INFO: Final query is (essential oil AND (antioxidant OR  antibacterial OR  antifungal OR  antiseptic OR  antitrichomonal agent))
INFO: Total Hits are 43397
0it [00:00, ?it/s]WARNING: Author list not found for paper 9
1it [00:00, 1064.00it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:19<00:00,  1.99s/it]You can also use this feature to download papers by using the PMC Ids. You can feed the.txtfile with PMC ids comman-separated. Make sure to give a large enough hit number to download all the papers specified in the text file.Example text file can be found,hereINPUT:pygetpapers --terms C:\Users\shweata\PMCID_pygetpapers_text.txt -k 100 -o "PMCID_test"OUTPUT:INFO: Final query is (PMC6856665 OR  PMC6877543 OR  PMC6927906 OR  PMC7008714 OR  PMC7040181 OR  PMC7080866 OR  PMC7082878 OR  PMC7096589 OR  PMC7111464 OR  PMC7142259 OR  PMC7158757 OR  PMC7174509 OR  PMC7193700 OR  PMC7198785 OR  PMC7201129 OR  PMC7203781 OR  PMC7206980 OR  PMC7214627 OR  PMC7214803 OR  PMC7220991
)
INFO: Total Hits are 20
WARNING: Could not find more papers
1it [00:00, 505.46it/s]
100%|█████████████████████████████████████████████| 20/20 [00:32<00:00,  1.61s/it]--nottermsExcluded papers that have certain keywords might also be of interest for you. For example, if you want papers on essential oil which doesn't mentionantibacterial,antisepticorantimicrobial, you can run either create a dictionary or a text file with these terms (comma-separated), specify its absolute path to--nottermsflag.INPUT:pygetpapers -q "essential oil" -k 10 -o essential_oil_not_terms_test --notterms C:\Users\shweata\not_terms_test.txtOUTPUT:INFO: Final query is (essential oil AND NOT (antimicrobial OR  antiseptic OR  antibacterial))
INFO: Total Hits are 165557
1it [00:00, ?it/s]
100%|█| 10/10 [00:49<00:00,  4.95s/The number of papers are reduced by a some proportion. For comparision, "essential oil" query gives us 193922 hits.C:\Users\shweata>pygetpapers -q "essential oil" -n
INFO: Final query is essential oil
INFO: Total number of hits for the query are 193922Using--termswith dictionariesWe will take the same example as before.Assuming you haveami3installed, you can createami-dictionariesStart off by listing the terms in a.txtfileantimicrobial
antiseptic
antibacterialRun the following command from the directory in which the text file existsamidict -v --dictionary pygetpapers_terms --directory pygetpapers_terms --input pygetpapers_terms.txt create --informat list --outformats xmlThat's it! You've now created a simpleami-dictionary. There are ways of creating dictionaries from Wikidata as well. You can learn more about how to do that in thisWikipage.You can also usestandard dictionariesthat are available.
we, then, pass the absolute path of the dictionary to--termsflag.INPUT:pygetpapers -q "essential oil" --terms C:\Users\shweata\pygetpapers_terms\pygetpapers_terms.xml -k 10 -o pygetpapers_dictionary_test -xOUTPUT:INFO: Final query is (essential oil AND (antibacterial OR antimicrobial OR antiseptic))
INFO: Total Hits are 28365
0it [00:00, ?it/s]WARNING: Keywords not found for paper 5
WARNING: Keywords not found for paper 7
1it [00:00, ?it/s]
INFO: Saving XML files to C:\Users\shweata\pygetpapers_dictionary_test\*\fulltext.xml
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:36<00:00,  3.67s/it]Log levelsYou can specify the log level using the-lflag. The default as you've already seen so far is info.INPUT:pygetpapers -q "lantana" -k 10 -o lantana_test_10_2 --loglevel debug -xLog fileYou can also choose to write the log to a.txtfile in your HOME directory, while simultaneously printing it out.INPUT:pygetpapers -q "lantana" -k 10 -o lantana_test_10_4 --loglevel debug -x --logfile test_log.txtHereis the log file.CrossrefYou can query crossref api for the metadata only.Sample queryThe metadata formats flags are applicable as described in the EPMC tutorial--termsand-qare also applicable to crossref
INPUT:pygetpapers --api crossref -q "essential oil" --terms C:\Users\shweata\essential_oil_terms.txt -k 10 -o "terms_test_essential_oil_crossref_3" -x -c --makehtmlOUTPUT:INFO: Final query is (essential oil AND (antioxidant OR  antibacterial OR  antifungal OR  antiseptic OR  antitrichomonal agent))
INFO: Making request to crossref
INFO: Got request result from crossref
INFO: Making csv files for metadata at C:\Users\shweata\terms_test_essential_oil_crossref_3
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 185.52it/s]
INFO: Making html files for metadata at C:\Users\shweata\terms_test_essential_oil_crossref_3
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 87.98it/s]
INFO: Making xml files for metadata at C:\Users\shweata\terms_test_essential_oil_crossref_3
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 366.97it/s]
INFO: Wrote metadata file for the query
INFO: Writing metadata file for the papers at C:\Users\shweata\terms_test_essential_oil_crossref_3
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 996.82it/s]We have 10 folders in the CProject directory.C:\Users\shweata>cd terms_test_essential_oil_crossref_3

C:\Users\shweata\terms_test_essential_oil_crossref_3>tree
Folder PATH listing for volume Windows-SSD
Volume serial number is D88A-559A
C:.
├───10.1016_j.bcab.2021.101913
├───10.1055_s-0029-1234896
├───10.1080_0972060x.2016.1231597
├───10.1080_10412905.1989.9697767
├───10.1111_j.1745-4565.2012.00378.x
├───10.17795_bhs-24733
├───10.23880_oajmms-16000131
├───10.34302_crpjfst_2019.11.2.8
├───10.5220_0008855200960099
└───10.5220_0009957801190122--update--updateworks the same as inEPMC. You can use this flag to increase the number of papers in a given CProject.
INPUTpygetpapers --api crossref -q "essential oil" --terms C:\Users\shweata\essential_oil_terms.txt -k 5 -o "terms_test_essential_oil_crossref_3" -x -c --makehtml --updateOUTPUT:INFO: Final query is (essential oil AND (antioxidant OR  antibacterial OR  antifungal OR  antiseptic OR  antitrichomonal agent))
INFO: Please ensure that you are providing the same --api as the one in the corpus or you may get errors
INFO: Reading old json metadata file
INFO: Making request to crossref
INFO: Got request result from crossref
INFO: Wrote metadata file for the query
INFO: Writing metadata file for the papers at C:\Users\shweata\terms_test_essential_oil_crossref_3
100%|██████████████████████████████████████████████| 5/5 [00:00<00:00, 346.84it/s]The CProject after updating:C:.
├───10.1002_mbo3.459
├───10.1016_j.bcab.2021.101913
├───10.1055_s-0029-1234896
├───10.1080_0972060x.2014.895156
├───10.1080_0972060x.2016.1231597
├───10.1080_0972060x.2017.1345329
├───10.1080_10412905.1989.9697767
├───10.1080_10412905.2021.1941338
├───10.1111_j.1745-4565.2012.00378.x
├───10.15406_oajs.2019.03.00121
├───10.17795_bhs-24733
├───10.23880_oajmms-16000131
├───10.34302_crpjfst_2019.11.2.8
├───10.5220_0008855200960099
└───10.5220_0009957801190122We started off with 10 paper folders, and increased the number to 15.Filterarxivpygetpapersallows you to queryarxivfor full text PDF and metadata in all supported formats.Sample queryINPUTpygetpapers --api arxiv -k 10 -o arxiv_test_3 -q "artificial intelligence" -x -p --makehtml -cOUTPUTINFO: Final query is artificial intelligence
INFO: Making request to Arxiv through pygetpapers
INFO: Got request result from Arxiv through pygetpapers
INFO: Requesting 10 results at offset 0
INFO: Requesting page of results
INFO: Got first page; 10 of 10 results available
INFO: Downloading Pdfs for papers
100%|█████████████████████████████████████████████| 10/10 [01:02<00:00,  6.27s/it]
INFO: Making csv files for metadata at C:\Users\shweata\arxiv_test_3
100%|████████████████████████████████████████████| 10/10 [00:00<00:00, 187.31it/s]
INFO: Making html files for metadata at C:\Users\shweata\arxiv_test_3
100%|████████████████████████████████████████████| 10/10 [00:00<00:00, 161.87it/s]
INFO: Making xml files for metadata at C:\Users\shweata\arxiv_test_3
100%|█████████████████████████████████████████████████████| 10/10 [00:00<?, ?it/s]
100%|███████████████████████████████████████████| 10/10 [00:00<00:00, 1111.22it/s]Note:--updateisn't supported forarxivBiorxiv and MedrxivYou can querybiorxivandmedrxivfor fulltext and metadata (in all supported formats). However, passing a query string using-qflag isn't supported for both the Repositories. You can only provide a date range.Sample Query - biorxivINPUT:pygetpapers --api biorxiv -k 10 -x --startdate 2021-01-01 -o biorxiv_test_20210831OUTPUT:WARNING: Currently biorxiv api is malfunctioning and returning wrong DOIs
INFO: Making Request to rxiv
INFO: Making xml for paper
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:23<00:00,  2.34s/it]
INFO: Wrote metadata file for the query
INFO: Writing metadata file for the papers at C:\Users\shweata\biorxiv_test_20210831
100%|█████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 684.72it/s]--updatecommandINPUTpygetpapers --api biorxiv -k 10 -x --startdate 2021-01-01 -o biorxiv_test_20210831 --updateOUTPUTWARNING: Currently biorxiv api is malfunctioning and returning wrong DOIs
INFO: Please ensure that you are providing the same --api as the one in the corpus or you may get errors
INFO: Reading old json metadata file
INFO: Making Request to rxiv
INFO: Making xml for paper
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:22<00:00,  2.23s/it]
INFO: Wrote metadata file for the query
INFO: Writing metadata file for the papers at C:\Users\shweata\biorxiv_test_20210831
100%|█████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 492.39it/s]The CProject now has 20 papers, in total after updating.├───10.1101_008326
├───10.1101_010553
├───10.1101_035972
├───10.1101_046052
├───10.1101_060012
├───10.1101_067736
├───10.1101_086710
├───10.1101_092205
├───10.1101_092619
├───10.1101_093237
├───10.1101_121061
├───10.1101_135749
├───10.1101_145664
├───10.1101_145896
├───10.1101_165845
├───10.1101_180273
├───10.1101_181198
├───10.1101_191858
├───10.1101_194266
└───10.1101_196105The working ofmedarxivis same asbiorxivrxivistLets you specify a queries string to bothbiorxivandmedarxiv. The results you get would be a mixture of papers from both repository sincerxivistdoesn't differentiate.Another caveat here is that you can only retrieve metadata fromrxivist.INPUT:pygetpapers --api rxivist -q "biomedicine" -k 10 -c -x -o "biomedicine_rxivist" --makehtml -pOUTPUT:WARNING: Pdf is not supported for this api
INFO: Final query is biomedicine
INFO: Making Request to rxivist
INFO: Making csv files for metadata at C:\Users\shweata\biomedicine_rxivist
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 125.54it/s]
INFO: Making html files for metadata at C:\Users\shweata\biomedicine_rxivist
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 124.71it/s]
INFO: Making xml files for metadata at C:\Users\shweata\biomedicine_rxivist
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 633.38it/s]
INFO: Wrote metadata file for the query
INFO: Writing metadata file for the papers at C:\Users\shweata\biomedicine_rxivist
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 751.09it/s]Query hits onlyLike any other repositories underpygetpapers, you can use the-nflag to get only the hit number
INPUT:C:\Users\shweata>pygetpapers --api rxivist -q "biomedical sciences" -nOUTPUT:INFO: Final query is biomedical sciences
INFO: Making Request to rxivist
INFO: Total number of hits for the query are 62Update--updateworks the same as many other repositories. Make sure to providerxvistas api.INPUT:pygetpapers --api rxivist -q "biomedical sciences" -k 20 -c -x -o "biomedicine_rxivist" --updateOUPUT:INFO: Final query is biomedical sciences
INFO: Please ensure that you are providing the same --api as the one in the corpus or you may get errors
INFO: Reading old json metadata file
INFO: Making Request to rxivist
INFO: Making csv files for metadata at C:\Users\shweata\biomedicine_rxivist
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 203.69it/s]
INFO: Making xml files for metadata at C:\Users\shweata\biomedicine_rxivist
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 1059.17it/s]
INFO: Wrote metadata file for the query
INFO: Writing metadata file for the papers at C:\Users\shweata\biomedicine_rxivist
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 10/10 [00:00<00:00, 1077.12it/s]Runpygetpaperswithin the moduledef run_command(output=False, query=False, save_query=False, xml=False, pdf=False, supp=False, zip=False, references=False, noexecute=False, citations=False, limit=100, restart=False, update=False, onlyquery=False, makecsv=False, makehtml=False, synonym=False, startdate=False, enddate=False, terms=False, notterms=False, api='europe_pmc', filter=None, loglevel='info', logfile=False, version=False)Here's an example script to download 50 papers from EPMC on 'lantana camara'.from pygetpapers import Pygetpapers
pygetpapers_call=Pygetpapers()
pygetpapers_call.run_command(query='lantana camara',limit=-50 ,output= lantana_camara, xml=True)TestpygetpapersTo run automated testing onpygetpapers, do the following:InstallpygetpapersClone intopygetpapersrepositoryInstall pytestRun the command,pytestContributionshttps://github.com/petermr/pygetpapers/blob/main/resources/CONTRIBUTING.mdFeature RequestsTo request features, please put them in issuesLegal ImplicationsIf you usepygetpapers, you should be careful to understand the law as it applies to their content mining, as they assume full responsibility for their actions when using the software.Countries with copyright exceptions for content mining:UKJapanCountries with proposed copyright exceptions:IrelandEU countriesCountries with permissive interpretations of 'fair use' that might allow content mining:IsraelUSACanadaGeneral summaries and guides:"The legal framework of text and data mining (TDM)", carried out for the European Commission in March 2014 (PDF)"Standardisation in the area of innovation and technological development, notably in the field of Text and Data Mining", carried out for the European Commission in 2014 (PDF)