An open API service indexing awesome lists of open source software.

https://github.com/jdennes/buienalarm

Super-simple library to scrape Buienalarm.nl for projected rainfall.
https://github.com/jdennes/buienalarm

dutch netherlands rainfall ruby weather

Last synced: 3 months ago
JSON representation

Super-simple library to scrape Buienalarm.nl for projected rainfall.

Awesome Lists containing this project

README

          

# buienalarm

This is a super-simple library to scrape [Buienalarm.nl](http://www.buienalarm.nl/) for projected rainfall.

Currently just provides the following interface for scraping projected rainfall for a location in the next two hours:

```rb
>> result = Buienalarm::Scraper.scrape("rotterdam")
=> {:location=>"Rotterdam", :rainfall=>[{:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}, {:time=>#, :rainfall=>0.0003924189758484536, :level=>"none"}]}
```

Also provides `script/scrape` to test this from the command line:

```
$ script/scrape rotterdam
===> Scraping Buienalarm.nl...

Projected rainfall for the next two hours in Rotterdam:

20:00 - 1.54mm/hour (heavy)
20:05 - 1.91mm/hour (heavy)
20:10 - 1.54mm/hour (heavy)
20:15 - 2.74mm/hour (heavy)
20:20 - 3.92mm/hour (heavy)
20:25 - 5.23mm/hour (heavy)
20:30 - 3.65mm/hour (heavy)
20:35 - 2.37mm/hour (heavy)
20:40 - 0.87mm/hour (moderate)
20:45 - 1.33mm/hour (heavy)
20:50 - 0.21mm/hour (moderate)
20:55 - 0.03mm/hour (light)
21:00 - 0.00mm/hour (none)
21:05 - 0.00mm/hour (none)
21:10 - 0.00mm/hour (none)
21:15 - 0.00mm/hour (none)
21:20 - 0.02mm/hour (light)
21:25 - 0.00mm/hour (none)
21:30 - 0.00mm/hour (none)
21:35 - 0.00mm/hour (none)
21:40 - 0.09mm/hour (light)
21:45 - 0.09mm/hour (light)
21:50 - 0.18mm/hour (moderate)
21:55 - 1.07mm/hour (heavy)
22:00 - 0.65mm/hour (moderate)
```

To work on this locally:

```
script/bootstrap
```

To run the tests:

```
script/test [test/test_file.rb]
```