• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Uitlezen variabelen youtube rss feed
PostPosted: Fri Nov 02, 2018 1:30 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Mar 23, 2006 9:25 am
Posts: 1796
Location: The Netherlands
Met cg_rss_reader lees ik de rss-feed van Youtube uit. Met print_r geprobeerd uit te lezen wat er nu in de feed staat, maar krijg alleen een reeks nummers terug. De loop waarmee de feed wordt doorlopen is:
Code:
{foreach from=$feeds item=onefeed}
.
.
.
{foreach}

In de feed https://www.youtube.com/feeds/videos.xml?user=gjdgraaf zie ik:
Code:
<entry><id>yt:video:4Frju7xJ_aw</id><yt:videoId>4Frju7xJ_aw</yt:videoId><yt:channelId>UCnNPdVLt2sa9ro7TMjJGWGg</yt:channelId><title>Het vervangen van een Lewmar kajuitraam</title><link rel="alternate" href="https://www.youtube.com/watch?v=4Frju7xJ_aw"/><author><name>gjdgraaf</name><uri>https://www.youtube.com/channel/UCnNPdVLt2sa9ro7TMjJGWGg</uri></author><published>2018-11-02T11:52:45+00:00</published><updated>2018-11-02T11:53:55+00:00</updated><media:group><media:title>Het vervangen van een Lewmar kajuitraam</media:title><media:content url="https://www.youtube.com/v/4Frju7xJ_aw?version=3" type="application/x-shockwave-flash" width="640" height="390"/><media:thumbnail url="https://i1.ytimg.com/vi/4Frju7xJ_aw/hqdefault.jpg" width="480" height="360"/><media:description>Het kopiëren van een Lewmar kajuitraam op een plaatje acrylaat.</media:description><media:community><media:starRating count="0" average="0.00" min="1" max="5"/><media:statistics views="0"/></media:community></media:group></entry>

Met {$onefeed->get_title()} is de titel uit te lezen, maar {$onefeed->get_thumbnail()} krijg ik geen thumbail. Hoe kan ik erachter komen welke variabelen er in de feed worden uitgelezen?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Uitlezen variabelen youtube rss feed
PostPosted: Sat Nov 03, 2018 11:50 am 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7586
Location: The Netherlands
SimplePie is soms wat krom, ik ben er ook al eens mee bezig geweest. Wie weet kan dit je wat verder helpen:
https://cmscanbesimple.org/blog/calguys ... r-template
Kijk ook op de SimplePie website hoe bepaalde zaken daar worden gedaan

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Uitlezen variabelen youtube rss feed
PostPosted: Sat Nov 03, 2018 5:28 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Mar 23, 2006 9:25 am
Posts: 1796
Location: The Netherlands
Dank je Rolf. De feed op SimplePie laten lezen en daar worden geen thumbnails herkend. Strange; die staan wel in de feed.

Variant op een thema is wat je hier beschrijft https://cmscanbesimple.org/blog/a-xml-or-rss-feed-reader-with-plain-smarty

Code:
{$xml = simplexml_load_file('https://www.youtube.com/feeds/videos.xml?user=gjdgraaf')}

{foreach from=$xml item=vid}
   
   {$vid|@print_r}
{/foreach}

Dan krijg ik als output een geneste array lijkt wel:
Quote:
SimpleXMLElement Object ( [@attributes] => Array ( [rel] => self [href] => http://www.youtube.com/feeds/videos.xml?user=gjdgraaf ) ) 1 SimpleXMLElement Object ( [0] => yt:channel:UCnNPdVLt2sa9ro7TMjJGWGg ) 1 SimpleXMLElement Object ( [0] => gjdgraaf ) 1 SimpleXMLElement Object ( [@attributes] => Array ( [rel] => alternate [href] => https://www.youtube.com/channel/UCnNPdVLt2sa9ro7TMjJGWGg ) ) 1 SimpleXMLElement Object ( [name] => gjdgraaf [uri] => https://www.youtube.com/channel/UCnNPdVLt2sa9ro7TMjJGWGg ) 1 SimpleXMLElement Object ( [0] => 2007-10-25T05:37:19+00:00 ) 1 SimpleXMLElement Object ( [id] => yt:video:4Frju7xJ_aw [title] => Het vervangen van een Lewmar kajuitraam [link] => SimpleXMLElement Object ( [@attributes] => Array ( [rel] => alternate [href] => https://www.youtube.com/watch?v=4Frju7xJ_aw ) ) [author] => SimpleXMLElement Object ( [name] => gjdgraaf [uri] => https://www.youtube.com/channel/UCnNPdVLt2sa9ro7TMjJGWGg ) [published] => 2018-11-02T11:52:45+00:00 [updated] => 2018-11-02T11:56:22+00:00 ) 1


Title kan ik eruit halen met {$vid->title} maar hoe verwijs ik bijv. naar href of published? {$vid->title->href} pakt ie niet.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting