score:4
I noticed one thing.
It seems true that:
"when I use custom search option, csv file that automatically generated by the website is not updated".
But actually it is not true. It is updated, but the maximum "custom data range" seems to be 1 year.
For example, if you set from 2013-09-23
to 2017-10-23
the .csv(.json) generated has max the data of 1 year (in this example from 22/10/2016
to 21/10/2017
).
You can better notice this if you play with the "extremes".
For example with:
https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/statistics/downloads-day-20131023-20141023.json
- first element:
{"date": "2014-10-23", "count": 212730, "end": "2014-10-23"}
- last element:
{"date": "2013-10-24", "count": 163094, "end": "2013-10-24"}
if you change with:
https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/statistics/downloads-day-20131023-20141024.json
- first element:
{"date": "2014-10-24", "count": 215105, "end": "2014-10-24"}
- last element:
{"date": "2013-10-25", "count": 168018, "end": "2013-10-25"}
Or with:
https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/statistics/downloads-day-20131022-20141023.json
will be again :
- first element:
{"date": "2014-10-23", "count": 212730, "end": "2014-10-23"}
- last element:
{"date": "2013-10-24", "count": 163094, "end": "2013-10-24"}
So, in order to get the data of the last 5 years you could do:
import subprocess
interestedYears=5;
year=1
today="2017-10-23"
tokenDataToday= today.split("-")
dateEnd=tokenDataToday[0]+tokenDataToday[1]+tokenDataToday[2]
url= "https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/statistics/downloads-day-"
while year <= interestedYears:
yearStart= str(int(float(tokenDataToday[0]))-year)
dateStart=yearStart+tokenDataToday[1]+tokenDataToday[2]
#print("dateStart: " + dateStart)
#print("dateEnd: " + dateEnd)
tmpUrl=url+dateStart+"-"+dateEnd+".csv"
cmd = 'curl -O ' + tmpUrl
print(cmd)
args = cmd.split()
process = subprocess.Popen(args, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
dateEnd=dateStart
year = year+1
print("-----------------------------")
score:6
Mozilla provides a simple REST API to get the stats, so you don't need to use Selenium.
With the requests
module:
url = "https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/statistics/downloads-day-20170823-20171023.json"
data = requests.get(url).json()
To select the range, simply update the dates in the URL.
But if you are still willing to scrap the chart with selenium:
dates = driver.execute_script("return Highcharts.charts[0].series[0].xData");
users = driver.execute_script("return Highcharts.charts[0].series[0].yData");
downloads = driver.execute_script("return Highcharts.charts[0].series[1].yData");
Source: stackoverflow.com
Related Query
- Scraping data from Highcharts using selenium
- How to scrape data from Highcharts charts using selenium and python?
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- Fetch data from firebase firestore and plot histogram using highcharts when cardview clicked - android
- How to hardcode chart data in my Model then have my Controller pull it from there to display it. Using Highcharts
- highcharts example for using data from database with mvc
- Highcharts display label for pie chart using html table as data source
- Creating a responsive accumulated rain chart from a series containing individual rain fall data using Highcharts
- using dynamic data from highcharts in a html table
- Highcharts Using Data from Ruby on Rails Database
- Scrape data from a highchart using selenium
- I am using click event to trigger a new page to generate the drill down data from highcharts however the entire chart is being generated
- How to display historical data and live data from database using Highcharts
- HTML table as data source for highstock charts using highcharts
- Getting Refreshed Highcharts Data Using Selenium & Python
- Refresh Highcharts with data from AJAX using Handlebars
- Using a flask variable as data source for highcharts
- Highcharts Highstock How to Plot OHLC and Line Charts from One Set of Embedded CSV Data Using Series Map Tools?
- How to return every nth row from dataset using postgresql to control a Highcharts data series
- How to replace x-axes with our own timestamp data from API in Highcharts using highstocks
- Using highcharts to display data from an API
- Dynamic chart using Highcharts with data from MySQL database
- Highcharts not being drawn in some cases when using data from MySQL (page elements created before database query complete?) PHP / MySQL
- HighCharts pie chart X-axies values are not displayed while trying to get data from MySQL database using PHP
- Data is not getting displayed in PieChart of HighCharts using Angularjs (Dynamic Data from Ajax call)
- How to query data from database using highcharts in Codeigniter?
- How to make multiple Y-axis with incoming series of data from database using Highcharts
- Retrieve data from Controller to View using Json to HighCharts
- Highcharts displays series names but missing data points from json source
- Proper way to remove all series data from a highcharts chart?
More Query from same tag
- Interact with highcharts using jQuery?
- Browser hanged while plotting more than 10000 series using Highcharts
- Download Highcharts graph as image results in weird characters
- R Highcharter map with hc_motion
- How to bind to Highcharts constructor/listen to CustomEvents from Vue component
- Creating a bubble map from custom GeoJson with Highcharts / Highmaps
- Highcharts make percentage column chart
- How to align the legends in reactjs Highcharts
- highstock strange behavior scrollbar
- How do I set the highchart gantt headers as fixed when I scroll vertically
- adding font to highcharts editor
- Plotline (vertical line) in highcharts scatter chart
- Dynamically populated highcharts data and database storing
- Can't get drilldown module to work in highcharts in typescript
- Highcharts: showing tooltip with calculated value at Crosshair
- Highcharts Column w/ drilldown not working in Rails 4
- Highstock limit max zoom out
- Logarithmic axis not showing appropriate ticks for small numbers
- How do you add text to the bottom center of legend and bottom center of chart under legend?
- Retrieving JSON data in highcharts
- Is there any method to select only one series marker state in highcharts?
- Use of DotNet HighCharts dll to make charts in code behind
- Capturing webpage as image in c#, ensuring javascript rendered elements are visible
- Highcharts - how to display a chart with stacked and un-stacked columns side-by-side
- Highcharts: Bar chart: Label width : nowrap
- Is it possible to center the labels and data points between the ticks in a datetime xAxis for Highcharts?
- Highcharts - change border of a single data point in series
- Highcharts reflow does not work on class selector
- Color x , y Plotbands highcharts
- Highcharts Uncaught TypeError: Cannot set property 'day' of undefined