yahoo pipes regex extract hyperlink

54 views Asked by At

I am using Yahoo pipes to take an RSS feed from Reddit to later combine with other feeds.

The link for the item redirects back to Reddit. I would like it to redirect to the actual content.

In order for me to do so, I need to extract a hyperlink from item.description and replace item.link with it.

https://i.stack.imgur.com/kYJZf.png

I know that I need to use the Regex module to do this.

I've tried different variations of regex commands I've found elsewhere on Stack Overflow, but I can't get them to do what I need.

Would anyone know how I can replace item.link with the URL from item.description?

1

There are 1 answers

0
ron_g On

For anyone else struggling with the Yahoo pipes, this is how you do it

Start with the module for "Fetch Xpath"

Enter the URL, in this case https://www.reddit.com/r/unitedkingdom

Go to the URL and click "view source" in your browser (F12 in Chrome)

Select the path to the "frame" that holds all the Reddit posts. In this case it is: //*[@id="siteTable"]/div

Next module - "Create RSS"

Title: item.div.1.p.0.a.content

Link: item.div.1.p.0.a.href

By default, the Reddit link was "item.div.1.ul.li.0.a.href" which will direct you to the Reddit comments section, but the link to the content that I wanted was under "item.div.1.p.0.a.href".

This will then create an RSS feed with Title and then a link directly to the content, not the Reddit comments section.