Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

c# grab data from url

Hello guys,im wondering how could I get data from an external url so I can do a live price check of a certain item has the prices changes every 24h my app requires the value to update every 00:00.
HtmlAgilityPack is a parser, if you mean directly from url there is Uri class in .NET
There is only C. Everything else is skid overhead.
(Jul 20, 2017 03:09 AM)Rageline Wrote:  HtmlAgilityPack is a parser, if you mean directly from url there is Uri class in .NET

I have looked into htmlagilityPack,but doesn't it require acess to the website ftp to upload the file?

Edit: It's not from the actual url but from the page.
(Jul 20, 2017 03:42 AM)Rageline Wrote:  Stop doing drugs.

Are you actually going to help or what? stop flaming
(Jul 20, 2017 05:56 AM)Shadyx Wrote:  Are you actually going to help or what? stop flaming

You could help us by giving details like the name of the website?
You'd probably want to use HttpWebRequest for getting the source of the page, then parse it for the price.
(Mar 9, 2017 04:28 PM)caiveman Wrote:  Ur not a legitimate user
Ur a paki skid

(Jul 20, 2017 06:05 AM)goshmulticoloredalto Wrote:  You could help us by giving details like the name of the website?
You'd probably want to use HttpWebRequest for getting the source of the page, then parse it for the price.

Im sorry my bad, so the idea is to get today's price from this link http://www.grandexchangewatch.com/item/2...XCuR9QrK9I

Has you open the page,you can see the prices by date,but the only price that I want to get from that page is today.

Thanks 🎉
(Jul 20, 2017 06:32 AM)Owl Wrote:  Data looks to be retrieved from ajax (their source is unobfuscated.) Try reversing it to save downloading and parsing a huge page.

How can I do that? Thanks for the help
To download a page you can use a WebClient. Specifically the DownloadString method.
Code
view-source:http://www.grandexchangewatch.com/item/24431-fish-mask#.WXCuR9QrK9I

PHP Code

<?php 
[...]
</
tr>
<
tr class="tr-0">
<
td>July 19, 2017</td>
<
td>1,954,084gp</td>
<
td class="color-green" style="border-right: 1px solid #071D35;">+79,726gp</td>
<
td>July 9, 2017</td>
<
td>1,874,358gp</td>
<
td class="color-green" style="border-right: 1px solid #071D35;">+82,745gp</td>
</
tr>
[...] 

Price: 1,954,084gp

This can be 'parsed' without external dependencies in 2 minutes (3 minutes if you want 'pro' features)
(Jul 20, 2017 12:07 PM)Zilog80 Wrote:  
Code
view-source:http://www.grandexchangewatch.com/item/24431-fish-mask#.WXCuR9QrK9I

PHP Code

<?php 
[...]
</
tr>
<
tr class="tr-0">
<
td>July 19, 2017</td>
<
td>1,954,084gp</td>
<
td class="color-green" style="border-right: 1px solid #071D35;">+79,726gp</td>
<
td>July 9, 2017</td>
<
td>1,874,358gp</td>
<
td class="color-green" style="border-right: 1px solid #071D35;">+82,745gp</td>
</
tr>
[...] 

Price: 1,954,084gp

This can be 'parsed' without external dependencies in 2 minutes (3 minutes if you want 'pro' features)

Define 'pro' features.
(Jul 20, 2017 07:54 PM)Ninja Wrote:  Define 'pro' features.

Thanks guys! you made it way more clear now,I had no idea how to do this,I might report the progress when im done with it.

Regards
Ultimately you'd want to use a HTML parser to extract data from the HTML document. A parser like AngleSharp or HTMLAgilityPack works good. I prefer AngleSharp.
(Jul 21, 2017 01:12 PM)+Haze Wrote:  Ultimately you'd want to use a HTML parser to extract data from the HTML document. A parser like AngleSharp or HTMLAgilityPack works good. I prefer AngleSharp.

The data he's looking for appears to be right here

Code
        var baseurl = "http:\/\/www.grandexchangewatch.com";
        var current_status = "completed";
        var status_posted_at = "1500736496";
        var session_id = "2E53iq7S58s3E1DibpIoxpqSls1ITc1pIsxVVkzwfY8sSUQd36bY9af7f4-9ixp8q4-dCb1nDlYKM1789tb3A-3a30SchNpvfa1tela";
        var item_id = "24431";
        var currenturl = "http:\/\/www.grandexchangewatch.com\/item\/24431-fish-mask";
        var notify_on = "You are receiving updates for this item via email";
        var notify_off = "You are not receiving updates for this item via email";
        var notify_on_img = "http:\/\/www.grandexchangewatch.com\/assets\/img\/notify-on.png";
        var notify_off_img = "http:\/\/www.grandexchangewatch.com\/assets\/img\/notify-off.png";
        var item_name = "Fish mask";
        var item_price = "1954084";

The values in the HTML are the historical prices.

Easy enough to grab using Regex.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by DataTron.NetworkFeb 11, 2019 05:08 PM 2 179 Feb 11, 2019 05:08 PM
Last Post: Suspect.
[Python] by TheSteelMay 13, 2018 09:48 AM 4 178 May 13, 2018 09:48 AM
Last Post: TheSteel
[C#] by DotexeAug 6, 2017 06:13 AM 13 303 Aug 6, 2017 06:13 AM
Last Post: Dotexe