lib/saber/tracker/what.rb in saber-1.2.3 vs lib/saber/tracker/what.rb in saber-1.2.4
- old
+ new
@@ -1,9 +1,8 @@
module Saber
module Tracker
- # DON'T WORK for mechanize does not support javascript.
- class What < Base
+ class What < Gazelle
BASE_URL = "https://what.cd"
LOGIN_CHECK_PATH = "/inbox.php"
FIELDS = {
"E-Books" => {
@@ -14,31 +13,9 @@
"image" => :text,
"desc" => :text
}
}
- def do_upload(file, info)
- info["file_input"] = "#{file}.torrent"
- path = info["group_id"] ? "/upload.php?group_id=#{info['group_id']}" : "/upload.php"
-
- agent.get(path) {|p|
- ret = p.form_with(action: "") {|f|
- FIELDS[info.type].each {|k,t|
- f.set(t, k, info[k])
- }
- }.submit
-
- # error
- if ret.uri.path =~ %r~^/upload.php~
- msg = ReverseMarkdown.parse(ret.at("//*[@id='content']/div[2]/p[2]"))
- Saber.ui.error "ERROR:\n#{msg}"
- return false
- else
- return true
- end
- }
- end
-
protected
def do_login_with_username(username)
agent.get("/login.php") {|p|
ret = p.form_with(action: "login.php" ) {|f|