musicscrape 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/.travis.yml +7 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +47 -0
- data/README.md +4 -0
- data/VERSION +1 -0
- data/lib/musicscrape_spec.rb +40 -0
- data/lib/pruned.txt +184 -0
- data/lib/stranger.txt +2239 -0
- data/musicscrape-0.0.1.gem +0 -0
- data/musicscrape-0.0.2.gem +0 -0
- data/musicscrape-0.0.3.gem +0 -0
- data/musicscrape-0.0.4.gem +0 -0
- data/musicscrape.gemspec +71 -0
- data/rakefile.rb +36 -0
- metadata +91 -11
data/.DS_Store
ADDED
Binary file
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec", "~> 2.8.0"
|
10
|
+
gem "bundler"
|
11
|
+
gem "jeweler", "~> 1.8.4"
|
12
|
+
gem "cucumber"
|
13
|
+
gem "rest-client"
|
14
|
+
gem "gcal4ruby"
|
15
|
+
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
builder (3.1.4)
|
5
|
+
cucumber (1.2.1)
|
6
|
+
builder (>= 2.1.2)
|
7
|
+
diff-lcs (>= 1.1.3)
|
8
|
+
gherkin (~> 2.11.0)
|
9
|
+
json (>= 1.4.6)
|
10
|
+
diff-lcs (1.1.3)
|
11
|
+
gcal4ruby (0.5.5)
|
12
|
+
gdata4ruby (>= 0.1.5)
|
13
|
+
gdata4ruby (0.1.5)
|
14
|
+
gherkin (2.11.5)
|
15
|
+
json (>= 1.4.6)
|
16
|
+
git (1.2.5)
|
17
|
+
jeweler (1.8.4)
|
18
|
+
bundler (~> 1.0)
|
19
|
+
git (>= 1.2.5)
|
20
|
+
rake
|
21
|
+
rdoc
|
22
|
+
json (1.7.5)
|
23
|
+
mime-types (1.19)
|
24
|
+
rake (10.0.2)
|
25
|
+
rdoc (3.12)
|
26
|
+
json (~> 1.4)
|
27
|
+
rest-client (1.6.7)
|
28
|
+
mime-types (>= 1.16)
|
29
|
+
rspec (2.8.0)
|
30
|
+
rspec-core (~> 2.8.0)
|
31
|
+
rspec-expectations (~> 2.8.0)
|
32
|
+
rspec-mocks (~> 2.8.0)
|
33
|
+
rspec-core (2.8.0)
|
34
|
+
rspec-expectations (2.8.0)
|
35
|
+
diff-lcs (~> 1.1.2)
|
36
|
+
rspec-mocks (2.8.0)
|
37
|
+
|
38
|
+
PLATFORMS
|
39
|
+
ruby
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
bundler
|
43
|
+
cucumber
|
44
|
+
gcal4ruby
|
45
|
+
jeweler (~> 1.8.4)
|
46
|
+
rest-client
|
47
|
+
rspec (~> 2.8.0)
|
data/README.md
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.6
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/musicscrape"
|
2
|
+
|
3
|
+
describe Scrape do
|
4
|
+
before do
|
5
|
+
@scrape = Scrape.new(:web)
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
it "Should load the stranger music page" do
|
10
|
+
@scrape.load_page.should include '<title>Seattle Music'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "Should open a local file" do
|
14
|
+
@scrape.open_local.should_not eq nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it "Should get rid of everything except the recommended events" do
|
18
|
+
@scrape =Scrape.new(:local)
|
19
|
+
@pruned_test_file = open("#{File.dirname(__FILE__)}/pruned.txt", &:read)
|
20
|
+
@pruned_page = @scrape.remove_excess(@scrape.load_page)
|
21
|
+
@pruned_page[0..52].should eq "<h2 class=\"sitesection\">Recommended Music Events</h2>"
|
22
|
+
@pruned_page[-10..-1].should eq "<li class="
|
23
|
+
end
|
24
|
+
|
25
|
+
it "Should pick out the first event on my cached html file" do
|
26
|
+
@scrape =Scrape.new(:local)
|
27
|
+
@pruned_page = @scrape.remove_excess(@scrape.load_page)
|
28
|
+
@scrape.get_events(@pruned_page)[0].should == {:title=>"The Racer Sessions",:venue=>"Cafe Racer",:date => "Every Sun",:details =>"21+",}
|
29
|
+
end
|
30
|
+
|
31
|
+
it "Should run and create a valid Hash full of data on the live website and show it to me" do
|
32
|
+
@scrape = Scrape.new(:web)
|
33
|
+
@pruned_page = @scrape.remove_excess(@scrape.load_page)
|
34
|
+
@result = @scrape.get_events(@pruned_page)
|
35
|
+
@result.size.should_not eq nil
|
36
|
+
puts @result
|
37
|
+
puts @result[1][:details]
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/lib/pruned.txt
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
<h2 class="sitesection">Recommended Music Events</h2>
|
2
|
+
<ul class="recommend_list">
|
3
|
+
|
4
|
+
|
5
|
+
<li>
|
6
|
+
|
7
|
+
<a href="http://www.thestranger.com/seattle/Event?event=14551159&ms">
|
8
|
+
The Racer Sessions
|
9
|
+
</a><br/>
|
10
|
+
Cafe Racer<br />
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
Every Sun
|
16
|
+
|
17
|
+
<br />
|
18
|
+
21+
|
19
|
+
</li>
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
<li>
|
24
|
+
|
25
|
+
<a href="http://www.thestranger.com/seattle/Event?event=10114814&ms">
|
26
|
+
Michael Shrieve's Spellbinder
|
27
|
+
</a><br/>
|
28
|
+
The White Rabbit<br />
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
Every Mon
|
34
|
+
|
35
|
+
<br />$6
|
36
|
+
21+
|
37
|
+
</li>
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
<li>
|
42
|
+
|
43
|
+
<a href="http://www.thestranger.com/seattle/Event?event=14996435&ms">
|
44
|
+
Bukkake Bloodbath, Grim Ritual, Rye Wolves, Reficul and Panzergod
|
45
|
+
</a><br/>
|
46
|
+
2 Bit Saloon<br />
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
Mon Dec 10
|
52
|
+
|
53
|
+
<br />$8/$10
|
54
|
+
21+
|
55
|
+
</li>
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
<li>
|
60
|
+
|
61
|
+
<a href="http://www.thestranger.com/seattle/Event?event=15328258&ms">
|
62
|
+
Grave Babies, Baby Guns and Guests
|
63
|
+
</a><br/>
|
64
|
+
Crocodile<br />
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
Mon Dec 10
|
70
|
+
|
71
|
+
<br />$5
|
72
|
+
All Ages
|
73
|
+
</li>
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<li>
|
78
|
+
|
79
|
+
<a href="http://www.thestranger.com/seattle/Event?event=15285886&ms">
|
80
|
+
Nouela, Social Studies and Detective Agency
|
81
|
+
</a><br/>
|
82
|
+
Chop Suey<br />
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
Mon Dec 10
|
88
|
+
|
89
|
+
<br />$8
|
90
|
+
21+
|
91
|
+
</li>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<li>
|
96
|
+
|
97
|
+
<a href="http://www.thestranger.com/seattle/Event?event=14778063&ms">
|
98
|
+
Ty Segall and Night Beats
|
99
|
+
</a><br/>
|
100
|
+
Neumos<br />
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
Tue Dec 11
|
106
|
+
|
107
|
+
<br />$12
|
108
|
+
21+
|
109
|
+
</li>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<li>
|
114
|
+
|
115
|
+
<a href="http://www.thestranger.com/seattle/Event?event=15476862&ms">
|
116
|
+
Witches Titties, Gaydolf & Golden Showers, Jackie Hell and Guests
|
117
|
+
</a><br/>
|
118
|
+
Neumos<br />
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
Wed Dec 12
|
124
|
+
|
125
|
+
<br />
|
126
|
+
21+
|
127
|
+
</li>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
<li>
|
132
|
+
|
133
|
+
<a href="http://www.thestranger.com/seattle/Event?event=14778082&ms">
|
134
|
+
Kreayshawn, Rye Rye, Honey Cocaine and Chippy Nonstop
|
135
|
+
</a><br/>
|
136
|
+
Neumos<br />
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
Wed Dec 12
|
142
|
+
|
143
|
+
<br />$20
|
144
|
+
All Ages
|
145
|
+
</li>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<li>
|
150
|
+
|
151
|
+
<a href="http://www.thestranger.com/seattle/Event?event=14837484&ms">
|
152
|
+
Corrosion of Conformity
|
153
|
+
</a><br/>
|
154
|
+
Crocodile<br />
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
Wed Dec 12
|
160
|
+
|
161
|
+
<br />$18
|
162
|
+
All Ages
|
163
|
+
</li>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<li>
|
168
|
+
|
169
|
+
<a href="http://www.thestranger.com/seattle/Event?event=15285888&ms">
|
170
|
+
Mellowhype, Trash Talk and Guests
|
171
|
+
</a><br/>
|
172
|
+
Chop Suey<br />
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
Thu Dec 13
|
178
|
+
|
179
|
+
<br />$15
|
180
|
+
All Ages
|
181
|
+
</li>
|
182
|
+
|
183
|
+
|
184
|
+
<li class=
|