default userpic

Need help creating new ActionStreams plugins

Vote 0 Votes

Could someone give me some pointers about creating a new ActionStreams plugin? I looked at the Amazon one, and think I grok it, but need some verification.

actionstreams: Amazon: wishlist: name: Wishlist description: My Amazon Wishlist htmlform: '[1] covets [3]' html_params: - url - title url: 'http://www.amazon.com/gp/registry/wishlist/{{ident}}' identifier: title scraper: foreach: 'td span.small b a' get: title: - a - TEXT url: - a - '@href'

That loops through the HTML on the wishlist page and finds everything that's in a sequence of td->span.small->b->a and pulls out the TEXT node in the link for the variable title, and pulls out the href attribute for url. What I don't get are the fields html_form and identifier. Could someone explain what those fields means in this context?

Reported on Movable Type 4.2

5 Replies

| Add a Reply
  • It all depends what you want your action stream to do. The Amazon one is parsing HTML to fill the fields, but you can also grab info from an XML file which uses a different technique entirely.

    First question is, are you reading an HTML page or an XML feed?

  • and to answer your question (sorry!), html_form is what is output as part of the stream and i believe identifier is how it determines if the entry is unique/new

  • HTML is what I'm parsing. I was wondering also if I can do conditional scrapes like something that says "if there isn't a series of TEXT before the link tag, then skip this selection." The reason I want that is that Slashdot's user comment table is badly formed and the only way to find the rate table element is to find one that has the text "attached to " before the link to the Slashdot post in it.

  • Well, the HTML scraper is based on scrAPI for Ruby (docs here: http://content.labnotes.org/rdoc/scrapi/) so that can guide you on how to format your code, however i would hazard a guess that what you are trying to do would require it's own module (like steam.pm for example) as it's a little more than the basic.

Add a Reply

Forum Groups

151 405

Last Topic: MT Interface Missing by Sherri on Nov 10, 2008

36 144

Last Topic: Installation can't finish by Drazend on Nov 10, 2008

34 93

Last Topic: Creating your own Plug-in by jondauz on Nov 5, 2008

10 33

Last Topic: new licensing confusion by Neil Epstein on Aug 14, 2008

code.sixapart.com

62 226

Last Topic: Callback after blog publishing. by Tomato Interactive on Oct 27, 2008

34 98

Last Topic: Ajax Rating Plugin by kiran on Oct 17, 2008