hello.
i would like to use this URL to get amazon search results:
This is my code:
Sure, i use this tool for generate b4X code:
and here i have this error
The problem is on the result json:
The error in on the first field "search_callback" that should be
the correct sysntacs should be
question:
how can i solve this??
thanks you
i would like to use this URL to get amazon search results:
B4X:
https://ws-eu.amazon-adsystem.com/widgets/q?Operation=GetResults&MarketPlace=IT&Keywords=pentole&SearchIndex=50&multipageStart=1&InstanceId=0&multipageCount=10&TemplateId=MobileSearchResults&ServiceVersion=20070822
This is my code:
B4X:
Sub searchamazonproducts
Dim j As HttpJob
j.initialize("",Me)
j.Download("https://ws-eu.amazon-adsystem.com/widgets/q?Operation=GetResults&MarketPlace=IT&Keywords=pentole&SearchIndex=50&multipageStart=1&InstanceId=0&multipageCount=10&TemplateId=MobileSearchResults&ServiceVersion=20070822")
j.GetRequest.Timeout = 600000
wait for (j) jobDone (j As HttpJob)
If j.success Then
Log(j.GetString)
Dim parser As JSONParser
parser.Initialize(j.getstring) <--------------ERROR IS HERE
Dim root As Map = parser.NextObject
Dim search_callback As Map = root.Get("search_callback")
Dim InstanceId As String = search_callback.Get("InstanceId")
Dim results As List = search_callback.Get("results")
For Each colresults As Map In results
Dim Subtitle As String = colresults.Get("Subtitle")
Dim IsPrimeEligible As String = colresults.Get("IsPrimeEligible")
Dim DetailPageURL As String = colresults.Get("DetailPageURL")
Dim Price As String = colresults.Get("Price")
Dim Rating As String = colresults.Get("Rating")
Dim TotalReviews As String = colresults.Get("TotalReviews")
Dim ASinN As String = colresults.Get("ASIN")
Dim Title As String = colresults.Get("Title")
Dim ImageUrl As String = colresults.Get("ImageUrl")
Dim ListPrice As String = colresults.Get("ListPrice")
Next
Dim MarketPlace As String = search_callback.Get("MarketPlace")
Log(Title)
Log(Subtitle)
Log(ImageUrl)
Log(Price)
Log(DetailPageURL)
Log(ASinN)
Else
Log("Error: " & j.ErrorMessage )
End If
j.Release
End Sub
and here i have this error
The problem is on the result json:
B4X:
search_callback({results : [ { ASIN : "B075CVX2WV" , Title : "Lagostina Ingenio Essential Batteria di Pentole, 2 x Manico amovibile, Alluminio, 14 Pezzi, Nero" , Price : "99,00 €" , ListPrice : "129,90 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/4193AuwC-FL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B075CVX2WV" , Rating : "4.5" , TotalReviews : "1169" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B01LYU53W8" , Title : "GSW 990042 Montreal – Set di 4 pezzi, in acciaio inox, argento" , Price : "38,77 €" , ListPrice : "" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/415HhaeMztL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B01LYU53W8" , Rating : "4.1" , TotalReviews : "122" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B01KOT4VEM" , Title : "Aeternum Madame Petravera Plus Batteria 8 Pezzi (induction)" , Price : "79,98 €" , ListPrice : "85,96 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/41zhfgmM3ML._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B01KOT4VEM" , Rating : "4.5" , TotalReviews : "610" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B07M92X8LK" , Title : "Aeternum Divina Pastarella Doppio Cestello (Pentola per Pasta) 22 cm, Adatto all'induzione, Acciaio" , Price : "29,99 €" , ListPrice : "39,90 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/41kWU4cTxmL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B07M92X8LK" , Rating : "4.2" , TotalReviews : "785" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B085SBQSH9" , Title : "Lagostina Irradial Control Lagoeasy'Up Pentola a Pressione, 5 L, Acciaio Inox 18\/10, 22 cm" , Price : "64,90 €" , ListPrice : "79,90 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/410xSq6QBOL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B085SBQSH9" , Rating : "4.3" , TotalReviews : "46" , Subtitle : "" , IsPrimeEligible : "0" } , { ASIN : "B00L6G4490" , Title : "Lagostina Set Smart-Batteria di 9 Pezzi, Acciaio Inossidabile, Argento" , Price : "88,85 €" , ListPrice : "129,00 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/41-zLZSyZYL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B00L6G4490" , Rating : "4.3" , TotalReviews : "602" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B07KQ9H68M" , Title : "Tognana Set 3 padelle 20-24-28 cm, Alluminio, anche a Induzione, Nero" , Price : "29,90 €" , ListPrice : "56,85 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/41W-AbIbzRL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B07KQ9H68M" , Rating : "4.4" , TotalReviews : "986" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B077SNRN3Z" , Title : "Tognana Stone&Wood Batteria di pentole, Grigio, 8 Pezzi, Alluminio" , Price : "79,99 €" , ListPrice : "" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/411u0v7R24L._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B077SNRN3Z" , Rating : "4.2" , TotalReviews : "123" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B0182KKQ6W" , Title : "Barazzoni Spaghettieri Scolaveloce Inox, 22 Cm, Acciaio Inossidabile, 5.5 Litri, Acciaio" , Price : "19,90 €" , ListPrice : "" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/41ncX-i229L._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B0182KKQ6W" , Rating : "4.2" , TotalReviews : "599" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B078T7FHZ6" , Title : "Deik Set pentole induzione, Batteria pentole, Acciaio inox, 10 pezzi, Pentole antiaderente, Coperchi in Vetro, Maniglia per rivetti" , Price : "96,95 €" , ListPrice : "" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/51c32vPTpQL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B078T7FHZ6" , Rating : "4.5" , TotalReviews : "430" , Subtitle : "" , IsPrimeEligible : "1" } ], MarketPlace: "IT", InstanceId: "0"})
The error in on the first field "search_callback" that should be
the correct sysntacs should be
B4X:
{search_callback : {results : [ { ASIN : "B075CVX2WV" , Title : "Lagostina Ingenio Essential Batteria di Pentole, 2 x Manico amovibile, Alluminio, 14 Pezzi, Nero" , Price : "99,00 €" , ListPrice : "129,90 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/4193AuwC-FL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B075CVX2WV" , Rating : "4.5" , TotalReviews : "1169" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B01LYU53W8" , Title : "GSW 990042 Montreal – Set di 4 pezzi, in acciaio inox, argento" , Price : "38,77 €" , ListPrice : "" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/415HhaeMztL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B01LYU53W8" , Rating : "4.1" , TotalReviews : "122" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B01KOT4VEM" , Title : "Aeternum Madame Petravera Plus Batteria 8 Pezzi (induction)" , Price : "79,98 €" , ListPrice : "85,96 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/41zhfgmM3ML._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B01KOT4VEM" , Rating : "4.5" , TotalReviews : "610" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B07M92X8LK" , Title : "Aeternum Divina Pastarella Doppio Cestello (Pentola per Pasta) 22 cm, Adatto all'induzione, Acciaio" , Price : "29,99 €" , ListPrice : "39,90 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/41kWU4cTxmL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B07M92X8LK" , Rating : "4.2" , TotalReviews : "785" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B085SBQSH9" , Title : "Lagostina Irradial Control Lagoeasy'Up Pentola a Pressione, 5 L, Acciaio Inox 18\/10, 22 cm" , Price : "64,90 €" , ListPrice : "79,90 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/410xSq6QBOL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B085SBQSH9" , Rating : "4.3" , TotalReviews : "46" , Subtitle : "" , IsPrimeEligible : "0" } , { ASIN : "B00L6G4490" , Title : "Lagostina Set Smart-Batteria di 9 Pezzi, Acciaio Inossidabile, Argento" , Price : "88,85 €" , ListPrice : "129,00 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/41-zLZSyZYL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B00L6G4490" , Rating : "4.3" , TotalReviews : "602" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B07KQ9H68M" , Title : "Tognana Set 3 padelle 20-24-28 cm, Alluminio, anche a Induzione, Nero" , Price : "29,90 €" , ListPrice : "56,85 €" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/41W-AbIbzRL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B07KQ9H68M" , Rating : "4.4" , TotalReviews : "986" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B077SNRN3Z" , Title : "Tognana Stone&Wood Batteria di pentole, Grigio, 8 Pezzi, Alluminio" , Price : "79,99 €" , ListPrice : "" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/411u0v7R24L._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B077SNRN3Z" , Rating : "4.2" , TotalReviews : "123" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B0182KKQ6W" , Title : "Barazzoni Spaghettieri Scolaveloce Inox, 22 Cm, Acciaio Inossidabile, 5.5 Litri, Acciaio" , Price : "19,90 €" , ListPrice : "" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/41ncX-i229L._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B0182KKQ6W" , Rating : "4.2" , TotalReviews : "599" , Subtitle : "" , IsPrimeEligible : "1" } , { ASIN : "B078T7FHZ6" , Title : "Deik Set pentole induzione, Batteria pentole, Acciaio inox, 10 pezzi, Pentole antiaderente, Coperchi in Vetro, Maniglia per rivetti" , Price : "96,95 €" , ListPrice : "" , ImageUrl : "https:\/\/m.media-amazon.com\/images\/I\/51c32vPTpQL._SL160_.jpg" , DetailPageURL : "https:\/\/www.amazon.it\/dp\/B078T7FHZ6" , Rating : "4.5" , TotalReviews : "430" , Subtitle : "" , IsPrimeEligible : "1" } ], MarketPlace: "IT", InstanceId: "0"}}
question:
how can i solve this??
thanks you