GET Request problem

I am a new joiner to the Knime. I hope my question here is not too stupid :stuck_out_tongue:

There are 2 workflows in the file,
-the 1st flow I try is with the node “get request”, I supposed I can use “json path” node afterwards to extract data, however, I dont know why is not working
-then i try to find a solution in the forum, I saw someone share another workflow with node “HHTP retriever”, I followed, but it fails again

May anyone tell me what’s wrong there?

get request problem.knwf (17.7 KB)

1 Like

Hi Jelly,

Your URL https://www.hotelsmag.com/Industry/News is not JSON but HTML format. You can e.g. use the HTML Parser node connected to the HTTP Retriever to parse it, if this is what you’re looking for:

Afterwards, you can treat it e.g. with the XPath node to extract specific parts of the parsed HTML DOM:

– Philipp

5 Likes

Thank you so much, Philipp! Your explanation is very clear :star_struck:

But I just have another problem here, see if you or other fellows can help :stuck_out_tongue_closed_eyes:


I use some online XPath tester, the path worked


But I don’t know why I input the same path into the node, the result shows nothing

hotelsmag_xpath problem.knwf (17.7 KB)

1 Like

You need to prefix element names with dns: so that they work properly (see the “Namespace” tab in the XPath node configuration). Thus, the XPath query should be:

//*[@id="newsIndex"]/dns:h1

I have updated the workflow which extracts all the h1 headlines and put it for you to my NodePit Space for you. Hope this helps!

–Philipp

3 Likes

Thank you again!! I am self-learning this language, you helped a lot :bowing_woman:

2 Likes