Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #require 'pry'
- #require 'oga'
- require 'nokogiri'
- require 'faraday'
- require 'faraday-cookie_jar'
- require 'timeout'
- conn = Faraday.new(:url => 'http://proxer.me') do |faraday|
- faraday.use :cookie_jar
- faraday.request :url_encoded # form-encode POST params
- # faraday.response :logger # log requests to STDOUT
- faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
- end
- conn.headers[:user_agent] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
- results = Array.new
- if ARGV.length >= 2
- username = ARGV[0]
- password = ARGV[1]
- else
- puts "USAGE: proxerInfo.rb proxerLogin proxerPassword"
- exit 0
- end
- status = Timeout::timeout(60) {
- begin
- response = conn.get '/'
- resp = conn.post '/register?format=json&action=login2', { 'username' => username,
- 'password' => password,
- 'secretkey' => '',
- 'remember' => '1'
- }
- response = conn.get '/components/com_proxer/misc/notifications_misc.php'
- #puts response
- document = Nokogiri::HTML(response.body)
- res = document.xpath('//*[@class="notificationList"]')
- res.to_a.each do |element|
- #binding.pry
- #p element.children.to_a[3].children.text + "::" + element.children.to_a[1].children.text + " ID:" + element.attributes["id"].value + " href:" + "proxer.me" + element.attributes["href"].value
- results.push [ element.children.to_a[3].children.text, element.children.to_a[1].children.text, element.attributes["id"].value, element.attributes["href"].value ]
- end
- rescue
- # proxer layout changed or response wasn't as expected
- end
- }
- p results
- # delete a notification
- # http://proxer.me/notifications?format=json&s=deleteNotification
- #id:9134993
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement