Search code examples
javascriptphphtmljsonjqplot

Get raw data from plot on website that used jqplot


I am trying to get the raw data that made the graph labeled "Last 24 Hours Balance: 1HS8cq9TDNqr77nwW6WwUZBjSDBLsmpt6e". I can tell they used jqplot to plot the data, but can't find the data in the source from which it got the numbers. I'm assuming it's probably somewhere in the javascript since the html points to a canvas that calls a javascript class, but I can't find it.

Here is the website I am trying to get the data from https://www.ahashpool.com/wallet.php?wallet=1HS8cq9TDNqr77nwW6WwUZBjSDBLsmpt6e


Solution

  • This question is mostly about the wider topic, the web scraping, here is the main steps to track down to data source using browser development tools:

    1. Find the element on page, which used to plot charts, it will be in our case <div id='graph_earnings_results' style='height: 240px;'></div>.
    2. Look through js code (it is completely located in page <script> tag in this case), searching for references to 'graph_earnings_results' element. The only place is graph_earnings_init(data) function, where plot is created: $.jqplot('graph_earnings_results', t, {...});.
    3. The graph_earnings_init(data) function called from graph_earnings_ready(data), which in turn is AJAX callback in graph_earnings_refresh() function.
    4. Finally, the data source URL can be found in graph_earnings_refresh() function, var url = .... So, the full data source URL will be https://www.ahashpool.com/wallet_graph_earnings_results.php?wallet=1HS8cq9TDNqr77nwW6WwUZBjSDBLsmpt6e