Closed notevenaperson closed 3 years ago
$ waybackpy --url "https://en.wikipedia.org/wiki/JSON#Syntax" --json {'archived_snapshots': {'closest': {'timestamp': '20210121111134', 'url': 'http://web.archive.org/web/20210121111134/https://en.wikipedia.org/wiki/JSON', 'status': '200', 'available': True}}, 'url': 'https://en.wikipedia.org/wiki/JSON#Syntax'} #attempt to parse the json output $ waybackpy --url "https://en.wikipedia.org/wiki/JSON#Syntax" --json | jq parse error: Invalid numeric literal at line 1, column 22
While the equivalent query using curl [1] outputs valid json
$ curl "http://archive.org/wayback/available?url=https://en.wikipedia.org/wiki/JSON#Syntax" {"archived_snapshots": {"closest": {"timestamp": "20210121111134", "url": "http://web.archive.org/web/20210121111134/https://en.wikipedia.org/wiki/JSON", "status": "200", "available": true}}, "url": "https://en.wikipedia.org/wiki/JSON"} #attempt to parse the json output curl "http://archive.org/wayback/available?url=https://en.wikipedia.org/wiki/JSON#Syntax" | jq [works as expected]
It seems waybackpy's json is invalid because:
'
"
True
Just to exemplify, it becomes valid if I manually fix the two points above:
$ waybackpy --url "https://en.wikipedia.org/wiki/JSON#Syntax" --json | tr "'" "\"" | sed -e 's/True/true/g' | jq [works as expected]
fixed in https://github.com/akamhy/waybackpy/commit/edc2f63d9365b5558f8425d41453cf6f95f901f1
Thanks for reporting!
While the equivalent query using curl [1] outputs valid json
It seems waybackpy's json is invalid because:
'
) to denote strings instead of double quotes("
)True
is uppercaseJust to exemplify, it becomes valid if I manually fix the two points above: