go_shawty 0.1.0
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/bin/console +14 -0
- data/bin/go_shawty +6 -0
- data/bin/setup +7 -0
- data/config/environment.rb +10 -0
- data/lib/go_shawty.rb +4 -0
- data/lib/go_shawty/celebrity_maker.rb +38 -0
- data/lib/go_shawty/celebrity_scraper.rb +19 -0
- data/lib/go_shawty/cli.rb +237 -0
- data/lib/go_shawty/lyric.rb +42 -0
- data/lib/go_shawty/version.rb +3 -0
- metadata +129 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 88ff5defaed66a6242632e96063ca8373af9ba8b
|
|
4
|
+
data.tar.gz: 5498878b927effdce14778ec4e894efe655ef8f0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 485b701df07a95ebb3120deaada6d1c75c5729887530da10bc7fa00432636ac5b92003b3e463617e2552e6809645955555ab4cc45504a4983e724ab4f3d8c942
|
|
7
|
+
data.tar.gz: 16127d63573009a618fbd1228b5c11c200b577fe2dcec8224e09cdcbcfe410a751503299e86ba3b69fa5c741ac01888534ce0eb2049e05cab471280cdbb3631d
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "go_shawty"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
require "pry"
|
|
11
|
+
Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start
|
data/bin/go_shawty
ADDED
data/bin/setup
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
require 'pry'
|
|
2
|
+
require 'nokogiri'
|
|
3
|
+
require 'open-uri'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
require_relative "../lib/go_shawty/version"
|
|
7
|
+
require_relative "../lib/go_shawty/cli"
|
|
8
|
+
require_relative "../lib/go_shawty/celebrity_scraper"
|
|
9
|
+
require_relative "../lib/go_shawty/celebrity_maker"
|
|
10
|
+
require_relative "../lib/go_shawty/lyric"
|
data/lib/go_shawty.rb
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
class GoShawty::CelebrityMaker
|
|
2
|
+
attr_accessor :age, :born, :died, :birthplace, :known, :bio
|
|
3
|
+
|
|
4
|
+
def initialize(age = nil, born = nil, died = "Died: N/A", birthplace = nil, known = nil, bio = nil)
|
|
5
|
+
@age = age
|
|
6
|
+
@born = born
|
|
7
|
+
@died = died
|
|
8
|
+
@birthplace = birthplace
|
|
9
|
+
@known = known
|
|
10
|
+
@bio = bio
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.scrape_celeb_page(url)
|
|
14
|
+
new_page = self.new
|
|
15
|
+
celeb_doc = Nokogiri::HTML(open(url))
|
|
16
|
+
celeb_doc.css("div.bio-info-div").each do |fact|
|
|
17
|
+
if
|
|
18
|
+
fact.text.include? "years"
|
|
19
|
+
new_page.age = fact.text
|
|
20
|
+
elsif
|
|
21
|
+
fact.text.include? "Born"
|
|
22
|
+
new_page.born = fact.text
|
|
23
|
+
elsif
|
|
24
|
+
fact.text.include? "Died"
|
|
25
|
+
new_page.died = fact.text
|
|
26
|
+
elsif
|
|
27
|
+
fact.text.include? "Birthplace"
|
|
28
|
+
new_page.birthplace = fact.text
|
|
29
|
+
elsif
|
|
30
|
+
fact.text.include? "known"
|
|
31
|
+
new_page.known = fact.text
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
new_page.bio = celeb_doc.css("div.bio-body p").text
|
|
35
|
+
new_page
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class GoShawty::CelebrityScraper
|
|
2
|
+
|
|
3
|
+
def self.scrape_bday_page(month, day)
|
|
4
|
+
url = "http://www.who2.com/born-on/#{month}-#{day}/?drupal_photo=true#"
|
|
5
|
+
celeb_page = Nokogiri::HTML(open(url))
|
|
6
|
+
celebrities = []
|
|
7
|
+
celeb_page.css("li.archive-list-item").each do |celebrity|
|
|
8
|
+
info = {
|
|
9
|
+
:name => celebrity.css("h3.entry-title a")[0].text,
|
|
10
|
+
:year => celebrity.css("span.h5 a").text,
|
|
11
|
+
:desc => celebrity.css("div.entry-summary").text.gsub(/(\t|\r|\n)/, ""),
|
|
12
|
+
:info_link => celebrity.css("h3.entry-title a")[0].attribute("href").value
|
|
13
|
+
}
|
|
14
|
+
celebrities << info
|
|
15
|
+
end
|
|
16
|
+
celebrities
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
class GoShawty::CLI
|
|
2
|
+
attr_accessor :month, :day
|
|
3
|
+
|
|
4
|
+
def call
|
|
5
|
+
puts "\n*** A Celebrity Birthday & A Curtis Jackson Lyric ***\n\n -----What more do you need?-----\n\n"
|
|
6
|
+
puts "Let's go, shawty, and find out who was born on ya birthday."
|
|
7
|
+
date_input
|
|
8
|
+
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
#####--GETTING THE USER BIRTHDAY--#####
|
|
12
|
+
|
|
13
|
+
def date_input
|
|
14
|
+
puts "\n** In what month were you born? (1-12)\n"
|
|
15
|
+
puts "1. Jan 7. Jul"
|
|
16
|
+
puts "2. Feb 8. Aug"
|
|
17
|
+
puts "3. Mar 9. Sept"
|
|
18
|
+
puts "4. Apr 10. Oct"
|
|
19
|
+
puts "5. May 11. Nov"
|
|
20
|
+
puts "6. June 12. Dec"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
input = gets.strip
|
|
24
|
+
case input
|
|
25
|
+
when "1"
|
|
26
|
+
@month = "january"
|
|
27
|
+
thirty_one_day_input
|
|
28
|
+
when "2"
|
|
29
|
+
@month = "february"
|
|
30
|
+
feb_day_input
|
|
31
|
+
when "3"
|
|
32
|
+
@month = "march"
|
|
33
|
+
thirty_one_day_input
|
|
34
|
+
when "4"
|
|
35
|
+
@month = "april"
|
|
36
|
+
thirty_day_input
|
|
37
|
+
when "5"
|
|
38
|
+
@month = "may"
|
|
39
|
+
thirty_one_day_input
|
|
40
|
+
when "6"
|
|
41
|
+
@month = "june"
|
|
42
|
+
thirty_day_input
|
|
43
|
+
when "7"
|
|
44
|
+
@month = "july"
|
|
45
|
+
thirty_one_day_input
|
|
46
|
+
when "8"
|
|
47
|
+
@month = "august"
|
|
48
|
+
thirty_one_day_input
|
|
49
|
+
when "9"
|
|
50
|
+
@month = "september"
|
|
51
|
+
thirty_day_input
|
|
52
|
+
when "10"
|
|
53
|
+
@month = "october"
|
|
54
|
+
thirty_one_day_input
|
|
55
|
+
when "11"
|
|
56
|
+
@month = "november"
|
|
57
|
+
thirty_day_input
|
|
58
|
+
when "12"
|
|
59
|
+
@month = "december"
|
|
60
|
+
thirty_one_day_input
|
|
61
|
+
when "exit"
|
|
62
|
+
goodbye
|
|
63
|
+
else
|
|
64
|
+
puts "Say what now?"
|
|
65
|
+
date_input
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def thirty_one_day_input
|
|
70
|
+
puts "\n** Sweet. What day? (1-31)"
|
|
71
|
+
input = gets.to_i
|
|
72
|
+
if input < 32 && input > 0
|
|
73
|
+
@day = input.to_s
|
|
74
|
+
generate_lyric
|
|
75
|
+
else
|
|
76
|
+
puts "Can you do that again for me?"
|
|
77
|
+
thirty_one_day_input
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def thirty_day_input
|
|
82
|
+
puts "\n** Sweet. What day? (1-30)"
|
|
83
|
+
input = gets.to_i
|
|
84
|
+
if input <31 && input > 0
|
|
85
|
+
@day = input.to_s
|
|
86
|
+
generate_lyric
|
|
87
|
+
else
|
|
88
|
+
puts "Can you do that again for me?"
|
|
89
|
+
thirty_day_input
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def feb_day_input
|
|
94
|
+
puts "\n** Sweet. What day? (1-29)"
|
|
95
|
+
input = gets.to_i
|
|
96
|
+
if input < 30 && input > 0
|
|
97
|
+
@day = input.to_s
|
|
98
|
+
generate_lyric
|
|
99
|
+
else
|
|
100
|
+
puts "Can you do that again for me?"
|
|
101
|
+
feb_day_input
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
#####--GIVING USER A LYRIC--#####
|
|
106
|
+
|
|
107
|
+
def generate_lyric
|
|
108
|
+
if month == "july" && day == "6"
|
|
109
|
+
curtis_bday_song
|
|
110
|
+
else
|
|
111
|
+
puts "\nOkay. Here's your 50 Cent Lyric that will guide you in your celebration:\n*****pretend he wrote it just for you*****"
|
|
112
|
+
bday_lyric = GoShawty::Lyric.new
|
|
113
|
+
puts"Song: #{bday_lyric.song_name}\n"
|
|
114
|
+
puts "#{bday_lyric.album_name}\n"
|
|
115
|
+
puts "\n\n#{bday_lyric.lines}\n"
|
|
116
|
+
list_celebrities
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
#####--GIVING USER A LIST OF CELEBS--#####
|
|
121
|
+
|
|
122
|
+
def list_celebrities
|
|
123
|
+
puts "\nAnd here are the celebrities who share your birthday! Celebrate together! Sing the lyric TOGETHER!!!\n"
|
|
124
|
+
generate_list
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def generate_list
|
|
128
|
+
array = GoShawty::CelebrityScraper.scrape_bday_page(month, day)
|
|
129
|
+
counter = 1
|
|
130
|
+
array.each do |i|
|
|
131
|
+
puts "#{counter}. #{i[:name]} born in #{i[:year]} - #{i[:desc]}\n"
|
|
132
|
+
counter += 1
|
|
133
|
+
end
|
|
134
|
+
puts "\n** Select the number of any person you'd like to learn more about, or you can pick a (D)ifferent date, or you can (E)xit and head to da club."
|
|
135
|
+
input = gets.strip
|
|
136
|
+
|
|
137
|
+
if /d/i === input
|
|
138
|
+
self.date_input
|
|
139
|
+
elsif /e/i === input
|
|
140
|
+
goodbye
|
|
141
|
+
elsif input.to_i <= array.length
|
|
142
|
+
more_info(input.to_i, array)
|
|
143
|
+
else
|
|
144
|
+
goodbye
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
#####--GIVE MORE INFO ABOUT CELEB--#####
|
|
149
|
+
def more_info(selector, array)
|
|
150
|
+
target_celeb_url = array[selector-1][:info_link]
|
|
151
|
+
know_more = GoShawty::CelebrityMaker.scrape_celeb_page(target_celeb_url)
|
|
152
|
+
|
|
153
|
+
puts "#{know_more.age}\n#{know_more.born}\n#{know_more.died}\n#{know_more.birthplace}"
|
|
154
|
+
puts "\n\n"
|
|
155
|
+
puts "#{know_more.bio}\n"
|
|
156
|
+
|
|
157
|
+
puts "\n** Do you want to know more about another (P)erson who shares this birthday, check on a (D)ifferent birthday, or (E)xit?"
|
|
158
|
+
|
|
159
|
+
input = gets.strip
|
|
160
|
+
|
|
161
|
+
if /p/i === input
|
|
162
|
+
list_celebrities
|
|
163
|
+
elsif /d/i === input
|
|
164
|
+
self.date_input
|
|
165
|
+
else
|
|
166
|
+
goodbye
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
#####--SPECIAL METHODS FOR JULY 6 BDAYS--#####
|
|
172
|
+
|
|
173
|
+
def curtis_bday_song
|
|
174
|
+
da_club = Nokogiri::HTML(open("http://www.allthelyrics.com/lyrics/50_cent/in_da_club_radio_edit-lyrics-899426.html"))
|
|
175
|
+
sing_along = da_club.css("div.content-text-inner p").text
|
|
176
|
+
puts "\n\nYou have the birthday of all birthdays. You share a birthday with Curtis Jackson. So sing with me now..."
|
|
177
|
+
puts"--------------------------------------------------------------------------------------------------------------------"
|
|
178
|
+
puts "#{sing_along}"
|
|
179
|
+
curtis
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def curtis
|
|
183
|
+
puts"July 6th is the birthday of you AND..."
|
|
184
|
+
puts "
|
|
185
|
+
+====================+ ~MMMMMMMMMMMMMMN~ DD7IIIIIII7II?7II7+.
|
|
186
|
+
MMMMMMMMMMMMMMMMMMMMMM ,MMMMMMMMMMMMMMMMMMMM, .+777$$7III7777777ZN$M?7I7:.
|
|
187
|
+
MMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMM~:I7777$$$$Z$77I777$M8MM$NNN7I.
|
|
188
|
+
MMMMMMMMMMMMMMMMMMMMMM MMMMMMNMMMMMMMMMMMMMMMM+I77$$$$$$$Z888$I7MIIMM77$ZIII,.
|
|
189
|
+
MMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMN?77$$$$$888888O888II$DMINNN77II.
|
|
190
|
+
MMMMMMMMMM MMMMMMMMMM MMMMMMMMMNMMMMMMMMMNDDD8888O8877ZM877777II.
|
|
191
|
+
MMMMMMMMMM MMMMMMMMMM MMMMMMMMMMMMNDDDDDDDDNMMND88$$88ZI7I77777I?.
|
|
192
|
+
MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM+IO88DDDDDD8DDMND8O?+D87I77777III.
|
|
193
|
+
MMMMMMMMMM .MMMMMMMM. MMMMMMMMMM MMONMMMMMM,=$888DDDDDDNNDDDNMD88OOO8$777777I?.
|
|
194
|
+
MMMMMMMMMMMMMMNMMMMMMM. MMMMMMMMMM MMMMMMMMM+:=?$ZZ8O8888DDDNNNMMND88888O77777Z7.
|
|
195
|
+
MMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMM MMMMMMMM7IDNNDOO+?77$$OODDDDNNMMN888OO8$I7$Z+.
|
|
196
|
+
MMMMMMMMMMMMMMMMMMMMNMM MMMMMMMMMM MMMMMMMO$8OODDDD8$$77ODDNDNDNMMMMMD88888O7ZO.
|
|
197
|
+
MMMMMMMMMMMMMMMMMMMMMMM NNMMMMMMMM MMMMMMMM=$ZZZ78NNDD8O8DDDDOZZODMMMMD88888OI?.
|
|
198
|
+
MMMMMMMMMM+ MMMMMMMMMM MMMMMMMMMM MMMMMMMM:7O$88ZODDO$OZ8DD$I7Z888NNMMN888O8$:.
|
|
199
|
+
MMMMMMMMMM MMMMMMMMMM MMMMMMMM?8MDOMDOD$ZOO88Z?DNMMND8DDNMMDD88OO~.
|
|
200
|
+
MNMMMMMMMM MMMMMMMMMM MMMMMMM$:=?$ZZOO77ZOOOOO8OD8D8D88DNNMMD888O:.
|
|
201
|
+
.MMMMMMMM. MMMMMNMMMM MMMMMMMMMM MMMMMMM.+??7I+?7?++7O8$I$I?I7$O8DDNNMMND88Z.
|
|
202
|
+
MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMM+$777$NDZII$$II$I?IIII$Z88DDDDMMD8$.
|
|
203
|
+
MMMMMMMMMM MMMMMMMMMM MMMMNMMMMM MMMMMMMI$$$$7$?DND$8N7DI?I777ZO8D888ZDNO7.
|
|
204
|
+
MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMMI7Z$777D8Z$O8ZZZ7?I77ZOD88OOZD$Z~.
|
|
205
|
+
MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMM??ZO$O87I8IDND8OZ77$7O88D88OD87D+,.
|
|
206
|
+
MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMM??$78$DOZZZZZZD888OZO88DD88ND$O$O~.
|
|
207
|
+
MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMM7IIDDNNI~=~INDO8ND8888DDDDNMDI$77..
|
|
208
|
+
MMMMMMMMMM MMMMMMMMMM MMMMMMMMMM MMMMMMM8IIDD$7~~::~IZ8OD8D8DDDDDMNN8?Z+...
|
|
209
|
+
MMMMMMMMMMMMMMMMMMMMMMM +MMMMMMMMMMMMMMMMMMMD8$M8OO$7??$$OO8NDDNNNNNMMMN$7.....
|
|
210
|
+
8MMMMMMMMMNMMMMMNNMMMMN MMMMMMMMMMMMMMMMMNMMONND78DDDN88888DMMNNMNMMMND7O.....,.
|
|
211
|
+
MMMMMMMMNMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMOZ$DDDDNND888D88MNNNMMMMMNO$I.......
|
|
212
|
+
$NMMMMMMMMMNMMMMMMM MMMMMMMMMMMMMMMMMM.77NNNNDDD8DDDDNNMMMMMMMMN87$..~.....
|
|
213
|
+
,8DMMMNMMMMMMNMMMMMMMMMNN87.,..I .
|
|
214
|
+
.MMMMMMMMMM. MMMMMMMM MMMMI MMM MMMMMMMMMMM. 8MMMMMMMMMMMMMMMMMMMMMMNO.,.... ......
|
|
215
|
+
8MMMMMMMMMMN MMMMMMMM MMMMMI MMM MMMMMMMMMMM ,.ZMMMMMMMMMMMMMNNNMMMMM~=:,..........
|
|
216
|
+
MMMM MMMM MMMM MMMMMM? MMM MMMMM ,=,OMMNNMNNNNNDDDNNNMMM~,.,...I$8Z:.....
|
|
217
|
+
MMMM MMMMMMMM MMMMMMM. MMM MMMMM ..,?,NNNNMMMNNMN8DDNDO.:7.,..,,.. ,Z7Z,.....
|
|
218
|
+
MMMM MMMMMMMM MMMMMMMMMMMM MMMMM ...,=OMNNNNNNMNDD7....:I,,,.:,=.....,:,...:+..
|
|
219
|
+
MMMM MMMM MMMM`MMMMMMM MMMMM ..?7NNNNNNND.......~I,,,,..,,,...,.......?=.
|
|
220
|
+
MMMM MMMM MMMM MMMM `MMMMMM MMMMM ...=?DDD8,.. .....:.+,,,,.,,....,:........7:..
|
|
221
|
+
8MMMMMMMMMMN MMMMMMMM MMMM MMMMM MMMMM .....:.............,,.7,,,,..,....................
|
|
222
|
+
MMMMMMMMMM MMMMMMMM MMMM MMMM MMMMM .....:,.. ......,,..,,7.,,,........................
|
|
223
|
+
....,.:........,...,:.+,,,............................
|
|
224
|
+
.:.,.=:...........,=~7.,............:..........,......
|
|
225
|
+
.......,..,:...........,,7I,..............,......,,.,.......
|
|
226
|
+
.....,,..:I...........,~?,,,,.............,....,...:........"
|
|
227
|
+
|
|
228
|
+
puts "\n...and if you need to know who else..."
|
|
229
|
+
generate_list
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
def goodbye
|
|
233
|
+
puts"Aight. C-ya at da club."
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
class GoShawty::Lyric
|
|
2
|
+
attr_accessor :album_name, :song_name, :lines
|
|
3
|
+
|
|
4
|
+
def initialize
|
|
5
|
+
song_number = 1 +rand(6)
|
|
6
|
+
get_lyric(song_number)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_lyric(song_number)
|
|
11
|
+
|
|
12
|
+
url = ""
|
|
13
|
+
lyric_array = []
|
|
14
|
+
|
|
15
|
+
case song_number
|
|
16
|
+
when 1
|
|
17
|
+
url = "http://www.allthelyrics.com/lyrics/50_cent/in_da_club_radio_edit-lyrics-899426.html"
|
|
18
|
+
lyric_array = [0,1,2,4,5,7]
|
|
19
|
+
when 2
|
|
20
|
+
url = "http://www.allthelyrics.com/lyrics/50_cent/candy_shop_feat_olivia-lyrics-221387.html"
|
|
21
|
+
lyric_array = [0,1,2,4,5]
|
|
22
|
+
when 3
|
|
23
|
+
url = "http://www.allthelyrics.com/lyrics/50_cent/21_questions-lyrics-751.html"
|
|
24
|
+
lyric_array = [1,2,3,4,5,6,7]
|
|
25
|
+
when 4
|
|
26
|
+
url = "http://www.allthelyrics.com/lyrics/50_cent/pimp_radio_edit-lyrics-899432.html"
|
|
27
|
+
lyric_array = [1,2,4,6,8]
|
|
28
|
+
when 5
|
|
29
|
+
url = "http://www.allthelyrics.com/lyrics/50_cent/just_a_lil_bit_radio-lyrics-1158816.html"
|
|
30
|
+
lyric_array = [0,1,2,3,4,5,6]
|
|
31
|
+
when 6
|
|
32
|
+
url = "http://www.allthelyrics.com/lyrics/50_cent/if_i_cant_clean_version-lyrics-559991.html"
|
|
33
|
+
lyric_array = [0,1,2,3,4,5,6,7,8,9]
|
|
34
|
+
end
|
|
35
|
+
scraped_lyrics = Nokogiri::HTML(open(url))
|
|
36
|
+
lyric_selection = lyric_array.sample
|
|
37
|
+
@lines = scraped_lyrics.css("div.content-text-inner p")[lyric_selection].text
|
|
38
|
+
@song_name = scraped_lyrics.css("div.clear-block h1.page-title").text
|
|
39
|
+
@album_name = scraped_lyrics.css("div.content-text-album").text
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: go_shawty
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Douglas Lawrence
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-03-19 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.11'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.11'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rs
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: pry
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: nokogiri
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
description: Enter your birthday and get info on some celebrities who share that bday,
|
|
84
|
+
the celebrate with a 50 Cent lyric. Huzzah!
|
|
85
|
+
email:
|
|
86
|
+
- douglaslawrence314@gmail.com
|
|
87
|
+
executables:
|
|
88
|
+
- console
|
|
89
|
+
- go_shawty
|
|
90
|
+
- setup
|
|
91
|
+
extensions: []
|
|
92
|
+
extra_rdoc_files: []
|
|
93
|
+
files:
|
|
94
|
+
- bin/console
|
|
95
|
+
- bin/go_shawty
|
|
96
|
+
- bin/setup
|
|
97
|
+
- config/environment.rb
|
|
98
|
+
- lib/go_shawty.rb
|
|
99
|
+
- lib/go_shawty/celebrity_maker.rb
|
|
100
|
+
- lib/go_shawty/celebrity_scraper.rb
|
|
101
|
+
- lib/go_shawty/cli.rb
|
|
102
|
+
- lib/go_shawty/lyric.rb
|
|
103
|
+
- lib/go_shawty/version.rb
|
|
104
|
+
homepage: https://github.com/lawrend/go-shawty-cli-gem
|
|
105
|
+
licenses:
|
|
106
|
+
- MIT
|
|
107
|
+
metadata: {}
|
|
108
|
+
post_install_message:
|
|
109
|
+
rdoc_options: []
|
|
110
|
+
require_paths:
|
|
111
|
+
- lib
|
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
|
+
requirements:
|
|
114
|
+
- - ">="
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '0'
|
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
|
+
requirements:
|
|
119
|
+
- - ">="
|
|
120
|
+
- !ruby/object:Gem::Version
|
|
121
|
+
version: '0'
|
|
122
|
+
requirements: []
|
|
123
|
+
rubyforge_project:
|
|
124
|
+
rubygems_version: 2.4.8
|
|
125
|
+
signing_key:
|
|
126
|
+
specification_version: 4
|
|
127
|
+
summary: Celebrity Birthdays and a Random 50 Cent Lyric
|
|
128
|
+
test_files: []
|
|
129
|
+
has_rdoc:
|