Class: Ubiquitously::BloggerDen::Post
- Inherits:
-
Service::Post
- Object
- Ubiquitously::Base
- Service::Post
- Ubiquitously::BloggerDen::Post
- Defined in:
- lib/ubiquitously/services/blogger_den.rb
Instance Attribute Summary
Attributes inherited from Service::Post
#captcha, #categories, #description, #downvotes, #extension, #format, #image, #kind, #must_be_unique, #privacy, #rating, #remote, #service_id, #service_url, #slug, #source, #source_url, #state, #status, #tags, #title, #token, #upvotes, #url, #user, #vote
Instance Method Summary collapse
Methods inherited from Service::Post
Methods included from Loggable::Post
Methods included from Restful::Post
Methods included from Postable::Post
Methods included from Ownable::Post
Methods inherited from Ubiquitously::Base
Methods included from SubclassableCallbacks
Constructor Details
This class inherits a constructor from Ubiquitously::Service::Post
Instance Method Details
#create ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ubiquitously/services/blogger_den.rb', line 23 def create # url page = agent.get("http://www.bloggerden.com/submit/") form = page.forms.detect {|form| form.form_node["id"] == "thisform"} form["url"] = url page = form.submit form = page.forms.detect {|form| form.form_node["id"] == "thisform"} form["title"] = title form["bodytext"] = description # 350 chars max form.(:name => "category").each do || .check if .value.to_s == "38" end iframe_url = page.parser.css("noscript iframe").first["src"] params = iframe_url.split("?").last captcha_iframe = agent.click(page.iframes.first) captcha_form = captcha_iframe.forms.first captcha_image = captcha_iframe.parser.css("img").first["src"] # open browser with captcha image system("open", "http://api.recaptcha.net/#{captcha_image}") # enter captcha response in terminal captcha_says = ask("Enter Captcha from Browser Image: ") { |q| q.echo = true } captcha_form["recaptcha_response_field"] = captcha_says # submit captcha captcha_form.action = "http://www.google.com/recaptcha/api/noscript?#{params}" captcha_response = captcha_form.submit # grab secret captcha_response = captcha_response.parser.css("textarea").first.text form["recaptcha_challenge_field"] = captcha_response form["recaptcha_response_field"] = "manual_challenge" page = form.submit unless debug? form = page.forms.detect {|form| form.form_node["id"] == "thisform"} page = form.submit end # has captcha, not done with this true end |
#tokenize ⇒ Object
19 20 21 |
# File 'lib/ubiquitously/services/blogger_den.rb', line 19 def tokenize super.merge(:title => self.title[0..120]) end |