bacmive commited on
Commit
28155c8
·
verified ·
1 Parent(s): 05a4255

Arxiv tar file download endpoint API update

Browse files

1. the Arxiv tex file download endpoint API: from 'export.arxiv.org/e-print/xxx' to 'arxiv.org/src/xxx'
2. the Arxiv tex file : from '.tar' to '.tar.gz'

Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -9,14 +9,13 @@ import requests
9
 
10
 
11
  def convert_tar_to_zip(arxiv_url):
12
- latex_source_url = (arxiv_url.replace('/abs/', '/e-print/')
13
- .replace('arxiv.org', 'export.arxiv.org'))
14
 
15
  # Fetch the latex source as .tar.gz file
16
  resp = requests.get(latex_source_url)
17
  print(resp.status_code)
18
  tar_file = resp.content
19
- with tarfile.open(fileobj=io.BytesIO(tar_file)) as tar:
20
  with tempfile.TemporaryDirectory() as temp_dir:
21
  # Extract the tar file to a temporary directory
22
  tar.extractall(temp_dir)
 
9
 
10
 
11
  def convert_tar_to_zip(arxiv_url):
12
+ latex_source_url = (arxiv_url.replace('/abs/', 'src'))
 
13
 
14
  # Fetch the latex source as .tar.gz file
15
  resp = requests.get(latex_source_url)
16
  print(resp.status_code)
17
  tar_file = resp.content
18
+ with tarfile.open(fileobj=io.BytesIO(tar_file), mode='r:gz') as tar:
19
  with tempfile.TemporaryDirectory() as temp_dir:
20
  # Extract the tar file to a temporary directory
21
  tar.extractall(temp_dir)