Hi, first of of all thank you for this great software, so powerful. I'm not very experienced in parsing JSON files, thus I would need some help. The problem is getting the videoId from Youtube JSON reply. The goal is the get the videoid into a user variable, which is needed for a text file.
Figured out the problem myself, here is the principle I used how to easily get all the information output in to file. I used curl GET on youtube API and then piped the json reply to jq. After that I output the information jq siphoned to a text file. Then using a user defined variable and $read in Populate variables to get the information into Ffastrans. Here one of the key things was to use the full path of curl and jq, otherwise it won't execute.
sorry for the late answer, happy that you already found a nice workaround.
Instead of writing to a text file, you could just set the reply json to a user variable in the http node and in another node like e.g. populate variables, you could use something like that to parse your value of interest
explained:
$between is a function from ffastrans for string parsing, %s_rest_response% contains the rest value from the http node, 'videoId": "' (take care about the whitespace between the : and " here) is the start sequence and '"' the end sequence that you want to parse from your rest response
sorry for the late answer, happy that you already found a nice workaround.
Instead of writing to a text file, you could just set the reply json to a user variable in the http node and in another node like e.g. populate variables, you could use something like that to parse your value of interest
explained:
$between is a function from ffastrans for string parsing, %s_rest_response% contains the rest value from the http node, 'videoId": "' (take care about the whitespace between the : and " here) is the start sequence and '"' the end sequence that you want to parse from your rest response
Thank you for your reply. I tried understanding $between before going the workaround route. The mix of single and double quotes are quite intimidating for the uninitiated.
I was already familiar with XPath, so jq so was an easy route for me. It also was really easy to debug to get the correct response using online tools. https://jqplay.org/
Is there an easy way to debug the output of the functions built-in to FFAstrans?
flix wrote: ↑Tue Mar 26, 2019 2:19 pm
Is there an easy way to debug the output of the functions built-in to FFAstrans?
Not sure if it is easy, but i always use the "write text file" node in order to investigate the current value of variables, like here: viewtopic.php?f=5&t=849#p3550