rssyahoo-pipes

How to convert set of images to proper RSS description?


I am trying to build a RSS feed, so first I get the page with XPath Fetch Page (XPath is //div[@class='topic']/h2/a), then I Loop for each item and XPath Fetch Page again with URL equal to item.href and extract images there with XPath equal to //*[@id="topic"]/div[4]/div/div/a/img. In result I get a description, which contains set of images like:

0
  alt Sample title
  height 925
  src http://cdn.example.com/f2dd/3702212_6cddf28e.jpg
  style width:640px; height:925px;
  width 640
1
  alt Sample title
  height 920
  src http://cdn.example.com/1cc7/3702213_00acefab.jpg
  style width:640px; height:920px; 
  width 640
...

How should I convert it to one text string with a number of <img src="..."> elements? If I Loop thru each item (what is shown on the image below), then I get just one (first) element.

image


Solution

  • So you want to join / concatenate a list of images... I don't think there's an operator for that.

    The next best thing is a dirty hack like this:

    1. In your loops, assign to x instead of description
    2. Add a Regex operator with params:

      • in: item.description
      • replace: .*
      • with: ${x.0}${x.1}${x.2}${x.3}${x.4} (and so on)

    UPDATE

    As @LA_ commented, the replacement should be like this instead: <img src="${x.0.src}"><br><img src="${x.1.src}">