alexmercerind/youtube-search-python

Playlist result Not "tab delimited" in JSON ResultMode

Closed this issue ยท 6 comments

Apparently the playlist queries return the json code on a single line.

mytja commented

I will fix this tomorrow

You can add as many indents as you want:

import json
...
result = search.result()
result_json = json.dumps(result, indent=5)
mytja commented

You can add as many indents as you want:

import json
...
result = search.result()
result_json = json.dumps(result, indent=5)

Yeah, but the problem is, they are passing ResultMode.JSON and not getting JSON back. Instead they get back the dictionary. This is a problem that was introduced I think with my PR, since I rewrote a lot of class. I will fix this today, and afterwards release it to PyPI.

BTW thanks for closing a couple of issues for me

I can't reproduce it.

import youtubesearchpython as yt
search = yt.VideosSearch("say it aint so")

rjson = search.result(yt.ResultMode.json)
print(type(rjson) == str)
# True
print("        " in rjson)
# True

rdict = search.result(yt.ResultMode.dict)
print(type(rdict) == dict)
# True

ok, im blind. sorry

mytja commented

I can't reproduce it.

import youtubesearchpython as yt
search = yt.VideosSearch("say it aint so")

rjson = search.result(yt.ResultMode.json)
print(type(rjson) == str)
# True
print("        " in rjson)
# True

rdict = search.result(yt.ResultMode.dict)
print(type(rdict) == dict)
# True

Playlist class, not VideosSearch class ๐Ÿ˜…

playlist

mytja commented

Ok, this is now fixed.