Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Al-quran 30 Juz 114 surah downloader reciter : Saad Al Ghamidi
require 'mechanize'
require 'nokogiri'
require 'active_support/all'
class SaadAlGhamidi
def initialize
@page_agent = Mechanize.new
@file_agent = Mechanize.new
@file_agent.pluggable_parser.default = Mechanize::Download
end
def lists
_index_page = @page_agent.get 'http://www.mp3quran.net/eng/s_gmd_english.html'
html = Nokogiri::HTML(_index_page.body)
@_list = []
_table = html.css('table')[1]
114.times do |i|
index = i + 2
tr_target = _table.at("tr:nth-child(#{index})")
@_list << {:file_name => "#{'%03d' % (index-1)} - #{tr_target.at('td:nth-child(2)').text.strip}.mp3", :url => tr_target.at('td:last-child a').attr('href') }
end
@_list
end
def download_all
lists.each do |list|
puts "-------> Downloading #{list[:file_name]}"
@file_agent.get(list[:url]).save("#{list[:file_name]}")
puts "<------- #{list[:file_name]} saved"
end
end
end
SaadAlGhamidi.new.download_all
@ridwanashiraf

This comment has been minimized.

Copy link

ridwanashiraf commented Jun 10, 2016

please i want kira'a full quran

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.