Spaces:
Runtime error
Runtime error
kotstantinovskii
commited on
Commit
•
5ebeeca
1
Parent(s):
c3da1c2
Upload parser.py
Browse files
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
|