Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require './req_gemcook.rb'
- #ti = Time.new
- #time = ti.strftime("%a-%m.%d.%Y-%I:%M%p")
- web = Watir::Browser.new :phantomjs
- #web.goto "http://www58.zippyshare.com/v/72367277/file.html"
- DB = Sequel.connect('sqlite://clublandlv.sqlite')
- # its = DB[:subgenres___a].join(:songs___b, [:subgenre]).select(:subgenre)
- # songsd = DB[:songsdown].join(:songs, [:song_id]).select(:song_id)
- zippy_link = DB[:songsdown].select_map(:zippy_url)
- songsdown = DB[:songsdown]
- #I make the script go to these three pages before the script starts because it seems
- #that zippyshare loads a few ad pages in the session before letting you access their page.
- web.goto "http://www58.zippyshare.com/v/72367277/file.html"
- web.goto "http://www63.zippyshare.com/v/31341153/file.html"
- web.goto "http://www66.zippyshare.com/v/91667079/file.html"
- index = zippy_link
- index.each do |zip|
- webtitle = web.title
- webtext = web.text
- web.goto(zip)
- if webtitle.include? "Zippyshare.com"
- puts webtitle
- else if
- puts "Placeholder link to get rid of the ad pages"
- if webtext.include? "File has expired and does not exist anymore on this server"
- songsdown.where(:zippy_url => zip).update(:healthy => 0)
- else
- songsdown.where(:zippy_url => zip).update(:healthy => 1)
- end
- =begin
- zippy = agent.page.search("div.left img").text
- puts zippy
- zipnew = zippy.href if zippy
- sleep(1)
- =end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment