Advertisement
sinulucky

Untitled

Feb 8th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.21 KB | None | 0 0
  1. require 'nokogiri'
  2. require 'open-uri'
  3. require 'byebug'
  4.  
  5. urltext = 'http://oploverz.in/page/%d'
  6.  
  7. links = []
  8.  
  9. (1..5).each do |i|
  10.     page = Nokogiri::HTML(open(urltext % i))
  11.     page.css('.dtl h2 a[href]').each do |line|
  12.         links << line.attr(:href)
  13.     end
  14. end
  15.  
  16. # oploverzs = []
  17.  
  18. links.each do |link|
  19.     page = Nokogiri::HTML(open(link))
  20.     name = page.css('.dtl h1').text.strip
  21.     sinops = page.css('.sinop p').text.strip
  22.    
  23.  
  24.  
  25.     smalls = []
  26.     linksm = page.css('.soraddl.op-download')[0..1]
  27.     lists = linksm.css('.soraurl.list-download')[0..5]
  28.     lista = lists.css('span strong a[href]')[0..21].each do |small|
  29.         smalls << small.attr(:href).strip.split(' | ')
  30.     end
  31.  
  32.     mediums = []
  33.     linkm = page.css('.soraddl.op-download')[0..1]
  34.     listm = linkm.css('.soraurl.list-download')[1..6]
  35.     listb = listm.css('span a[href]')[4..24].each do |medium|
  36.         mediums << medium.attr(:href).strip.split(' | ')
  37.     end
  38.    
  39.     hades = []
  40.     linkhade = page.css('.soraddl.op-download')[0]
  41.     listhade = linkhade.css('.soraurl.list-download')[3]
  42.     listhd = listhade.css('span a[href]').each do |hade|
  43.         hades << hade.attr(:href)
  44.     end
  45.    
  46.  
  47.     puts hades
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement