Closed delovelady closed 3 years ago
Just taking a shot in the dark here to be sure since your sample was a txt file.... you are using --format json and json extension?
example: chat_downloader https://www.youtube.com/user/somechannel --format json --output filename.json
I ask because I started messing with this program and the sample you uploaded looks like the default text file that is generated as a list of python dictionaries as the data instead of a json file. See if using the format and json file extension gives the right syntax. Not sure if you were already doing that or not. Anyhow good luck :)
Hi! Sorry for the late response, but as @craxxon correctly suggested, you should output to a .json
file. For example, the following command:
chat_downloader https://www.youtube.com/watch?v=5qap5aO4i9A --output data.json
Would output correctly formatted JSON (see file in zip, since github doesn't allow .json files to be uploaded for some reason): data.zip
I believe this issue was caused by .txt files producing Python's "dictionary representation" as strings. This has been fixed in the latest version (v0.1.0). Sorry for the confusion!
Let me know if you have any other questions.
What is your question?
I am trying to write a php script that uses the output from: chat_downloader https://youtu.be/some_key --output=/path/to/my-file
PHP's decode_json command fails with almost all lines in /path/to/my-file: "Syntax error."
When I use https://jsonformatter.curiousconcept.com to verify syntax, I get a number of errors, the most recurring of which is:
Strings should be wrapped in double quotes
Additional context
When I replace all apostrophes with quotes, it's better but still not successful: "Multiple JSON root elements"
(I am completely aware that brute-force replacements of apostrophe with quote is not a good practice. This is something that must be done on a case-by-case basis; something I would expect to be done by the application - hence this question.)
Since I know nothing of python nor of JSON, and since the (primitive) documentation claims to make json, I hope this is easily solved.
I've attached a sample from one of my livestreams.
1cCVst_Zl9ga.txt