NiftRex Posted May 11, 2017 Share Posted May 11, 2017 I'm trying to get an array from a website so that I can just get the url, but I am not sure how. I read a bit of arrays but I have a feeling I'd have to be writing a lot more than what I should be. I will include the script I have so far and the API url for what I want. API: https://api.fast.com/netflix/speedtest?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=1 (I want the 'url' array that contains the url) Code: #include <MsgBoxConstants.au3> #include <Inet.au3> #include <Array.au3> $site = _INetGetSource('http://api.fast.com/netflix/speedtest?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=1') MsgBox($MB_SYSTEMMODAL, "Title", $site[1]) Link to comment Share on other sites More sharing options...
Subz Posted May 11, 2017 Share Posted May 11, 2017 Suggest searching for JSON udf in the forum. Link to comment Share on other sites More sharing options...
mikell Posted May 11, 2017 Share Posted May 11, 2017 Why talk about array ? InetGetSource returns a string so you only need to parse this string using a regular expression or String* funcs #include <MsgBoxConstants.au3> #include <Inet.au3> $json = _INetGetSource('http://api.fast.com/netflix/speedtest?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=1') $site = StringRegExpReplace($json, '.*(https[^"]+).*', "$1") MsgBox($MB_SYSTEMMODAL, "Title", $site) NiftRex 1 Link to comment Share on other sites More sharing options...
NiftRex Posted May 12, 2017 Author Share Posted May 12, 2017 19 hours ago, mikell said: Why talk about array ? InetGetSource returns a string so you only need to parse this string using a regular expression or String* funcs #include <MsgBoxConstants.au3> #include <Inet.au3> $json = _INetGetSource('http://api.fast.com/netflix/speedtest?https=true&token=YXNkZmFzZGxmbnNkYWZoYXNkZmhrYWxm&urlCount=1') $site = StringRegExpReplace($json, '.*(https[^"]+).*', "$1") MsgBox($MB_SYSTEMMODAL, "Title", $site) Thanks, I was going to make it more complicated than it needed to be 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