Carlo84 Posted September 24, 2010 Share Posted September 24, 2010 Hi , all my apologizes if this is not the correct forum to post this.But i whas just browsing around looking for some info about getting the download url for youtube videos and noticed most of the scripts are broken cause the urls are read in wrong.When trying to read an urls parameters you cannot use stringbetween and the likes of that, using a function like that means you are looking for something between the parameter and the parameter after that.Now the issue with PHP GET method is that there is no specific order in witch these parameters must be passed, so if the order is changed your script will break.right an url with get parameters looks like http://Somedomain.com/somepage.php?FirstParameter=FirstResult&MoreParameters=MoreResultsSo just split your sting to get all parameters.Lets not forget about bookmarks neither. http://Somedomain.com/somepage.php?FirstParameter=FirstResult&MoreParameters=MoreResults#Bookmarkcause we dont want the last parameter to be corrupted cause some bookmark.Heres an example on getting a video ID from a youtube url. but hey it works on any url.Func getVidIDfromURL($url = "http://www.youtube.com/watch?v=da0eaiZ0CKw&feature=related") $url = StringSplit($url, "&?#") Local $VidID = "" Local $i = 1 While $i < $url[0] + 1 If StringLeft($url[$i], 2) = "v=" Then $url = StringSplit($url[$i], "=") If $url[0] = 2 Then $VidID = $url[2] ExitLoop EndIf $i = $i + 1 WEnd If $VidID = "" Then Return SetError(1, 0, 0) Else Return $VidID EndIf EndFunc ;==>getVidIDfromURLor heres an example without splitting the string twice.Func getVidIDfromURL($url = "http://www.youtube.com/watch?v=da0eaiZ0CKw&feature=related") $url = StringSplit($url, "&?#") Local $VidID = "" Local $i = 1 While $i < $url[0] + 1 If StringLeft($url[$i], 2) = "v=" Then $VidID = StringReplace ($url[$i], "v=", "") ExitLoop EndIf $i = $i + 1 WEnd If $VidID = "" Then Return SetError(1, 0, 0) Else Return $VidID EndIf EndFunc ;==>getVidIDfromURL _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
wakillon Posted September 24, 2010 Share Posted September 24, 2010 (edited) See this Post , it can help you ! Edited September 24, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Carlo84 Posted September 24, 2010 Author Share Posted September 24, 2010 See this Post , it can help you ! Thanks wakillon, i think i should have posted this in examples, instead of help and support.Its just an problem i seen allot in peoples scripts on the forum and figured id post an example for getting url parameters.Thanks anyways havent seen yours yet, might be usefull making my player. _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
wakillon Posted September 24, 2010 Share Posted September 24, 2010 A player ! So See this post for a youtube player ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Carlo84 Posted September 24, 2010 Author Share Posted September 24, 2010 A player ! So See this post for a youtube player ! haha you got it all your stuff works perfect Yes im trying to make it something similar to Media Player Classic. but then for youtube and with options to save video/audio. and m3u support. _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
wakillon Posted September 24, 2010 Share Posted September 24, 2010 haha you got it all your stuff works perfect Yes im trying to make it something similar to Media Player Classic. but then for youtube and with options to save video/audio. and m3u support.Thanks ! Use the Forum search for media player AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
seandisanti Posted September 24, 2010 Share Posted September 24, 2010 haha you got it all your stuff works perfect Yes im trying to make it something similar to Media Player Classic. but then for youtube and with options to save video/audio. and m3u support.it's not an autoit script, but check out Tversity media server. is great for changing format on the fly Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now