Jump to content

YouTube videoid from URL ?


K4RL

Recommended Posts

I am currently using a YouTube field in Pages and the embedded player. I was wondering if there was any way to pull just the video id eg watch?v=auIy9YNxFDk so that I can use it to pull the associated YouTube image from them without having to manually enter the videoid as a separate field ?

{$record->customFieldDisplayByKey('video', 'listing')|raw}

Currently pulls the full URL. I am assuming that for formatting for the embedded player the videoid at the end is somehow split?

I was wondering if somehow I could pull that id and enter it like bellow to pull the image?

http://img.youtube.com/vi/ videoid /maxresdefault.jpg 

 

Link to comment
Share on other sites

I am currently using a YouTube field in Pages and the embedded player. I was wondering if there was any way to pull just the video id eg watch?v=auIy9YNxFDk so that I can use it to pull the associated YouTube image from them without having to manually enter the videoid as a separate field ?

{$record->customFieldDisplayByKey('video', 'listing')|raw}

Currently pulls the full URL. I am assuming that for formatting for the embedded player the videoid at the end is somehow split?

I was wondering if somehow I could pull that id and enter it like bellow to pull the image?

http://img.youtube.com/vi/ videoid /maxresdefault.jpg 

 

Its been a long time since i did anything like this but i used to use $vid_id; back when i was on wordpress but i think it may have changed.

http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg

Give this a read. You will most likely need a simple function php however to make it work. Like i said ITS been a been a long time so im sure this has changed. but might set you on the right path.

http://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...