Code: VBA WeatherUnderground.com SCRAPER (1 Viewer)

ironfelix717

Registered User.
Local time
Today, 06:11
Joined
Sep 20, 2019
Messages
193
Description:
This is a VBA scraper for pulling historic weather data for a specific day/month and location/station. WU is supposed to be a quite accurate data source for historic weather. In the past, they had an API. Since IBM bought them out, the API has since been restricted to a premium price upwards of thousands of dollars per month.

2 types of historical data can be pulled: hourly data for a specific day in history or daily data for a specific month in history. Data can be pulled to a VBA array or exported to CSV file. Code example in file. Data that is returned is: Temps, Humidty, Dewpoints, Times. Other data can be included with modifications of the code.

The option to query the returned data comes in 2 flavor: if scraping for Day data, specific hours can be returned. If scraping for month data, specific days can be returned. The query parameters are defined by whole integers representing hours or days as per previous statement.

The option to specify a weather station identifier (see WU website) can be passed to the object. Although, the ability to specify the 'Real Station' that the site used in it's own query can be returned from the data to ensure data accuracy. Some stations do not have data, but site will default to closest station to location.

See code example and notes.
Included:
WU_Scraper_v1_10_1_20.accdb

Requirements:
Selenium Basic (Dev version = v2.0.9.0) : Selenium for VBA

Latest chromedriver: chromedriver

Latest chromedriver.exe installed to: C:\Users\USERNAME\AppData\Local\SeleniumBasic

Latest verison of chrome (driver must match)

REFERENCES: Selenium Type Library, Microsoft HTML Object Library, Microsoft Scripting Runtime

Credits:
CREDIT AUTHOR
Python is OK, but VBA is so much more productive ;)
Thanks for the start to the above.

Disclaimer:
If serious bugs, will update as they are found. Code has been tested and is stable but has minimal err handling.
**Use responsibly, author is not liable for any misuse or inaccuracy of data!!!!

-IronFelix717
 

Attachments

  • WU_Scraper_v1_10_1_20.accdb
    752 KB · Views: 618

Users who are viewing this thread

Top Bottom