################################################################ # # ERINSBOROUGH # # Version 4.0 # Author: kaolincash, neuralwarp # Date: 17th September 2017 # Email: kaolin@maia.cash # # Special thanks to: the Tin Man, newmaritk1 # ################################################################ require 'open-uri' require 'net/ftp' require 'date' current_time = DateTime.now time = current_time.strftime "%d/%m/%Y %H:%M" tmpdir = 'tmp' tmpfile = tmpdir + '/tmp.tmp' unless Dir[tmpdir].empty? File.delete tmpfile Dir.rmdir tmpdir end ramsay = open('http://www.dailymotion.com/user/maritk3/search/Neighbours/1') text = ramsay.read.downcase text2 = text ramsay.close Dir.mkdir "tmp" path = "tmp" street = open("./tmp/tmp.tmp", "w") street.write ' Ramsay Street
' epNo = [] 5.times { puts video = text2.match(/title=\"Neighbours ([0-9]+)/) break unless video epNo += [$1] text2 = $' } id = [] 5.times { video = text.match(/\" href=\"\/video\/([a-z0-9]+)/) break unless video id += [$1] text = $' } id.reverse.each {|episode| street.write '

' } street.write '
' street.close ep1 = $2 ep5 = (ep1.to_i + 4).to_s #week = ep1 + "-" + ep5 week = epNo[0] + "-" + epNo[4] Dir.mkdir(path + "/" + week ,0644) uri = URI.parse('ftp://kaolincash:MEF8sT9JDB29unymLVi4CN6XIFeuY91@maia.cash/maia.cash/neighbours/' + week) ftp = Net::FTP.new ftp.connect(uri.host, uri.port) ftp.passive = true ftp.login(uri.user, uri.password) upload = path + "/" + week + "/" + "index.html" File.rename("./tmp/tmp.tmp", upload) ftp.mkdir(uri.path) ftp.chdir(uri.path) ftp.putbinaryfile(upload) ftp.close File.delete upload Dir.rmdir (path + "/" + week) Dir.rmdir path Dir.mkdir "tmp" path = "tmp" latest = open("./tmp/tmp.tmp", "w") latest.write 'document.write("Updated on: '+time+'")' latest.close Dir.mkdir(path + "/new" ,0644) uri = URI.parse('ftp://kaolincash:MEF8sT9JDB29unymLVi4CN6XIFeuY91@maia.cash/maia.cash/neighbours/') ftp = Net::FTP.new ftp.connect(uri.host, uri.port) ftp.passive = true ftp.login(uri.user, uri.password) upload = path + "/" + "latest.js" File.rename("./tmp/tmp.tmp", upload) ftp.mkdir(uri.path) ftp.chdir(uri.path) ftp.putbinaryfile(upload) ftp.close File.delete upload Dir.rmdir (path + "/new") Dir.rmdir path