Joshbazz / polymarket_copy_trader

An automated bot for tailing the trades of the top ranked wallets on Polymarket monthly
19 stars 1 forks source link

Add Dynamic Scraping for fetch_leaderboard() in nice_funcs.py #3

Open Joshbazz opened 1 month ago

Joshbazz commented 1 month ago

Problem

The function used to grab the leaderboard, a basic component of this bot working seamlessly, relies on a statically copied URL link due to my subpar scraping capabilities

Problem Code

# returns proxy wallet dictionary / saves to proxy_wallets.py
def fetch_leaderboard() -> list:
    # The URL to fetch the leaderboard data - the URL will change from time to time
    #NOTE: the URL Changes -- Should probably look into this
    url = 'https://polymarket.com/_next/data/Qiek3ZtiJbjD_PULr6g8h/en/leaderboard.json'

    # Making the GET request to fetch the leaderboard data
    response = requests.get(url)

Possible Solution

Someone smarter than me must know a way to dynamically scrape the frontend and get the refreshed URL in an automated fashion