1
Fork 0
mirror of https://github.com/Steffo99/steamleaderboards.git synced 2024-11-24 08:34:19 +00:00

Use <nextRequestURL> to determine the next leaderboard page

Fixes #1.
This commit is contained in:
Steffo 2024-05-26 10:12:13 +02:00
parent 3f2f77eed1
commit 428b11fae4
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -86,13 +86,9 @@ class Leaderboard:
_bs = BeautifulSoup(xml.content, features="lxml-xml")
for entry in _bs.find_all("entry"):
self.entries.append(Entry(entry))
if _bs.response.entryend:
entry_end = int(_bs.response.entryend.text)
if entry_end < int(_bs.response.totalleaderboardentries.text):
next_request_url = f"https://steamcommunity.com/stats/{self.app_id}/leaderboards/{self.lbid}/?xml=1&start={entry_end + 1}"
else:
next_request_url = None
else:
try:
next_request_url = _bs.find_all("nextRequestURL")[0].text
except IndexError:
next_request_url = None
def __repr__(self):