Class: DMMCrawler::Ranking::AdultGameRanking
- Inherits:
-
BaseRanking
- Object
- BaseRanking
- DMMCrawler::Ranking::AdultGameRanking
- Includes:
- Attributes
- Defined in:
- lib/dmm-crawler/ranking/adult_game_ranking.rb
Constant Summary collapse
- FETCHING_LIMITATION =
20
- DLSOFT_URL =
'https://dlsoft.dmm.co.jp/'
Instance Method Summary collapse
- #arts ⇒ Object
-
#initialize(agent: Agent.instance.agent, term: nil) ⇒ AdultGameRanking
constructor
A new instance of AdultGameRanking.
Constructor Details
#initialize(agent: Agent.instance.agent, term: nil) ⇒ AdultGameRanking
Returns a new instance of AdultGameRanking.
11 12 13 14 15 |
# File 'lib/dmm-crawler/ranking/adult_game_ranking.rb', line 11 def initialize(agent: Agent.instance.agent, term: nil) @agent = discriminate_agent(agent) @term = term @url = URI.join(DLSOFT_URL, File.join('ranking', parameterized_term)) end |
Instance Method Details
#arts ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/dmm-crawler/ranking/adult_game_ranking.rb', line 17 def arts games = page.search('.rankingList-content .rankingList-item.fn-rankListItem').take(FETCHING_LIMITATION) arts = games.map do |game| sleep_each do url = game.search('.rankingList-link').first.attributes['href'].value AdultGameAttributes.new(url, agent: @agent).to_a end end arts.map.with_index(1) do |(title, title_link, main_image_url, sample_image_urls, submedia, , affiliateable, ), rank| { title: title, title_link: title_link, main_image_url: main_image_url, sample_image_urls: sample_image_urls, submedia: submedia, author: , rank: rank, affiliateable: affiliateable, tags: } end end |