Get the ID of a YouTube link from Matlab

조회 수: 1 (최근 30일)
Mario Martos
Mario Martos 2016년 5월 23일
댓글: Mario Martos 2016년 5월 24일
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.

채택된 답변

KSSV
KSSV 2016년 5월 23일
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 ?

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by