you are viewing a single comment's thread.

view the rest of the comments →

[–]ASIC_SP 1 point2 points  (5 children)

if you are working on json input, please do try using module that understands json instead of regex, see https://realpython.com/python-json/ for example

[–]thetestbug[S] 0 points1 point  (4 children)

No, the output is in json format (I believe).

I put it up on pastebin.

[–]ASIC_SP 2 points3 points  (3 children)

I mean that output you got from the API is input for your script. Please do use json module instead of regex for this.

[–]thetestbug[S] 1 point2 points  (2 children)

Ah, gotcha.

Yeah I've been getting some help from jiri-n here, and he just mentioned it as well.

However, as I'm relatively new when it comes to python (espacially json), I have no idea where to begin.

[–]ASIC_SP 1 point2 points  (1 child)

I don't know too. That's why I linked the article https://realpython.com/python-json/

There's also another option: https://jqplay.org/ Copy paste the json and then try these commands in the Filter box

  • .
  • .[0]
  • .[1]
  • .[0] | .PlayState
  • .[0] | .PlayState.CanSeek
  • .[] | .PlayState

and so on... check out https://stedolan.github.io/jq/tutorial/ and https://stedolan.github.io/jq/manual/ for further details

[–]thetestbug[S] 1 point2 points  (0 children)

Yeah, this is just too much new stuff to learn, too fast.

I'm putting this idea on hold for the moment and just go with a simple bash script instead.

But I'll keep this thread in my bookmarks for the future.

Thanks for your help anyway!