3

I am making a program that should collect the same information from different json.

For example from:

http://steamcommunity.com/market/priceoverview/?appid=730&currency=3&market_hash_name=AK-47%20%7C%20Black%20Laminate%20%28Factory%20New%29

I get JSON of:

{"success":true,"lowest_price":"84,66\u20ac"}

I want to take lowest price! So far i have managed to get this info into where i want! With one ore two of that its ok but i i try to get 1000 different "lowest_price" from different urls there's a problem! Can you help me find a better way to gather all those prices? I want to take the number and place them in different labels.

For example

Try
    Dim request As Net.HttpWebRequest
    Dim response As Net.HttpWebResponse = Nothing
    Dim reader As StreamReader
    request = DirectCast(WebRequest.Create("http://steamcommunity.com/market/priceoverview/?appid=730&currency=3&market_hash_name=AK-47%20%7C%20Black%20Laminate%20%28Factory%20New%29"), HttpWebRequest)
    response = DirectCast(request.GetResponse(), HttpWebResponse)
    reader = New StreamReader(response.GetResponseStream())
    Dim FN1 As String
    FN1 = reader.ReadToEnd()
    Dim jResults As JObject = JObject.Parse(FN1)
    Dim results As List(Of JToken) = jResults.Children().ToList()


    Dim json As JObject = JObject.Parse(FN1)
    Dim fn1ts As String = (json.Item("lowest_price"))
    label1.text = fn1ts
Catch ex As Exception
    label1.text = "N/A"
End Try

I take the number from the json, but I want to do this for about 1200 different prices and labels. Is there any way to massively do that?

The problem is that i repeated the code for 200 urls and when i tested my program it just did load the labels! i stuck! (probably doing the procces) and for about half an hour nothing! I tried with backgroundworked but then i remembers that it can not change label texts!

I want a want that i will get those json data url by url and save them to an xml file probably, and when is all done then load all of them to the labels!

  • Well how are you getting the 1200 different prices? Are these from different URLs, or one URL with lots of JSON? Your question is very unclear at the moment. – Jon Skeet Aug 14 '15 at 06:18
  • From different urls! – Paul Mantziaris Aug 14 '15 at 06:21
  • Right, so presumably you can loop over those URLs and call your existing code for each one... it's still not clear where the difficulty is. Please edit your question to make it clearer (don't just reply in comments). – Jon Skeet Aug 14 '15 at 06:21

1 Answers1

0

There is no way except available to do this except maybe put all the different parameters e.g. AK47 Black Laminate Factory New into a table like

AK-47%20%7C%20Black%20Laminate%20%28Factory%20New%29

And do a query

Select * FROM MarketItems 

Loop through them like

Foreach mUrl in marketUrl
    request = DirectCast(WebRequest.Create("http://steamcommunity.com/market/priceoverview/?appid=730&currency=3&market_hash_name=" + mUrl), HtmlWebRequest)

Could you also explain in detail what error you got?

Also there are numerous threads on this topic:

Get the price of an item on Steam Community Market with PHP and Regex

Curl command to html or vb.net

And judging from them, there is no easy way to do this

Community
  • 1
  • 1
DieVeenman
  • 457
  • 1
  • 3
  • 18