Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-05-2015, 01:12 AM
edgespeeder04 edgespeeder04 is offline
 
Join Date: Nov 2009
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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"/>
Reply With Quote
  #2  
Old 02-05-2015, 12:16 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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}.
Reply With Quote
  #3  
Old 02-05-2015, 01:01 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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}.
Reply With Quote
  #4  
Old 02-05-2015, 09:34 PM
edgespeeder04 edgespeeder04 is offline
 
Join Date: Nov 2009
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
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.
Reply With Quote
  #5  
Old 02-05-2015, 09:40 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Attached Files
File Type: xml rss-plugin.xml (686 Bytes, 15 views)
Reply With Quote
  #6  
Old 02-05-2015, 09:41 PM
edgespeeder04 edgespeeder04 is offline
 
Join Date: Nov 2009
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
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
Reply With Quote
  #7  
Old 02-05-2015, 09:43 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm... try <img src="{feed:enc:enclosure:resource}">
Reply With Quote
  #8  
Old 02-05-2015, 09:44 PM
edgespeeder04 edgespeeder04 is offline
 
Join Date: Nov 2009
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #9  
Old 02-05-2015, 09:55 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by edgespeeder04 View Post
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.
Reply With Quote
  #10  
Old 02-05-2015, 09:59 PM
edgespeeder04 edgespeeder04 is offline
 
Join Date: Nov 2009
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah you are right, it only shows the main image in the rss feed from CL...thank you for all your help
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:59 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04421 seconds
  • Memory Usage 2,271KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete