xml - How to two different tags for images from different feeds as one single tag in yahoo pipes? -


i reading 3 or 4 news rss feeds different websites, , merging them in yahoo pipes. displaying 1 image each news item. facing 2 problems.

1> images provided in different tags in different feeds. different tags images are:

<media:content medium="image" url="http://metrouk2.files.wordpress.com/2013/08/1000x67025.jpg?w=150&amp;h=150&amp;crop=1"> <media:title type="html">liverpool v stoke city - premier league</media:title> </media:content> 

from feed:

<media:thumbnail height="340" link="" url="http://www.chelseafc.com/javaimages/4a/7c/0,,10268~12155978,00.jpg" width="640"/ 

and feed:

<enclosure length="150" type="image/jpeg" url="http://u.goal.com/187200/187249_thumb.jpg"/> 

2> in of feeds getting 3 or 4 media:content data , of them not images mp3 files.and image related news item not in fixed position. fourth media:content first.

for first issue, evaluating source , extracting information according source in client side dont want because add more feeds in future , dont want handle sources explicitly on client side.

for second issue helpless... displaying first media:content give me correct image not.

also point out, yahoo pipe executes , shows relevant images according news item in yahoo pipes panel.

i really struggling this. please point me right direction this.

the first problem easy. each input feed, use rename operator rename or copy dom elements unified format. after union modified input fields, can use unified names.

the second problem tricky. work around cases using rename + regex + loop(string builder) operators this:

  1. rename relevant fields, become easier work later, example:

    • rename item.div.div.0.div.div.a.href link0
    • rename item.div.div.1.div.div.a.href link1
    • rename item.div.div.2.div.div.a.href link2
    • ...
  2. using regex, try make irrelevant link0, link1 empty, example:

    • in item.link0 replace ^.*[^/]$ nothing
    • in item.link1 replace ^.*[^/]$ nothing
    • in item.link2 replace ^.*[^/]$ nothing
    • ...

    the right regex depend on use case. in example suitable make irrelevant elements empty.

  3. using loop, string builder inside, concatenate item.link0 , item.link1 , assign result item.link.

as result, whichever link0, link1, ... had right link, since others emptied, concatenated value right one.

it's hack, can work. actively use technique in of pipes. tricky part coming right regex make irrelevant values blank.


Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -