ArmindoFlores / ao3_api

An unofficial archiveofourown.org (AO3) API for python
MIT License
166 stars 64 forks source link

invalid literal for int() with base 10: {total_results} #97

Open BenRavioli opened 4 months ago

BenRavioli commented 4 months ago

When updating a search, if there are more than 999 results, the search.update() function cannot parse the total results, since it's failing to remove the comma from the string.

For instance, searching for "characters='Spider-Man'" throws invalid literal for int() with base 10: '1,843'.

BenRavioli commented 4 months ago

I checked the code of the package. The version that pip installs is outdated, and the code for grabbing total_results is: self.total_results = int(maindiv.find("h3", {"class": "heading"}).getText().strip().split(" ")[0]) without the necessary replace() functions that are in the current code base on GitHub. Adding the replace(',','') function to this line makes the code function as intended.