Class: Ryc

Inherits:
Object
  • Object
show all
Defined in:
lib/ryc.rb

Class Method Summary collapse

Class Method Details

.authorObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ryc.rb', line 19

def self.author
  begin
    page = Nokogiri::HTML(open("http://www.randomyoutubecomment.com/"))
    theauthor = page.css("div a + p")[0].text
    puts theauthor
  rescue OpenURI::HTTPError
    puts "Couldn't get the page - OpenURL::HTTPError"
    puts "Trying again..."
    retry
  end
end

.commentObject



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

.vidurlObject



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