Skip to content

Commit 2a8a911

Browse files
authored
Merge pull request #10 from JosePizarro3/9-fix-start-index
Fix start index
2 parents 48fb68a + 68135d8 commit 2a8a911

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pyrxiv/fetch.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ def normalize(arxiv_id: str) -> tuple[int | None, int | None]:
140140
# If the year is different, compare the years
141141
else:
142142
return paper_id_norm[0] > reference_id_norm[0]
143-
return False
144143

145144
def fetch(
146145
self,
@@ -278,8 +277,12 @@ def fetch(
278277
# Incrementing the start index for the next batch
279278
self.start_index += self.max_results
280279

280+
# If the fetched results are less than the starting point, increment the start index
281+
if not papers:
282+
self.start_index += self.max_results
283+
281284
# Storing last fetched ID to the file if `start_from_filepath` is specified
282-
if write:
285+
if write and papers:
283286
with open(self.fetched_ids_file, "w") as f:
284287
f.write(papers[-1].id)
285288
return papers

0 commit comments

Comments
 (0)