Class: XvideosHelper::Crawler

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCrawler

Returns a new instance of Crawler.



8
9
10
11
12
13
# File 'lib/xvideos_helper/crawler.rb', line 8

def initialize
  @domain ||= Env::XVIDES_URL_WWW
  @iframe_url ||= Env::XVIDES_IFRAME_URL
  @movies_limit ||= -1
  @tags_limit ||= -1
end

Instance Attribute Details

#movies_limitObject

Returns the value of attribute movies_limit.



7
8
9
# File 'lib/xvideos_helper/crawler.rb', line 7

def movies_limit
  @movies_limit
end

#tags_limitObject

Returns the value of attribute tags_limit.



7
8
9
# File 'lib/xvideos_helper/crawler.rb', line 7

def tags_limit
  @tags_limit
end

Instance Method Details

#get_data_from(url, from) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/xvideos_helper/crawler.rb', line 15

def get_data_from(url,from)
  begin
    source = html(url)
    if from == 'movie'
      return parsed_movie_data(source)
    elsif from == 'taglist'
      return parsed_tag_data(source)
    else
      return {}
    end
  rescue Exception => e
    raise e
  end
end