standardrb: fix.
This commit is contained in:
parent
39a37b6887
commit
9263c5366a
2 changed files with 23 additions and 27 deletions
|
@ -35,7 +35,7 @@ end
|
||||||
def get_request(path, htm_file)
|
def get_request(path, htm_file)
|
||||||
Net::HTTP::Get.new(
|
Net::HTTP::Get.new(
|
||||||
format(path, htm_file: htm_file),
|
format(path, htm_file: htm_file),
|
||||||
'Accept' => 'text/html'
|
"Accept" => "text/html"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,14 +43,14 @@ end
|
||||||
# Helper method.
|
# Helper method.
|
||||||
def extract_verses!(res, rows)
|
def extract_verses!(res, rows)
|
||||||
doc = Nokogiri::HTML(res.body)
|
doc = Nokogiri::HTML(res.body)
|
||||||
verses = doc.css('table tr td p[align=RIGHT]')
|
verses = doc.css("table tr td p[align=RIGHT]")
|
||||||
|
|
||||||
verses.each do |verse|
|
verses.each do |verse|
|
||||||
verse_num = Integer(verse.css('a').inner_text)
|
verse_num = Integer(verse.css("a").inner_text)
|
||||||
verse_txt = verse.text.delete(verse_num.to_s)
|
verse_txt = verse.text.delete(verse_num.to_s)
|
||||||
rows.push([
|
rows.push([
|
||||||
verse_num,
|
verse_num,
|
||||||
verse_txt.gsub("\u200F", "").gsub("\u200E", "").strip
|
verse_txt.delete("\u200F").delete("\u200E").strip
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -74,5 +74,3 @@ end
|
||||||
print Paint["Chill for #{cool_off} seconds", :blue, :bold], "\n", "\n"
|
print Paint["Chill for #{cool_off} seconds", :blue, :bold], "\n", "\n"
|
||||||
sleep cool_off
|
sleep cool_off
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ http.use_ssl = true
|
||||||
def get_request(path, chapter_num, verse_num)
|
def get_request(path, chapter_num, verse_num)
|
||||||
Net::HTTP::Get.new(
|
Net::HTTP::Get.new(
|
||||||
format(path, chapter_num:, verse_num:),
|
format(path, chapter_num:, verse_num:),
|
||||||
'Accept' => 'text/html'
|
"Accept" => "text/html"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ end
|
||||||
when Net::HTTPOK
|
when Net::HTTPOK
|
||||||
doc = Nokogiri::HTML(res.body)
|
doc = Nokogiri::HTML(res.body)
|
||||||
el = doc.css("div[class^='TranslationText']").last
|
el = doc.css("div[class^='TranslationText']").last
|
||||||
text = el.text.gsub(/[0-9]/, '')
|
text = el.text.gsub(/[0-9]/, "")
|
||||||
rows.push([verse_num, text])
|
rows.push([verse_num, text])
|
||||||
print Paint["OK: ", :green, :bold], text, "\n"
|
print Paint["OK: ", :green, :bold], text, "\n"
|
||||||
else
|
else
|
||||||
|
@ -52,5 +52,3 @@ end
|
||||||
File.write(final_dest, JSON.pretty_generate(rows))
|
File.write(final_dest, JSON.pretty_generate(rows))
|
||||||
print Paint["OK: ", :green, :bold], final_dest, "\n"
|
print Paint["OK: ", :green, :bold], final_dest, "\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue