PDA

View Full Version : Rss Feed Manager - Including Images from Craigslist


edgespeeder04
02-05-2015, 01:12 AM
Using the Vbulletin RSS Feed Manager, I'm trying to pull images (if available) from Craigslist ads but I'm having a hard time figuring out the right fieldname to make it happen.

Below is the snipet from the feed I'm pulling...any ideas? I greatly appreciate it thank you.

<enc:enclosure resource="http://images.craigslist.org/00f0f_491SwIpTU8b_300x300.jpg" type="image/jpeg"/>

kh99
02-05-2015, 12:16 PM
Did you try {feed:enc:enclosure}? I'm not sure if that will work or not, I haven't had a chance to try it myself.

Edit: actually you might try {feed:enc:enclosure:location}.

kh99
02-05-2015, 01:01 PM
Well, I tried it but unfortunately I don't see a way to access the image url without changing the code or creating a plugin. So, I created this plugin using hook location rssposter_parse_rss:
$handled = array('link', 'description', 'title', 'id', 'guid', 'pubDate', 'date', 'enclosure_link', 'enclosure_href', 'content', 'content:encoded', 'author', 'dc:creator');

if (!in_array($field, $handled))
{
$parts = explode(':', $field);
if (count($parts) > 1)
{
$att = array_pop($parts);
$f = implode(':', $parts);
if (is_string($item[$f][$att]))
$handled_value = $item[$f][$att];
}
}


If you create that plugin, then you should be able to get the image url using {feed:enc:enclosure:resource}.

edgespeeder04
02-05-2015, 09:34 PM
Well, I tried it but unfortunately I don't see a way to access the image url without changing the code or creating a plugin. So, I created this plugin using hook location rssposter_parse_rss:
$handled = array('link', 'description', 'title', 'id', 'guid', 'pubDate', 'date', 'enclosure_link', 'enclosure_href', 'content', 'content:encoded', 'author', 'dc:creator');

if (!in_array($field, $handled))
{
$parts = explode(':', $field);
if (count($parts) > 1)
{
$att = array_pop($parts);
$f = implode(':', $parts);
if (is_string($item[$f][$att]))
$handled_value = $item[$f][$att];
}
}


If you create that plugin, then you should be able to get the image url using {feed:enc:enclosure:resource}.

Thank you, that's perfect.

kh99
02-05-2015, 09:40 PM
What I meant was to create a new plugin and fill in the fields, using rssposter_parse_rss for the hook location and the above for the code. But I exported the one I wrote, in case you'd rather do that. I attached the file here. What you do is go to Plugins & Products > Download /Upload Plugins, and scroll to the bottom to use the Import function.

edgespeeder04
02-05-2015, 09:41 PM
Well, I tried it but unfortunately I don't see a way to access the image url without changing the code or creating a plugin. So, I created this plugin using hook location rssposter_parse_rss:
$handled = array('link', 'description', 'title', 'id', 'guid', 'pubDate', 'date', 'enclosure_link', 'enclosure_href', 'content', 'content:encoded', 'author', 'dc:creator');

if (!in_array($field, $handled))
{
$parts = explode(':', $field);
if (count($parts) > 1)
{
$att = array_pop($parts);
$f = implode(':', $parts);
if (is_string($item[$f][$att]))
$handled_value = $item[$f][$att];
}
}


If you create that plugin, then you should be able to get the image url using {feed:enc:enclosure:resource}.

Just did that, how do I get it to embed as an actual image instead of an image link?

I.E. http://www.njstangers.org/showthread.php/19251-For-Sale-Centerline-wheels-with-drag-radials-for-fox-body-Mustang-%28Edison%29-x0024-8

kh99
02-05-2015, 09:43 PM
Hmm... try <img src="{feed:enc:enclosure:resource}">

edgespeeder04
02-05-2015, 09:44 PM
That's perfect, I did what you did and used some basic html image code in the rss feed manager box to get images to show. D

--------------- Added 1423180287 at 1423180287 ---------------

Is there a way to modify that code to get it to show more than one image or all the images?

kh99
02-05-2015, 09:55 PM
Is there a way to modify that code to get it to show more than one image or all the images?

Only if they're actually in the feed. You can look at the xml of the feed and see if there's more than one image url. I looked at it when I was working on that and I don't think there was, but you should check to make sure.

edgespeeder04
02-05-2015, 09:59 PM
yeah you are right, it only shows the main image in the rss feed from CL...thank you for all your help :)