arXiv Helpers Module¶
The arXiv Helpers module includes functions for downloading PDFs from various sources, including arXiv, Sci-Hub, and medRxiv.
- utils.arxiv_helpers.arxiv_download(self, doi=None, items=None, download_dest='.', full_lib=False, title=None)¶
Attempt to download a PDF from arXiv or alternative sources using a DOI or title.
Parameters: - doi (str, optional): The DOI of the paper to download. - items: Collection of items to consider for downloading. Used if full_lib is True. - download_dest (str): The directory to save the downloaded PDF. - full_lib (bool): Whether to perform a full library scan for matching titles. - title (str, optional): The title of the paper, used if DOI is not available.
Returns: - tuple: (bool, str) indicating success status and the file path to the downloaded PDF.
- utils.arxiv_helpers.bioArxiv_download(download_dest, DOI)¶
- utils.arxiv_helpers.download_pdf(url)¶
Download a PDF from a given URL.
Parameters: - url (str): The URL of the PDF to be downloaded.
Returns: - str or None: The file path to the downloaded PDF if successful, None otherwise.
- utils.arxiv_helpers.download_response(response, path, server='se')¶
Handle the response from a PDF download attempt, saving the file if successful.
Parameters: - response: The response object from the download attempt. - path (str): The file path where the PDF should be saved. - server (str): Identifier for the PDF source server, default is “se” for Sci-Hub.se.
Returns: - bool: True if the PDF was successfully downloaded and saved, False otherwise.
- utils.arxiv_helpers.ensure_download_dest_is_valid(download_dest)¶
Ensure the specified download destination is valid, creating directories as needed.
Parameters: - download_dest (str): The intended directory for downloading files.
Returns: - str: The normalized, absolute path to the download destination.
- utils.arxiv_helpers.medrxiv_download(download_dest, DOI)¶
Attempt to download a PDF from medRxiv using a DOI.
Parameters: - download_dest (str): The directory to save the downloaded PDF. - DOI (str): The DOI of the document to download.
Returns: - tuple: (bool, str) indicating success status and the file path to the downloaded PDF.
- utils.arxiv_helpers.scihub_download(download_dest, doi)¶
Attempt to download a PDF from Sci-Hub using a DOI.
Parameters: - download_dest (str): The directory to save the downloaded PDF. - doi (str): The DOI of the document to download.
Returns: - tuple: (bool, str) indicating success status and the file path to the downloaded PDF.