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.

  • Also [the plugin recipe guide](http://code.sixapart.com/svn/mtplugins/trunk/ActionStreams/plugins/ActionStreams/doc/recipe-guide.txt) might be of some assistance

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1773 6162

Last Topic: Excluding categories from blog by kholechek on Feb 9, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1429 5077

Last Topic: What apocalypse hit this community in the middle of 2011? by 75th on Feb 10, 2012

695 2910

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

173 737

Last Topic: About the MT version stated in HTML source by Alex E. Schneider on Feb 7, 2012

190 567

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012