Skip to content
Browse files

Added slush account data Json scraping

  • Loading branch information...
1 parent 0ecf315 commit 146adc892b322b4859707832153daa9737a6455e @CRogers committed Apr 30, 2011
View
27 BTCstats/Recorder/ApiData.cs
@@ -0,0 +1,27 @@
+using System;
+using JsonExSerializer;
+
+namespace Recorder
+{
+ [Serializable]
+ public class ApiData
+ {
+ [JsonExProperty("username")]
+ public string Username { get; set; }
+
+ [JsonExProperty("wallet")]
+ public string Wallet { get; set; }
+
+ [JsonExProperty("send_threshold")]
+ public double SendThreshold { get; set; }
+
+ [JsonExProperty("confirmed_reward")]
+ public double ConfirmedReward { get; set; }
+
+ [JsonExProperty("unconfirmed_reward")]
+ public double UnconfirmedReward { get; set; }
+
+ [JsonExProperty("estimated_reward")]
+ public double EstimatedReward { get; set; }
+ }
+}
View
9 BTCstats/Recorder/Main.cs
@@ -1,16 +1,21 @@
using System;
+using System.IO;
namespace Recorder
{
class Program
{
public static void Main(string[] args)
{
- foreach (double t in CardStats.GetTemps())
+ string apiKey = File.ReadAllText("apiKey.txt");
+ var scraper = new SlushScraper(apiKey);
+ var data = scraper.ReadApiData();
+
+ /*foreach (double t in CardStats.GetTemps())
Console.WriteLine(t);
foreach (double[] t in CardStats.GetCurrentClocks())
- Console.WriteLine(t[0] + " " + t[1]);
+ Console.WriteLine(t[0] + " " + t[1]);*/
}
}
}
View
9 BTCstats/Recorder/Recorder.csproj
@@ -39,11 +39,20 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="HtmlAgilityPack">
+ <HintPath>..\lib\HtmlAgilityPack.1.4.0\HtmlAgilityPack.dll</HintPath>
+ </Reference>
+ <Reference Include="JsonExSerializer">
+ <HintPath>..\lib\JsonExSerializer\JsonExSerializer.dll</HintPath>
+ </Reference>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="ApiData.cs" />
+ <Compile Include="CardStats.cs" />
<Compile Include="Main.cs" />
<Compile Include="AssemblyInfo.cs" />
+ <Compile Include="SlushScraper.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
View
29 BTCstats/Recorder/SlushScraper.cs
@@ -0,0 +1,29 @@
+using System.Net;
+
+namespace Recorder
+{
+ public class SlushScraper
+ {
+ public string ApiKey { get; set; }
+
+ public SlushScraper(string apiKey)
+ {
+ ApiKey = apiKey;
+ }
+
+
+ public ApiData ReadApiData()
+ {
+ return ReadApiData(ApiKey);
+ }
+
+ public static ApiData ReadApiData(string apiKey)
+ {
+ var wc = new WebClient();
+ var json = wc.DownloadString("http://mining.bitcoin.cz/accounts/profile/json/" + apiKey);
+
+ var serializer = new JsonExSerializer.Serializer(typeof (ApiData));
+ return (ApiData)serializer.Deserialize(json);
+ }
+ }
+}

0 comments on commit 146adc8

Please sign in to comment.
Something went wrong with that request. Please try again.