owasp_ri_scraper 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/lib/owasp_ri_scraper/event.rb +6 -0
- data/lib/owasp_ri_scraper/event_parser.rb +26 -0
- data/lib/owasp_ri_scraper/homepage.rb +15 -0
- data/lib/owasp_ri_scraper/version.rb +3 -0
- data/lib/owasp_ri_scraper.rb +13 -0
- data/owasp_ri_scraper.gemspec +28 -0
- data/spec/fixtures/Rhode_Island +463 -0
- data/spec/owasp_ri_scraper/event_parser_spec.rb +26 -0
- data/spec/owasp_ri_scraper/homepage_spec.rb +12 -0
- data/spec/owasp_ri_scraper_spec.rb +19 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/vcr/OwaspRiScraper_Homepage/_content/fetches_the_body_content_from_the_EOL_Club_homepage.yml +789 -0
- data/spec/vcr/OwaspRiScraper_Homepage/_content/fetches_the_body_content_from_the_OWASP_RI_homepage.yml +789 -0
- metadata +169 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dbf591f8e7127156b0284bd8e90405b1b70c2594
|
4
|
+
data.tar.gz: b9a94cc3fa74f108e9fcc5e39ec266f6c85e63ba
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ba1d7e7e287385968d6daa232e8c8a3819b9ea13d41edc006b62cea31e17d67d5737a7c28161003d8731eecf1440d6781d78dfa19c4ba8ea9af375a56cb5286f
|
7
|
+
data.tar.gz: 623efca2c9475006e39cda9c6bb3055dbd845ce1476ff1c6f9965365a5ff93a5ba38d6277dfae523e03583fe5c13f9d85d01222fbcc343665810cfdf59d23a1d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Matt Gillooly
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# OwaspRiScraper
|
2
|
+
|
3
|
+
Scrape currently scheduled event from [OWASP RI](https://www.owasp.org/index.php/Rhode_Island).
|
4
|
+
Built for automating updates to [PVDTechEvents.com](http://pvdtechevents.com/).
|
5
|
+
|
6
|
+
NOTE: Current implementation is extremely fragile, and will very likely break if any changes are made to the source page's layout.
|
7
|
+
Use at your own risk.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'owasp_ri_scraper'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install owasp_ri_scraper
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'owasp_ri_scraper'
|
27
|
+
event = OwaspRiScraper.scheduled_event
|
28
|
+
event.start_time #=> 2014-02-12 17:45:00 -0500
|
29
|
+
```
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork it
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'owasp_ri_scraper/event'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
module OwaspRiScraper
|
5
|
+
|
6
|
+
class EventParser
|
7
|
+
|
8
|
+
# This method is extremely fragile, but so far OWASP.org has been sticking to
|
9
|
+
# the same format, so that may be okay.
|
10
|
+
def parse(content)
|
11
|
+
doc = Nokogiri::HTML.parse(content)
|
12
|
+
event_node = doc.css('div#mw-content-text pre').first
|
13
|
+
|
14
|
+
start_time = event_node.css('b').text
|
15
|
+
description = event_node.children.select(&:text?).map(&:text).join("\n").strip
|
16
|
+
|
17
|
+
Event.new(
|
18
|
+
Time.parse(start_time),
|
19
|
+
nil,
|
20
|
+
description
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "owasp_ri_scraper/version"
|
2
|
+
require "owasp_ri_scraper/homepage"
|
3
|
+
require "owasp_ri_scraper/event_parser"
|
4
|
+
|
5
|
+
module OwaspRiScraper
|
6
|
+
|
7
|
+
def self.scheduled_event
|
8
|
+
homepage = Homepage.new
|
9
|
+
parser = EventParser.new
|
10
|
+
parser.parse(homepage.content)
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'owasp_ri_scraper/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "owasp_ri_scraper"
|
8
|
+
spec.version = OwaspRiScraper::VERSION
|
9
|
+
spec.authors = ["Matt Gillooly"]
|
10
|
+
spec.email = ["matt@mattgillooly.com"]
|
11
|
+
spec.description = %q{Scrape currently scheduled event from OWASP.org for PVDTechEvents.com}
|
12
|
+
spec.summary = %q{OWASP.org event scraper}
|
13
|
+
spec.homepage = "http://pvdtechevents.com/"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'nokogiri'
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_development_dependency "vcr"
|
26
|
+
spec.add_development_dependency "webmock"
|
27
|
+
spec.add_development_dependency "timecop"
|
28
|
+
end
|