Class: Scrapper
- Inherits:
-
Object
- Object
- Scrapper
- Defined in:
- lib/app/scrapper.rb
Constant Summary collapse
- WIKIPEDIA =
"https://en.wikipedia.org/wiki/"- @@pastel =
Pastel.new
Class Method Summary collapse
- .binancecoin_history ⇒ Object
- .bitcoin_gold_history ⇒ Object
- .bitcoin_history ⇒ Object
- .brief_history_title(coin_title) ⇒ Object
- .cardano_history ⇒ Object
- .decentraland_history ⇒ Object
- .dogecoin_history ⇒ Object
- .ethereum_history ⇒ Object
- .get_page(url) ⇒ Object
- .iota_history ⇒ Object
- .litecoin_history ⇒ Object
- .loopring_history ⇒ Object
- .monero_history ⇒ Object
- .qtum_history ⇒ Object
- .ripple_history ⇒ Object
- .stellar_history ⇒ Object
- .text_iterator(scrapped_texts) ⇒ Object
- .tron_history ⇒ Object
- .webCryptoName(name) ⇒ Object
Class Method Details
.binancecoin_history ⇒ Object
45 46 47 |
# File 'lib/app/scrapper.rb', line 45 def self.binancecoin_history webCryptoName("Binancecoin") end |
.bitcoin_gold_history ⇒ Object
81 82 83 |
# File 'lib/app/scrapper.rb', line 81 def self.bitcoin_gold_history webCryptoName("Bitcoin_Gold") end |
.bitcoin_history ⇒ Object
37 38 39 |
# File 'lib/app/scrapper.rb', line 37 def self.bitcoin_history webCryptoName("Bitcoin") end |
.brief_history_title(coin_title) ⇒ Object
18 19 20 21 22 |
# File 'lib/app/scrapper.rb', line 18 def self.brief_history_title(coin_title) puts @@pastel.magenta.on_white.bold(" A Brief on #{coin_title.upcase}... ") end |
.cardano_history ⇒ Object
49 50 51 |
# File 'lib/app/scrapper.rb', line 49 def self.cardano_history webCryptoName("Cardano_(blockchain_platform)") end |
.decentraland_history ⇒ Object
77 78 79 |
# File 'lib/app/scrapper.rb', line 77 def self.decentraland_history webCryptoName("Decentraland") end |
.dogecoin_history ⇒ Object
61 62 63 |
# File 'lib/app/scrapper.rb', line 61 def self.dogecoin_history webCryptoName("Dogecoin") end |
.ethereum_history ⇒ Object
41 42 43 |
# File 'lib/app/scrapper.rb', line 41 def self.ethereum_history webCryptoName("Ethereum") end |
.get_page(url) ⇒ Object
24 25 26 27 |
# File 'lib/app/scrapper.rb', line 24 def self.get_page(url) html = URI.open(url) doc = Nokogiri::HTML(html) end |
.iota_history ⇒ Object
85 86 87 |
# File 'lib/app/scrapper.rb', line 85 def self.iota_history webCryptoName("IOTA_(technology)") end |
.litecoin_history ⇒ Object
73 74 75 |
# File 'lib/app/scrapper.rb', line 73 def self.litecoin_history webCryptoName("Litecoin") end |
.loopring_history ⇒ Object
57 58 59 |
# File 'lib/app/scrapper.rb', line 57 def self.loopring_history webCryptoName("Decentralized_finance") end |
.monero_history ⇒ Object
93 94 95 |
# File 'lib/app/scrapper.rb', line 93 def self.monero_history webCryptoName("Monero") end |
.qtum_history ⇒ Object
65 66 67 |
# File 'lib/app/scrapper.rb', line 65 def self.qtum_history webCryptoName("Quantum") end |
.ripple_history ⇒ Object
53 54 55 |
# File 'lib/app/scrapper.rb', line 53 def self.ripple_history webCryptoName("Ripple_(payment_protocol)") end |
.stellar_history ⇒ Object
89 90 91 |
# File 'lib/app/scrapper.rb', line 89 def self.stellar_history webCryptoName("Stellar_(payment_network)") end |
.text_iterator(scrapped_texts) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/app/scrapper.rb', line 29 def self.text_iterator(scrapped_texts) scrapped_texts.each do |t| puts @@pastel.magenta.on_white.bold(" #{t.text} ") end end |
.tron_history ⇒ Object
69 70 71 |
# File 'lib/app/scrapper.rb', line 69 def self.tron_history webCryptoName("Tron_(cryptocurrency)") end |
.webCryptoName(name) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/app/scrapper.rb', line 11 def self.webCryptoName(name) doc = get_page("https://en.wikipedia.org/wiki/#{name}") history = doc.css("div.mw-body-content.mw-content-ltr div.mw-parser-output p") brief_history_title(name.upcase) text_iterator(history[0..5]) end |