Class: Ryc
- Inherits:
-
Object
- Object
- Ryc
- Defined in:
- lib/ryc.rb
Class Method Summary collapse
Class Method Details
.author ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ryc.rb', line 19 def self. begin page = Nokogiri::HTML(open("http://www.randomyoutubecomment.com/")) = page.css("div a + p")[0].text puts rescue OpenURI::HTTPError puts "Couldn't get the page - OpenURL::HTTPError" puts "Trying again..." retry end end |
.comment ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ryc.rb', line 7 def self.comment begin page = Nokogiri::HTML(open("http://www.randomyoutubecomment.com/")) thecomment = page.css("div a p")[0].text puts thecomment rescue OpenURI::HTTPError puts "Couldn't get the page - OpenURL::HTTPError" puts "Trying again..." retry end end |
.vidurl ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ryc.rb', line 31 def self.vidurl begin page = Nokogiri::HTML(open("http://www.randomyoutubecomment.com/")) thevidurl = page.css("div p:nth-child(4) a")[0]["href"] puts thevidurl rescue OpenURI::HTTPError puts "Couldn't get the page - OpenURL::HTTPError" puts "Trying again..." retry end end |