Answer the question
In order to leave comments, you need to log in
How to parse json from json array?
When requesting the API:
127.0.0.1:6878/ace/manifest.m3u8?format=json&id=94... ,
a set of links is returned:
{
"response": {
"playback_url": " 127.0.0.1:6878/ace/r / 5410b27fc567c35c8547e3b69b141 ... ",
" stat_url ":" 127.0.0.1:6878/ace/stat/5410b27fc567c35c8547e3b69b ... ",
" command_url ":" 127.0.0.1:6878/ace/cmd/5410b27fc567c35c8547e3b69b1 ... ",
" event_url": " 127.0.0.1:6878/ace/event/5410b27fc567c35c8547e3b69... ",
},
"error":null
}
Now how to get the value of the "stat_url" array:
{ "response": { "status": "dl", "uploaded": 0, "speed_down": 516, "speed_up": 0, "downloaded": 14155776, "peers": 2, "total_progress": 0 } , "error": null }
On jquery I did this:
$.ajax
({ method: "GET",
url: " 127.0.0.1:6878/ace/manifest.m3u8 ",
dataType: "json",
data: {
format: "json",
id: "94c2fd8fb9bc8f2fc71a2cbe9d4b866f227a0209"},
success: function(data){
console.log(data.response.stat_url);
}});
returns: 127.0.0.1:6878/ace/stat/5410b27fc567c35c8547e3b69b... ,
Answer the question
In order to leave comments, you need to log in
Call $.ajax again in the `success` function, pass `data.response.stat_url` for the url
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question