Get the ID of a YouTube link from Matlab
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Mario Martos
el 23 de Mayo de 2016
Comentada: Mario Martos
el 24 de Mayo de 2016
Hello, I wanted to ask if there is any way to get the ID of a Youtube URL from Matlab or how I could do it , that is, if I have the following URL for example :
https://www.youtube.com/watch?v=e4d0LOuP4Uw
Remove or get : e4d0LOuP4Uw
Or on the other hand , I have seen a php function that you can do but how I could call or do the same in Matlab ?
id_youtube function ( $ url ) { $ patron = ' % ^ (?: https : // ) ? ( : Www \ . ) ? ( : Youtu \ .be / | youtube \ .com ( : / embed / | / v / | / watch \ v = ) ? ) ( [ \ W -] { 10,12 } ) $ % x ' ; $ Array = preg_match ( $ patron , $ url , $ parte ) ; if ( false ! == $ array) { return $ parte [ 1]; } return false; }
Echo id_youtube ( ' https://www.youtube.com/watch?v=9WZn9PkTDJY '); // Prints : 9WZn9PkTDJY
Thanks in advanced.
0 comentarios
Respuesta aceptada
KSSV
el 23 de Mayo de 2016
link = 'https://www.youtube.com/watch?v=e4d0LOuP4Uw' ; % youtube link
pos = strfind(link,'=') ; % GEt the position of =
id = link(pos+1:end) ; % Get the part after =
As the id is appearing after '=', cant you get the position of '=' and take the string after ?
Más respuestas (0)
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!