I am trying to pull RSS feed in email and I only manage to fetch title, description & link but I couldn't able to fetch the image URL, maybe because it's enclosed within <media:content>
tag. I believe there is a way to call the values within this tag as I do for the rest of it.
It would be great if you can help me get the Image URL.
Here is the feed URL - https://www.oberlo.com/blog/feed
Here is the code I use
<div>
%%[
var @xml, @isXML, @nodes, @rowCount
Set @xml = HTTPGet("https://www.oberlo.com/blog/feed", false, 0, @CallStatus)
output(concat("<br>Call Status: ", @CallStatus))
if indexOf(@xml,"<channel>") > 0 then
set @nodes = BuildRowsetFromXML(@xml,"/rss/channel/item",0)
set @rowCount = rowcount(@nodes)
output(concat("<br>rowCount: ", @rowCount))
if @rowCount > 0 then
for @i = 1 to 5 do
var @title
var @description
var @link
var @Image
set @nodepath = concat("/rss/channel/item[",@i,"]/")
if rowcount(BuildRowsetFromXML(@xml,concat(@nodepath,"title"))) > 0 then
set @title = Field(Row(BuildRowsetFromXML(@xml,concat(@nodepath,"title"),0),1),'Value')
endif
if rowcount(BuildRowsetFromXML(@xml,concat(@nodepath,"description"))) > 0 then
set @description = Field(Row(BuildRowsetFromXML(@xml,concat(@nodepath,"description"),0),1),'Value')
endif
if rowcount(BuildRowsetFromXML(@xml,concat(@nodepath,"link"))) > 0 then
set @link = Field(Row(BuildRowsetFromXML(@xml,concat(@nodepath,"link"),0),1),'Value')
endif
if rowcount(BuildRowsetFromXML(@xml,concat(@nodepath, 'Image'))) > 0 then
set @Image = Field(Row(BuildRowsetFromXML(@xml,concat(@nodepath,"Image"),0),1),'image/jpeg')
endif
]%%
<h4>First Title - %%=v(@title)=%%</h4>
Description - %%=v(@description)=%%
<br>Link - <a href="%%=redirectto(@link)=%%">%%=v(@link)=%%</a>
<br>Image - %%=v(@Image)=%%
%%[
next @i
else
outputline(concat("<br>no items found"))
endif
else
outputline(concat("<br>no XML found"))
endif
]%%
</div>