get_video_id_from_uri


Description:

[ Version ( since = "0.4.0" ) ]
public static string get_video_id_from_uri (string video_uri)

Extracts a video ID from a YouTube video player URI.

The video ID is in the same form as returned by gdata_youtube_video_get_video_id, and the video_uri should be in the same form as returned by get_player_uri.

The function will validate whether the URI actually points to a hostname containing youtube (e.g. youtube.com), and will return null if it doesn't.

For example:

video_id = gdata_youtube_video_get_video_id_from_uri ("http://www.youtube.com/watch?v=BH_vwsyCrTc&feature=featured");
g_message ("Video ID: %s", video_id); /* Should print: BH_vwsyCrTc */
g_free (video_id);

Parameters:

video_uri

a YouTube video player URI

Returns:

the video ID, or null; free with g_free




2022 vala-language.org