Combining two nodes extracted with xpath

Firstly, apologies if my terminology of "nodes" is wrong!

I'm trying to create a full-text RSS feed for The Verge. I've used an example pipe I found but am amending it to use XPATH to extract the contents. The Verge has a header image that is outside of the main content so I use //div[contains(@class,'entry-content')] to select both the image and the main story.

The problem is that when I then try to add both of these nodes back in as the item.description of the RSS feed, only the image gets put in there. The story node goes missing. I've tested the code and it is definitely selecting both (and if I look in the debug console, I can see 0 and 1 corresponding to the image and the main story - it goes missing when I view the rss feed it creates). Is there a way to combine both into one node so that this will work?

The pipe in question is: http://pipes.yahoo.com/pipes/pipe.info?_id=93c002dc9550b8e93d81bc905c83d258.

Any help greatly appreciated!

5 Replies
  • Output the results of the Xpath Loop to something other than item.description - let's use item.blob. Then immediately follow that module with a Regex module using the rule

    In [item.description] replace [(?s)^.*] with [${blob.0}${blob.1}]

    Omit all []s.

  • Fantastic - thanks so much for this; it works perfectly.

    A couple of follow-up questions if you don't mind:

    • I might make more of these for other feeds and these might combine more than two elements. Is there a way of replacing [${blob.0}${blob.1}] with something that combines all elements, no matter how many? This is so I can make it generic?

    • This is a real OCD question but is there a way to remove the item.blob?

    Thanks again!

  • Using the RSS output from Pipes the element item.blob will not exist as 'blob' is not a valid RSS element name.

    At a simple level you can use ${blob.1}${blob.2}${blob.3} and so on. If ${blob.3} doesn't exist that will not be a problem.

    You could have a look at my blog - http://hapdaniel.wordpress.com/ but some of the blog posts are only relevant to Pipes V1 (which no longer exists).

  • Thanks again. Thinking about it, I should have really worked those two questions out for myself!

  • i want to learn how to automate with twitter by use pipes yahoo especially twitter participate in the trends and get morefollowers if you are accept my request


Recent Posts

in Pipes