kotstantinovskii commited on
Commit
5ebeeca
1 Parent(s): c3da1c2

Upload parser.py

Browse files
Files changed (1) hide show
  1. parser.py +15 -0
parser.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import arxiv
2
+
3
+
4
+ def get_text_title(arxiv_id):
5
+ if 'arxiv.org' in arxiv_id:
6
+ arxiv_id = arxiv_id.split('/')[-1]
7
+
8
+ try:
9
+ search = arxiv.Search(id_list=[arxiv_id])
10
+ paper = next(search.results())
11
+ return paper.title, paper.summary
12
+ except arxiv.UnexpectedEmptyPageError:
13
+ return None
14
+ except arxiv.HTTPError:
15
+ return None