vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Rss Feed Manager - Including Images from Craigslist (https://vborg.vbsupport.ru/showthread.php?t=317164)

edgespeeder04 02-05-2015 01:12 AM

Rss Feed Manager - Including Images from Craigslist
 
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.

Code:

<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:
Code:

$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

Quote:

Originally Posted by kh99 (Post 2536317)
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:
Code:

$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

1 Attachment(s)
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

Quote:

Originally Posted by kh99 (Post 2536317)
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:
Code:

$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...son%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 [DATE]1423180287[/DATE] at [TIME]1423180287[/TIME] ---------------

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

Quote:

Originally Posted by edgespeeder04 (Post 2536367)
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 :)


All times are GMT. The time now is 09:06 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01033 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete