diff --git a/libexec/quran-pull/quran.com b/libexec/quran-pull/quran.com deleted file mode 100755 index 4e652db..0000000 --- a/libexec/quran-pull/quran.com +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env ruby -lib_dir = File.realpath File.join(__dir__, "..", "..", "lib", "quran-pull") -require File.join(lib_dir, "pull") -require "optparse" -require "nokogiri" - -def grep(res) - html = Nokogiri::HTML(res.body) - el = html.css("div[class^='TranslationText']").last - el.text.gsub(/[0-9]/, "") -end - -## -# main -def main(argv) - cmd = Pull.new(Pull.cli(argv)) - cmd.keepalive do - 1.upto(114) do |surah_no| - rows = [] - 1.upto(cmd.count[surah_no]) do |ayah_no| - cmd.pull_ayah(surah_no, ayah_no) do |res| - rows.concat([ayah_no, grep(res)]) - end - cmd.line.rewind.print "Surah #{surah_no} [#{ayah_no}/#{cmd.count[surah_no]}]" - end - cmd.write(surah_no, rows) - cmd.line.end - end - end -end -main(ARGV) diff --git a/libexec/quran-pull/searchtruth.com b/libexec/quran-pull/searchtruth.com deleted file mode 100755 index 66de755..0000000 --- a/libexec/quran-pull/searchtruth.com +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env ruby -lib_dir = File.realpath File.join(__dir__, "..", "..", "lib", "quran-pull") -require File.join(lib_dir, "pull") -require "optparse" -require "nokogiri" - -def grep(res) - html = Nokogiri::HTML(res.body) - html.css("table[dir='rtl'] tr td div:last-child").map { _1.text.strip } -end - -## -# main -def main(argv) - cmd = Pull.new(Pull.cli(argv)) - cmd.keepalive do - 1.upto(114) do |surah_no| - rows = [] - cmd.pull_surah(surah_no) do |res| - rows.concat(grep(res).map.with_index(1) { [_2, _1] }) - end - cmd.line.rewind.print "Surah #{surah_no} [#{surah_no}/114]" - cmd.write(surah_no, rows) - end - cmd.line.end - end -end -main(ARGV)