Skip to content

Commit

Permalink
quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
younik committed Nov 22, 2024
1 parent bce994f commit 345c0c9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions _scripts/scrape_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ def scrape_project_downloads(project):
soup = BeautifulSoup(
requests.get(DOWNLOADS_URL.format(pip_project=project)).text, "html.parser"
)
elements = soup.select("div[data-cy=summary] .MuiCardContent-root .MuiGrid-root.MuiGrid-item")
for element in elements:
if element.text.lower() == "total downloads":
project_downloads = int(element.find_next_sibling().text.replace(",", ""))
project_downloads = str(soup).split('\\"totalDownloads\\":')[1].split(',')[0]
project_downloads = int(project_downloads)
except Exception as e:
print(
"Error while requesting data from: "
Expand Down

0 comments on commit 345c0c9

Please sign in to comment.