Guest User

Untitled

a guest
Feb 24th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.75 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. require './req_gemcook.rb'
  3.  
  4.  #ti = Time.new
  5.  #time = ti.strftime("%a-%m.%d.%Y-%I:%M%p")
  6.  
  7.  web = Watir::Browser.new :phantomjs
  8.  #web.goto "http://www58.zippyshare.com/v/72367277/file.html"
  9.  
  10.     DB = Sequel.connect('sqlite://clublandlv.sqlite')
  11.  
  12.     # its = DB[:subgenres___a].join(:songs___b, [:subgenre]).select(:subgenre)
  13.     # songsd = DB[:songsdown].join(:songs, [:song_id]).select(:song_id)
  14.       zippy_link = DB[:songsdown].select_map(:zippy_url)
  15.       songsdown = DB[:songsdown]
  16.  
  17.         #I make the script go to these three pages before the script starts because it seems
  18.         #that zippyshare loads a few ad pages in the session before letting you access their page.
  19.         web.goto "http://www58.zippyshare.com/v/72367277/file.html"
  20.         web.goto "http://www63.zippyshare.com/v/31341153/file.html"
  21.         web.goto "http://www66.zippyshare.com/v/91667079/file.html"
  22.  
  23. index = zippy_link
  24.           index.each do |zip|
  25.             webtitle = web.title
  26.             webtext = web.text
  27.  
  28.              web.goto(zip)
  29.               if webtitle.include? "Zippyshare.com"
  30.                 puts webtitle
  31.               else if
  32.                 puts "Placeholder link to get rid of the ad pages"
  33.  
  34.                   if webtext.include? "File has expired and does not exist anymore on this server"
  35.                     songsdown.where(:zippy_url => zip).update(:healthy => 0)
  36.                   else
  37.                     songsdown.where(:zippy_url => zip).update(:healthy => 1)
  38.                   end
  39.  
  40. =begin
  41.                 zippy = agent.page.search("div.left img").text
  42.                   puts zippy
  43.                     zipnew = zippy.href if zippy
  44.  
  45.               sleep(1)
  46. =end
  47.               end
  48.               end
  49.           end
Advertisement
Add Comment
Please, Sign In to add comment