This commit is contained in:
ccppi 2024-07-22 14:20:29 +02:00
parent cdf0a06595
commit dda3ed1b7d

View File

@ -92,7 +92,6 @@ try:
echo("###########")
discard entry.getEntryFromHtml(node)
@ -103,10 +102,25 @@ try:
#echo "JSON Node:", jsonNode
let field = jsonNode.getFields()
main_loop(jsonNode,0,searchString = "resultItems")
main_loop(jsonNode,0,searchString = "resultItems") #only for searching for the right key
#-props-pageProps-initialResultData-resultItems
#
#
let results = jsonNode["props"]["pageProps"]["initialResultData"]["resultItems"]
let countInserat = len(jsonNode["props"]["pageProps"]["initialResultData"]["resultItems"])
for i in 0..countInserat-1:
echo results[i]["AdId"]
echo results[i]["Title"]
echo results[i]["Price"]
echo results[i]["PropertyTypeText"]
echo results[i]["EssentialInformation"]
echo results[i]["Address"]
echo results[i]["Date"]
echo "-------------------------------"
echo "number of inserats: ",countInserat
echo "node fields: ",jsonNode["props"]["pageProps"]["initialResultData"]["resultItems"][1]["Title"]
echo "node fields: ",jsonNode["props"]["pageProps"]["initialResultData"]["adIds"][0]
echo "node fields: ",jsonNode["props"]["pageProps"]["initialResultData"]["adIds"][1]
finally:
client.close()