berklee-valencia 0.2.0 → 0.2.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 +4 -4
- data/lib/berklee_valencia/cli.rb +13 -13
- data/lib/berklee_valencia/scraper.rb +3 -3
- data/lib/berklee_valencia/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eafbb386ffe054edb73abbb91ed4f522d5b5a613b31b521c3df9a56c2cf5cd84
|
|
4
|
+
data.tar.gz: 59a22587e6c466537fdeee522a3fe05ebe01d9b920fea132ab0819c07c1a4d10
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e9401d049d1ead5b2dbbba092ba0c067d108be9f107782ac62c822dc3764e55c995c8347c61789a371379e8112300462fffdaa6b291fac2b5f5805df62ff970
|
|
7
|
+
data.tar.gz: 41ee797c9ff72becd71f6bbbfc03ccbeffa0bd66b64d590ded839485bf2b863b11e39623915b8d044e1ab4065b1a438cef0f42a03bee35156f19aa5955cebd6b
|
data/lib/berklee_valencia/cli.rb
CHANGED
|
@@ -33,9 +33,7 @@ class BerkleeValencia::CLI
|
|
|
33
33
|
|
|
34
34
|
def programs_or_news
|
|
35
35
|
input = gets.strip.downcase
|
|
36
|
-
if input.
|
|
37
|
-
goodbye
|
|
38
|
-
elsif input == "1" || input == "2"
|
|
36
|
+
if input.to_i.between?(1,2)
|
|
39
37
|
please_wait
|
|
40
38
|
case input
|
|
41
39
|
when "1"
|
|
@@ -44,7 +42,7 @@ class BerkleeValencia::CLI
|
|
|
44
42
|
list_programs
|
|
45
43
|
end
|
|
46
44
|
else
|
|
47
|
-
|
|
45
|
+
if_not_that_then_this(input)
|
|
48
46
|
end
|
|
49
47
|
end
|
|
50
48
|
|
|
@@ -63,10 +61,8 @@ class BerkleeValencia::CLI
|
|
|
63
61
|
show_program(input)
|
|
64
62
|
elsif input == "news"
|
|
65
63
|
list_article_categories
|
|
66
|
-
elsif input.match(/hasta luego|exit|bye|ciao/)
|
|
67
|
-
goodbye
|
|
68
64
|
else
|
|
69
|
-
|
|
65
|
+
if_not_that_then_this(input)
|
|
70
66
|
end
|
|
71
67
|
end
|
|
72
68
|
|
|
@@ -96,10 +92,8 @@ class BerkleeValencia::CLI
|
|
|
96
92
|
list_articles(input)
|
|
97
93
|
elsif input == "programs"
|
|
98
94
|
list_programs
|
|
99
|
-
elsif input.match(/hasta luego|exit|bye|ciao/)
|
|
100
|
-
goodbye
|
|
101
95
|
else
|
|
102
|
-
|
|
96
|
+
if_not_that_then_this(input)
|
|
103
97
|
end
|
|
104
98
|
end
|
|
105
99
|
|
|
@@ -117,10 +111,8 @@ class BerkleeValencia::CLI
|
|
|
117
111
|
show_article(category, input)
|
|
118
112
|
elsif input == "menu"
|
|
119
113
|
programs_or_news
|
|
120
|
-
elsif input.match(/hasta luego|exit|bye|ciao/)
|
|
121
|
-
goodbye
|
|
122
114
|
else
|
|
123
|
-
|
|
115
|
+
if_not_that_then_this(input)
|
|
124
116
|
end
|
|
125
117
|
end
|
|
126
118
|
|
|
@@ -154,6 +146,14 @@ class BerkleeValencia::CLI
|
|
|
154
146
|
programs_or_news
|
|
155
147
|
end
|
|
156
148
|
|
|
149
|
+
def if_not_that_then_this(input)
|
|
150
|
+
if input.match(/hasta luego|exit|bye|ciao/)
|
|
151
|
+
goodbye
|
|
152
|
+
else
|
|
153
|
+
say_what
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
157
|
def say_what
|
|
158
158
|
puts ""
|
|
159
159
|
puts "Sorry, I didn't understand that!"
|
|
@@ -3,7 +3,7 @@ class BerkleeValencia::SCRAPER
|
|
|
3
3
|
@@bv_programs = "https://valencia.berklee.edu/academic-programs/"
|
|
4
4
|
|
|
5
5
|
def self.make_programs
|
|
6
|
-
course_types = Nokogiri::HTML(open(@@bv_programs)).css("div.col-3-5")
|
|
6
|
+
course_types = Nokogiri::HTML(open(@@bv_programs, :allow_redirections => :all)).css("div.col-3-5")
|
|
7
7
|
course_types.each do |type|
|
|
8
8
|
type.css("ul a").each do |program|
|
|
9
9
|
attributes = {
|
|
@@ -18,7 +18,7 @@ class BerkleeValencia::SCRAPER
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def self.make_articles
|
|
21
|
-
articles = Nokogiri::HTML(open(@@bv_news))
|
|
21
|
+
articles = Nokogiri::HTML(open(@@bv_news, :allow_redirections => :all))
|
|
22
22
|
articles.css("div#news_container div.content").each do |article|
|
|
23
23
|
attributes = {
|
|
24
24
|
title: article.css("div.news_excerpt h3 a").text,
|
|
@@ -32,7 +32,7 @@ class BerkleeValencia::SCRAPER
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def self.get_article_extended_info(url)
|
|
35
|
-
article = Nokogiri::HTML(open(url))
|
|
35
|
+
article = Nokogiri::HTML(open(url, :allow_redirections => :all))
|
|
36
36
|
extended_info = {
|
|
37
37
|
author: article.css("span.author").text,
|
|
38
38
|
related_links: [],
|