There you go!
Take any of the new
or recent
links from https://arxiv.org/ and substitute it under Settings
.
#!/usr/bin/python3
# encoding=utf8
import os, re, subprocess, sys
import urllib.request as urllib2
import urllib.parse
from bs4 import BeautifulSoup
version = 1.0
arguments = {}
arguments['-h, --help'] = 'Print help'
arguments['-v, --version'] = 'Print Version'
# ================== Settings ====================
url = "https://arxiv.org/list/astro-ph/new"
# ================================================
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'
if __name__ == "__main__":
# =============== Argument parser=================
if any([1 if arg in sys.argv else 0 for arg in ['-v', '--version']]):
print(version)
sys.exit(0)
if any([1 if arg in sys.argv else 0 for arg in ['-h', '--help']]):
name = os.path.basename(sys.argv[0])
# Display help
print("This is {program}. Get your daily arXiv-dose.\n".format(program=name))
print("Usage: ./{program}".format(program=name))
print("Currently I'm fetching", url, '\n')
for key in arguments:
print("\t{:15}: {}".format(key, arguments[key]))
sys.exit(0)
# ================================================
# ============ Generate and fetch url ============
try:
req = urllib2.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
html = urllib2.urlopen(req)
except urllib2.HTTPError:
print(url)
print('"{}" not found. Correct spelling?'.format(search))
sys.exit(0)
# ================================================
# ================= Find papers ==================
soup = BeautifulSoup(html, "lxml")
articles = {}
# Get DOI and URL
papers = soup.find_all("dt")
for c, nnn in zip( papers, range( len(papers) ) ):
articles[nnn] = {}
doi = c.find_all("a", title="Abstract")[0]
doi = doi.get_text()
articles[nnn]["doi"] = doi
link = c.find_all("a", title="Download PDF")[0].get("href")
articles[nnn]["url"] = 'https://arxiv.org' + link
# Get Title, Authors and Abstract
meta = soup.find_all("div", class_="meta")
for c, nnn in zip(meta, range(len(meta))):
title = c.find("div", class_="list-title")
title = title.get_text().replace('Title: ','')
articles[nnn]["title"] = title.strip()
authors = c.find("div", class_="list-authors")
authors = authors.get_text().replace('Authors:','').replace('\n','')
authors = re.sub('[a-zA-Z]+\.+\ ','',authors)
articles[nnn]["authors"] = authors.strip()
try:
abstract = c.find("p", class_="mathjax").get_text().replace('\n',' ')
except AttributeError:
pass
articles[nnn]["abstract"] = abstract
# List findings
for paper in articles.keys():
print( '\n' + color.BOLD + color.UNDERLINE +'{:5}'.format(paper) + color.END,
articles[paper]["title"])
print( 6 * ' ' + articles[paper]["authors"], '\n' )
print( ' ' + articles[paper]["abstract"] )
# Get user input list
while True:
download = input( '\n' + color.BOLD + 'Download (2 12 ..): ' + color.END )
try:
download = [ int(i) for i in download.split() ]
break
except ValueError:
print('Not a valid list: "{}"'.format(download))
pass
for file in download:
url = articles[file]["url"]
filename = '{}-{}-{}.pdf'.format(articles[file]["title"], articles[file]["authors"], articles[file]["doi"])
# EXT4 limits filenames to 255 characters
if len(filename) > 254:
filename = articles[file]["title"] + '-'
for author in articles[file]["authors"].split():
if len(author) + len(filename) + len(articles[file]["doi"]) + 5 < 255:
filename += author.strip()
filename = filename[:-1] + '-' + articles[file]["doi"] + ".pdf"
print(color.BOLD + 'Warning:' + color.END + 'Too many authors for |filename| < 256.')
print('Truncating to ', filename)
# Download
subprocess.call(["wget", '--quiet', '--show-progress', '--header', "User-Agent: Mozilla/5.0", "--output-document", '{}'.format(filename), url])
This will give you a complete list with title, author and abstract. You can then enter a list of numbers to download as {title}-{authors}-{doi}.pdf
.
[...]
120 Flavours in the box of chocolates: chemical abundances of kinematic substructures in the nearby stellar halo
Jovan Veljanoski, Amina Helmi
Different subtleties and problems associated with a nonrelativistic limit of the field theory to the Schroedinger theory are discussed. In this paper, we revisit different cases of the nonrelativistic limit of a real and complex scalar field in the level of the Lagrangian and the equation of motion. We develop the nonrelativistic limit of the Dirac equation and action in the way that the nonrelativistic limit of spin-$\frac{1}{2}$ wave functions of particles and antiparticles appear simultaneously. We study the effect of a potential like $U(\phi)\propto \phi^4$ which can be attributed to axion dark matter field in this limit. We develop a formalism for studying the nonrelativistic limit of antiparticles in the quantum mechanics. We discussed the non-local approach for the nonrelativistic limit and its problems.
121 The Masses and Accretion Rates of White Dwarfs in Classical and Recurrent Novae
Michael Shara, Dina Prialnik, Yael Hillman, Attay Kovetz
Different subtleties and problems [...]
Download (2 12 ..):
Usage
E.g.:
- Save the script as
arxiv
in /usr/local/bin
chmod +x /usr/local/bin/arxiv
You should now be able to execute it by just typing arxiv
in terminal.
Requirements
python3
python-beautifulsoup4
(pip install bs4
if you use python-pip
package)
wget
EDIT Current version is available here.