Jump to content

[SOLVED] Right way to download and read Jsons?


 Share

Recommended Posts

I need to download and read last version of this program from github

https://api.github.com/repos/rg3/youtube-dl/releases/latest

I would extract from jsons

"tag_name": "2017.03.10",

#include <Array.au3>
#include <Inet.au3>

Example()

Func Example()

    Local $dData = _INetGetSource('https://api.github.com/repos/rg3/youtube-dl/releases/latest')

    FileWriteLine(@ScriptDir&"\latest.json",$dData)

EndFunc   ;==>Example

 

 

Edited by rootx
Link to comment
Share on other sites

Try this:

#include-once
#include <Inet.au3>

#include <JSMN.au3> ; https://github.com/chechelaky/AutoIt/blob/master/JSMN.au3
#include <object_dump.au3> ; https://github.com/chechelaky/AutoIt/blob/master/object_dump.au3

Global $url = "https://api.github.com/repos/rg3/youtube-dl/releases/latest"

Global $json = Jsmn_decode(  _INetGetSource($url) )

If Not @error And $json.Exists("tag_name") Then
    MsgBox(0, "json", "tag_name = " & $json.Item("tag_name"))
    dump( $json )
EndIf

 

Edited by Luigi

Visit my repository

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...