Skip to content

Commit 22f52a6

Browse files
committed
Fixed repo logo, Updated nuget metadata, Updated README
1 parent 7366344 commit 22f52a6

File tree

6 files changed

+79
-74
lines changed

6 files changed

+79
-74
lines changed

AntiCaptcha.Sandbox/Program.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Diagnostics;
2+
using System.Net.Http;
23
using System.Threading.Tasks;
34

45
namespace _AntiCaptcha.Test
@@ -12,26 +13,28 @@ static void Main(string[] args)
1213

1314
static async Task Foo()
1415
{
15-
var antiCaptcha = new AntiCaptcha(" ## YOUR API KEY ## ");
16+
var captcha = new AntiCaptcha(" ## YOUR API KEY ## ");
17+
// .. additionally you can pass your own httpClient class
18+
var captchaWithHttpClient = new AntiCaptcha(" ## YOUR API KEY ## ", new HttpClient());
1619

1720
// Get current balance
18-
var balance = await antiCaptcha.GetBalance();
21+
var balance = await captcha.GetBalance();
1922

2023
// Solve image captcha
21-
var image = await antiCaptcha.SolveImage("iVBORw0KGgo...");
24+
var image = await captcha.SolveImage("iVBORw0KGgo...");
2225

2326
// Solve ReCaptchaV2
24-
var recaptcha = await antiCaptcha.SolveReCaptchaV2("GOOGLE_SITE_KEY", "https://example.com");
25-
var recaptchaInvisible = await antiCaptcha.SolveReCaptchaV2("GOOGLE_SITE_KEY", "https://example.com", true);
27+
var recaptcha = await captcha.SolveReCaptchaV2("GOOGLE_SITE_KEY", "https://example.com");
28+
var recaptchaInvisible = await captcha.SolveReCaptchaV2("GOOGLE_SITE_KEY", "https://example.com", true);
2629

2730
// Solve FunCaptcha
28-
var fun = await antiCaptcha.SolveFunCaptcha("FUN_CAPTCHA_PUBLIC_KEY", "https://example.com");
31+
var fun = await captcha.SolveFunCaptcha("FUN_CAPTCHA_PUBLIC_KEY", "https://example.com");
2932

3033
// Solve SquareNet
31-
var square = await antiCaptcha.SolveSquareNet("iVBORw0KGgo...", "banana", 3, 3);
34+
var square = await captcha.SolveSquareNet("iVBORw0KGgo...", "banana", 3, 3);
3235

3336
// Solve GeeTest
34-
var gee = await antiCaptcha.SolveGeeTest("GEE_TEST_KEY", "https://example.com", "CHALLENGE");
37+
var gee = await captcha.SolveGeeTest("GEE_TEST_KEY", "https://example.com", "CHALLENGE");
3538

3639
Debugger.Break();
3740
}

AntiCaptcha/AntiCaptcha.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class AntiCaptcha
1212
#if NETSTANDARD2_0
1313
[Serializable]
1414
#endif
15-
private struct AntiCaptchaResponse
15+
private struct AntiCaptchaApiResponse
1616
{
1717
public int ErrorId;
1818
public string ErrorCode;
@@ -27,9 +27,9 @@ private struct AntiCaptchaResponse
2727
private readonly HttpClient _httpClient;
2828
private readonly string _apiKey;
2929

30-
public AntiCaptcha(string apiKey)
30+
public AntiCaptcha(string apiKey, HttpClient httpClient = null)
3131
{
32-
_httpClient = new HttpClient();
32+
_httpClient = httpClient ?? new HttpClient();
3333
_apiKey = apiKey;
3434
}
3535

@@ -44,7 +44,7 @@ public async Task<AntiCaptchaResult> GetBalance(CancellationToken cancellationTo
4444
var inResponse = await _httpClient.PostAsync(BaseUrl + "getBalance", new StringContent(contentJson), cancellationToken).ConfigureAwait(false);
4545
var inJson = await inResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
4646

47-
var @in = JsonConvert.DeserializeObject<AntiCaptchaResponse>(inJson);
47+
var @in = JsonConvert.DeserializeObject<AntiCaptchaApiResponse>(inJson);
4848
if (@in.ErrorId != 0)
4949
{
5050
return new AntiCaptchaResult(false, @in.ErrorCode);
@@ -53,25 +53,25 @@ public async Task<AntiCaptchaResult> GetBalance(CancellationToken cancellationTo
5353
return new AntiCaptchaResult(true, @in.Balance.ToString());
5454
}
5555

56-
private async Task<InternalAntiCaptchaResult> Solve(int delaySeconds, IDictionary<string, object> content, CancellationToken cancellationToken = default)
56+
private async Task<AntiCaptchaResultInternal> Solve(int delaySeconds, IDictionary<string, object> content, CancellationToken cancellationToken = default)
5757
{
5858
content["clientKey"] = _apiKey;
5959

6060
var contentJson = JsonConvert.SerializeObject(content);
6161
var inResponse = await _httpClient.PostAsync(BaseUrl + "createTask", new StringContent(contentJson), cancellationToken).ConfigureAwait(false);
6262
var inJson = await inResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
6363

64-
var @in = JsonConvert.DeserializeObject<AntiCaptchaResponse>(inJson);
64+
var @in = JsonConvert.DeserializeObject<AntiCaptchaApiResponse>(inJson);
6565
if (@in.ErrorId != 0)
6666
{
67-
return new InternalAntiCaptchaResult(false, @in.ErrorCode, null);
67+
return new AntiCaptchaResultInternal(false, @in.ErrorCode, null);
6868
}
6969

7070
await Task.Delay(delaySeconds * 1000, cancellationToken).ConfigureAwait(false);
7171
return await GetResponse(@in.TaskId, cancellationToken).ConfigureAwait(false);
7272
}
7373

74-
private async Task<InternalAntiCaptchaResult> GetResponse(int taskId, CancellationToken cancellationToken = default)
74+
private async Task<AntiCaptchaResultInternal> GetResponse(int taskId, CancellationToken cancellationToken = default)
7575
{
7676
var content = new Dictionary<string, object>
7777
{
@@ -86,10 +86,10 @@ private async Task<InternalAntiCaptchaResult> GetResponse(int taskId, Cancellati
8686
var response = await _httpClient.PostAsync(BaseUrl + "getTaskResult", new StringContent(contentJson), cancellationToken).ConfigureAwait(false);
8787
var responseJson = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
8888

89-
var res = JsonConvert.DeserializeObject<AntiCaptchaResponse>(responseJson);
89+
var res = JsonConvert.DeserializeObject<AntiCaptchaApiResponse>(responseJson);
9090
if (res.ErrorId != 0)
9191
{
92-
return new InternalAntiCaptchaResult(false, res.ErrorCode, null);
92+
return new AntiCaptchaResultInternal(false, res.ErrorCode, null);
9393
}
9494

9595
if (res.Status == "processing")
@@ -98,7 +98,7 @@ private async Task<InternalAntiCaptchaResult> GetResponse(int taskId, Cancellati
9898
continue;
9999
}
100100

101-
return new InternalAntiCaptchaResult(true, null, res.Solution);
101+
return new AntiCaptchaResultInternal(true, null, res.Solution);
102102
}
103103
}
104104

AntiCaptcha/AntiCaptcha.csproj

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,30 @@
55
<RootNamespace>_AntiCaptcha</RootNamespace>
66
<Authors>Zaczero (Kamil Monicz)</Authors>
77
<Description>Simple API wrapper for https://anti-captcha.com/</Description>
8-
<Copyright>Copyright (c) Zaczero (Kamil Monicz) 2019</Copyright>
8+
<Copyright>Copyright © Kamil Monicz 2020</Copyright>
99
<PackageLicenseUrl></PackageLicenseUrl>
1010
<PackageProjectUrl>https://github.com/Zaczero/AntiCaptcha</PackageProjectUrl>
11-
<PackageIconUrl>https://i.imgur.com/U0qKP3j.png</PackageIconUrl>
12-
<Version>1.1.0</Version>
11+
<PackageIconUrl></PackageIconUrl>
12+
<Version>1.2</Version>
1313
<PackageTags>anticaptcha, captcha, solver, recaptcha, google, text, image, wrapper, api</PackageTags>
1414
<PackageId>AntiCaptchaAPI</PackageId>
1515
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
16-
<AssemblyVersion>1.1.0.0</AssemblyVersion>
17-
<FileVersion>1.1.0.0</FileVersion>
16+
<AssemblyVersion>1.2.0.0</AssemblyVersion>
17+
<FileVersion>1.2.0.0</FileVersion>
1818
<PackageLicenseExpression>MIT</PackageLicenseExpression>
19+
<RepositoryUrl>https://github.com/Zaczero/AntiCaptcha</RepositoryUrl>
20+
<PackageIcon>AntiCaptcha.png</PackageIcon>
1921
</PropertyGroup>
2022

2123
<ItemGroup>
2224
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
2325
</ItemGroup>
2426

27+
<ItemGroup>
28+
<None Include="..\resources\AntiCaptcha.png">
29+
<Pack>True</Pack>
30+
<PackagePath></PackagePath>
31+
</None>
32+
</ItemGroup>
33+
2534
</Project>

AntiCaptcha/AntiCaptchaResult.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ public AntiCaptchaResult(bool success, string response)
1414
}
1515
}
1616

17-
internal struct InternalAntiCaptchaResult
17+
internal struct AntiCaptchaResultInternal
1818
{
1919
public bool Success;
2020
public string Response;
2121
public Dictionary<string, object> Dictionary;
2222

23-
public InternalAntiCaptchaResult(bool success, string response, Dictionary<string, object> dictionary)
23+
public AntiCaptchaResultInternal(bool success, string response, Dictionary<string, object> dictionary)
2424
{
2525
Success = success;
2626
Response = response;

README.md

Lines changed: 41 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,74 @@
1-
# ![2Captcha logo](https://i.imgur.com/U0qKP3j.png)
1+
# ![Zaczero/AntiCaptcha logo](https://github.com/Zaczero/AntiCaptcha/blob/master/resources/AntiCaptcha.png)
22

3-
![](https://img.shields.io/github/release/Zaczero/AntiCaptcha.svg)
4-
![](https://img.shields.io/nuget/v/AntiCaptchaAPI.svg)
5-
![](https://img.shields.io/github/license/Zaczero/AntiCaptcha.svg)
3+
![github version](https://img.shields.io/github/release/Zaczero/AntiCaptcha.svg)
4+
![nuget version](https://img.shields.io/nuget/v/AntiCaptchaAPI.svg)
5+
![license type](https://img.shields.io/github/license/Zaczero/AntiCaptcha.svg)
66

7-
Simple HTTP API wrapper for https://anti-captcha.com/
7+
Simple HTTP API wrapper for [anti-captcha.com](https://anti-captcha.com/)
88
An online captcha solving and image recognition service.
99

10-
## 🔗 Download
11-
* Latest release: https://github.com/Zaczero/AntiCaptcha/releases/latest
10+
## 🌤️ Installation
1211

13-
## ☕ Support me
14-
If you find this project useful and you are new to anti captcha please consider registering from my [referrral link](http://getcaptchasolution.com/i4lbjatsex).
12+
### Install with NuGet (recommended)
1513

16-
## 🏁 Sample code
14+
`Install-Package AntiCaptchaAPI`
15+
16+
### Install manually
17+
18+
[Browse latest GitHub release](https://github.com/Zaczero/AntiCaptcha/releases/latest)
19+
20+
## 🏁 Getting started
21+
22+
### Sample code
1723

1824
```cs
19-
var antiCaptcha = new AntiCaptcha(" ## YOUR API KEY ## ");
25+
var captcha = new AntiCaptcha(" ## YOUR API KEY ## ");
26+
// .. additionally you can pass your own httpClient class
27+
var captchaWithHttpClient = new AntiCaptcha(" ## YOUR API KEY ## ", new HttpClient());
2028

2129
// Get current balance
22-
var balance = await antiCaptcha.GetBalance();
30+
var balance = await captcha.GetBalance();
2331

2432
// Solve image captcha
25-
var image = await antiCaptcha.SolveImage("iVBORw0KGgo...");
33+
var image = await captcha.SolveImage("iVBORw0KGgo...");
2634

2735
// Solve ReCaptchaV2
28-
var recaptcha = await antiCaptcha.SolveReCaptchaV2("GOOGLE_SITE_KEY", "https://example.com");
29-
var recaptchaInvisible = await antiCaptcha.SolveReCaptchaV2("GOOGLE_SITE_KEY", "https://example.com", true);
36+
var recaptcha = await captcha.SolveReCaptchaV2("GOOGLE_SITE_KEY", "https://example.com");
37+
var recaptchaInvisible = await captcha.SolveReCaptchaV2("GOOGLE_SITE_KEY", "https://example.com", true);
3038

3139
// Solve FunCaptcha
32-
var fun = await antiCaptcha.SolveFunCaptcha("FUN_CAPTCHA_PUBLIC_KEY", "https://example.com");
40+
var fun = await captcha.SolveFunCaptcha("FUN_CAPTCHA_PUBLIC_KEY", "https://example.com");
3341

3442
// Solve SquareNet
35-
var square = await antiCaptcha.SolveSquareNet("iVBORw0KGgo...", "banana", 3, 3);
43+
var square = await captcha.SolveSquareNet("iVBORw0KGgo...", "banana", 3, 3);
3644

3745
// Solve GeeTest
38-
var gee = await antiCaptcha.SolveGeeTest("GEE_TEST_KEY", "https://example.com", "CHALLENGE");
39-
40-
Debugger.Break();
46+
var gee = await captcha.SolveGeeTest("GEE_TEST_KEY", "https://example.com", "CHALLENGE");
4147
```
4248

43-
### And here is the result structure *(same for all methods)*:
49+
### And here is the result structure *(the same for all methods)*
4450

4551
```cs
4652
public struct AntiCaptchaResult
4753
{
48-
public bool Success;
49-
public string Response;
50-
51-
public AntiCaptchaResult(bool success, string response)
52-
{
53-
Success = success;
54-
Response = response;
55-
}
54+
public bool Success;
55+
public string Response;
56+
57+
public AntiCaptchaResult(bool success, string response)
58+
{
59+
Success = success;
60+
Response = response;
61+
}
5662
}
5763
```
5864

59-
## 📎 License
60-
61-
MIT License
65+
## Footer
6266

63-
Copyright (c) 2019 Kamil Monicz
67+
### 📧 Contact
6468

65-
Permission is hereby granted, free of charge, to any person obtaining a copy
66-
of this software and associated documentation files (the "Software"), to deal
67-
in the Software without restriction, including without limitation the rights
68-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
69-
copies of the Software, and to permit persons to whom the Software is
70-
furnished to do so, subject to the following conditions:
69+
7170

72-
The above copyright notice and this permission notice shall be included in all
73-
copies or substantial portions of the Software.
71+
### 📃 License
7472

75-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
76-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
77-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
78-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
79-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
80-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
81-
SOFTWARE.
73+
* [Zaczero/AntiCaptcha](https://github.com/Zaczero/AntiCaptcha/blob/master/LICENSE)
74+
* [JamesNK/Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md)

resources/AntiCaptcha.png

4.89 KB
Loading

0 commit comments

Comments
 (0)