Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: 2captcha/2captcha-csharp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3.0
Choose a base ref
...
head repository: 2captcha/2captcha-csharp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Aug 29, 2023

  1. balance invariant culture (#22)

    Co-authored-by: 2Captcha <support@2captcha.com>
    kratzky and 2Captcha authored Aug 29, 2023
    Copy the full SHA
    993e3ee View commit details
  2. v1.3.1

    kratzky committed Aug 29, 2023
    Copy the full SHA
    7ed0541 View commit details

Commits on Aug 30, 2023

  1. Optional params (#24)

    * added additional parameters
    
    * updated tests
    
    * updated readme
    kratzky authored Aug 30, 2023
    Copy the full SHA
    4a7182d View commit details
  2. v1.3.2

    kratzky committed Aug 30, 2023
    Copy the full SHA
    76a159f View commit details

Commits on May 14, 2024

  1. update gitignore

    kratzky committed May 14, 2024
    Copy the full SHA
    e9d89f2 View commit details
  2. Add 2captcha softId (#27)

    * add info about proxy
    
    * Add Useful links
    
    * add 2captcha softId
    
    * update tests
    dzmitry-duboyski authored May 14, 2024
    Copy the full SHA
    8b9e897 View commit details
  3. v1.3.3

    kratzky committed May 14, 2024
    Copy the full SHA
    3de4fa7 View commit details
  4. fix links (#28)

    dzmitry-duboyski authored May 14, 2024
    Copy the full SHA
    02bba34 View commit details

Commits on Jul 24, 2024

  1. Update README.md

    dzmitry-duboyski authored Jul 24, 2024
    Copy the full SHA
    1560762 View commit details

Commits on Aug 9, 2024

  1. Add LICENSE

    dzmitry-duboyski committed Aug 9, 2024
    Copy the full SHA
    453ba1d View commit details
  2. Copy the full SHA
    bdc0d84 View commit details
  3. Update README.md

    dzmitry-duboyski committed Aug 9, 2024
    Copy the full SHA
    b9af2f6 View commit details
  4. Update README.md

    dzmitry-duboyski authored Aug 9, 2024
    Copy the full SHA
    bed3952 View commit details

Commits on Aug 14, 2024

  1. Copy the full SHA
    c903a80 View commit details
  2. v1.3.4

    kratzky committed Aug 14, 2024
    Copy the full SHA
    f8daab7 View commit details

Commits on Oct 9, 2024

  1. new SDK (#33)

    * public static void Main()
    
    * run helper
    
    * MTCaptcha added
    
    * test and readme
    
    * Cutcaptcha
    
    * readme
    
    * CyberSiARA
    
    * DataDome
    
    * DataDome
    
    * atbCAPTCHA
    
    * test
    
    * Tencent
    
    * bug fixed
    
    * Update README.md
    
    * refactor
    
    * Update README.md
    
    * Update examples
    
    * Update README.md
    
    * Add Description and Tags
    
    ---------
    
    Co-authored-by: victorkowalski <kowalsky@2captcha.com>
    Co-authored-by: dzmitry-duboyski <dzmitry.duboyski@gmail.com>
    3 people authored Oct 9, 2024
    Copy the full SHA
    8608681 View commit details
  2. v1.4.0

    kratzky committed Oct 9, 2024
    Copy the full SHA
    5438c27 View commit details

Commits on Nov 19, 2024

  1. Update README.md

    dzmitry-duboyski committed Nov 19, 2024
    Copy the full SHA
    040d2bc View commit details
  2. refactor

    dzmitry-duboyski committed Nov 19, 2024
    Copy the full SHA
    2a840b2 View commit details
  3. Revert "refactor"

    This reverts commit 2a840b2.
    dzmitry-duboyski committed Nov 19, 2024
    Copy the full SHA
    6f3e248 View commit details
  4. refactor

    dzmitry-duboyski committed Nov 19, 2024
    Copy the full SHA
    80a8751 View commit details

Commits on Nov 21, 2024

  1. refactor

    dzmitry-duboyski committed Nov 21, 2024
    Copy the full SHA
    7a407b4 View commit details

Commits on Dec 3, 2024

  1. Update README.md

    dzmitry-duboyski committed Dec 3, 2024
    Copy the full SHA
    19293b6 View commit details

Commits on Dec 4, 2024

  1. Update README.md

    dzmitry-duboyski authored Dec 4, 2024
    Copy the full SHA
    5abfdf6 View commit details
Showing with 1,353 additions and 249 deletions.
  1. +4 −1 .gitignore
  2. +21 −0 LICENSE
  3. +286 −77 README.md
  4. +2 −2 TwoCaptcha.Examples/AmazonWafExample.cs
  5. +2 −2 TwoCaptcha.Examples/AmazonWafOptionsExample.cs
  6. +29 −0 TwoCaptcha.Examples/AtbCAPTCHAExample.cs
  7. +4 −4 TwoCaptcha.Examples/AudioCaptchaExample.cs
  8. +4 −4 TwoCaptcha.Examples/AudioCaptchaOpdionsExample.cs
  9. +3 −3 TwoCaptcha.Examples/CanvasBase64Example.cs
  10. +3 −3 TwoCaptcha.Examples/CanvasExample.cs
  11. +4 −4 TwoCaptcha.Examples/CanvasOptionsExample.cs
  12. +2 −2 TwoCaptcha.Examples/CapyExample.cs
  13. +2 −2 TwoCaptcha.Examples/CapyOptionsExample.cs
  14. +3 −3 TwoCaptcha.Examples/CoordinatesBase64Example.cs
  15. +3 −3 TwoCaptcha.Examples/CoordinatesExample.cs
  16. +4 −4 TwoCaptcha.Examples/CoordinatesOptionsExample.cs
  17. +29 −0 TwoCaptcha.Examples/CutcaptchaExample.cs
  18. +29 −0 TwoCaptcha.Examples/CyberSiARAExample.cs
  19. +30 −0 TwoCaptcha.Examples/DataDomeExample.cs
  20. +6 −6 TwoCaptcha.Examples/{HCaptchaExample.cs → FriendlyCaptchaExample.cs}
  21. +3 −2 TwoCaptcha.Examples/FunCaptchaExample.cs
  22. +2 −2 TwoCaptcha.Examples/FunCaptchaOptionsExample.cs
  23. +4 −4 TwoCaptcha.Examples/GeeTestExample.cs
  24. +4 −4 TwoCaptcha.Examples/GeeTestOptionsExample.cs
  25. +3 −3 TwoCaptcha.Examples/GeeTestV4Example.cs
  26. +3 −3 TwoCaptcha.Examples/GeeTestV4OptionsExample.cs
  27. +4 −3 TwoCaptcha.Examples/GridBase64Example.cs
  28. +4 −3 TwoCaptcha.Examples/GridExample.cs
  29. +4 −4 TwoCaptcha.Examples/GridOptionsExample.cs
  30. +0 −29 TwoCaptcha.Examples/HCaptchaOptionsExample.cs
  31. +7 −7 TwoCaptcha.Examples/KeyCaptchaExample.cs
  32. +7 −7 TwoCaptcha.Examples/KeyCaptchaOptionsExample.cs
  33. +4 −4 TwoCaptcha.Examples/LeminExample.cs
  34. +4 −4 TwoCaptcha.Examples/LeminOptionsExample.cs
  35. +28 −0 TwoCaptcha.Examples/MTCaptchaExample.cs
  36. +4 −3 TwoCaptcha.Examples/NormalBase64Example.cs
  37. +3 −3 TwoCaptcha.Examples/NormalExample.cs
  38. +5 −5 TwoCaptcha.Examples/NormalOptionsExample.cs
  39. +20 −0 TwoCaptcha.Examples/README.md
  40. +4 −4 TwoCaptcha.Examples/ReCaptchaV2Example.cs
  41. +4 −4 TwoCaptcha.Examples/ReCaptchaV2OptionsExample.cs
  42. +4 −4 TwoCaptcha.Examples/ReCaptchaV3Example.cs
  43. +5 −5 TwoCaptcha.Examples/ReCaptchaV3OptionsExample.cs
  44. +3 −3 TwoCaptcha.Examples/RotateExample.cs
  45. +4 −4 TwoCaptcha.Examples/RotateOptionsExample.cs
  46. +203 −0 TwoCaptcha.Examples/Run.cs
  47. +28 −0 TwoCaptcha.Examples/TencentExample.cs
  48. +2 −2 TwoCaptcha.Examples/TextExample.cs
  49. +2 −2 TwoCaptcha.Examples/TextOptionsExample.cs
  50. +2 −2 TwoCaptcha.Examples/TurnstileExample.cs
  51. +2 −2 TwoCaptcha.Examples/TurnstileOptionsExample.cs
  52. +72 −0 TwoCaptcha.Examples/TwoCaptcha.Examples.csproj
  53. +2 −2 TwoCaptcha.Examples/YandexExample.cs
  54. +2 −2 TwoCaptcha.Examples/YandexOptionsExample.cs
  55. BIN TwoCaptcha.Examples/resources/normal_hint.jpg
  56. BIN TwoCaptcha.Examples/resources/rotate_hint.jpg
  57. +1 −0 TwoCaptcha.Tests/AmazonWafTest.cs
  58. +29 −0 TwoCaptcha.Tests/AtbCAPTCHATest.cs
  59. +1 −0 TwoCaptcha.Tests/AudioTest.cs
  60. +3 −0 TwoCaptcha.Tests/CanvasTest.cs
  61. +1 −0 TwoCaptcha.Tests/CapyTest.cs
  62. +4 −0 TwoCaptcha.Tests/CoordinatesTest.cs
  63. +28 −0 TwoCaptcha.Tests/CutcaptchaTest.cs
  64. +28 −0 TwoCaptcha.Tests/CyberSiARATest.cs
  65. +35 −0 TwoCaptcha.Tests/DataDomeTest.cs
  66. +27 −0 TwoCaptcha.Tests/FriendlyCaptchaTest.cs
  67. +1 −0 TwoCaptcha.Tests/FunCaptchaTest.cs
  68. +1 −0 TwoCaptcha.Tests/GeeTestTest.cs
  69. +1 −0 TwoCaptcha.Tests/GeeTestV4Test.cs
  70. +4 −0 TwoCaptcha.Tests/GridTest.cs
  71. +3 −0 TwoCaptcha.Tests/HCaptchaTest.cs
  72. +1 −0 TwoCaptcha.Tests/KeyCaptchaTest.cs
  73. +1 −0 TwoCaptcha.Tests/LeminTest.cs
  74. +27 −0 TwoCaptcha.Tests/MTCaptchaTest.cs
  75. +4 −0 TwoCaptcha.Tests/NormalTest.cs
  76. +4 −0 TwoCaptcha.Tests/ReCaptchaTest.cs
  77. +1 −0 TwoCaptcha.Tests/RotateTest.cs
  78. +27 −0 TwoCaptcha.Tests/TencentTest.cs
  79. +3 −0 TwoCaptcha.Tests/TextTest.cs
  80. +7 −0 TwoCaptcha.Tests/TurnstileTest.cs
  81. +1 −0 TwoCaptcha.Tests/YandexTest.cs
  82. +26 −0 TwoCaptcha/Captcha/AtbCAPTCHA.cs
  83. +22 −0 TwoCaptcha/Captcha/Cutcaptcha.cs
  84. +23 −0 TwoCaptcha/Captcha/CyberSiARA.cs
  85. +26 −0 TwoCaptcha/Captcha/DataDome.cs
  86. +20 −0 TwoCaptcha/Captcha/FriendlyCaptcha.cs
  87. +5 −0 TwoCaptcha/Captcha/HCaptcha.cs
  88. +21 −0 TwoCaptcha/Captcha/MTCaptcha.cs
  89. +5 −0 TwoCaptcha/Captcha/ReCaptcha.cs
  90. +21 −0 TwoCaptcha/Captcha/Tencent.cs
  91. +13 −0 TwoCaptcha/Captcha/Turnstile.cs
  92. +3 −2 TwoCaptcha/TwoCaptcha.cs
  93. +3 −1 TwoCaptcha/TwoCaptcha.csproj
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -3,4 +3,7 @@ obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
.idea
.idea
.vs
info.md
Properties/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 2captcha

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

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
363 changes: 286 additions & 77 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions TwoCaptcha.Examples/AmazonWafExample.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ namespace TwoCaptcha.Examples
{
public class AmazonWafExample
{
public void Main()
public AmazonWafExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

AmazonWaf captcha = new AmazonWaf();
captcha.SetSiteKey("AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AF5H1K/siwSLK7RfstKtN5bAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglg");
4 changes: 2 additions & 2 deletions TwoCaptcha.Examples/AmazonWafOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ namespace TwoCaptcha.Examples
{
public class AmazonWafOptionsExample
{
public void Main()
public AmazonWafOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

AmazonWaf captcha = new AmazonWaf();
captcha.SetSiteKey("AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AF5H1K/siwSLK7RfstKtN5bAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglg");
29 changes: 29 additions & 0 deletions TwoCaptcha.Examples/AtbCAPTCHAExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Linq;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Examples
{
public class AtbCAPTCHAExample
{
public AtbCAPTCHAExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha(apiKey);

AtbCAPTCHA atbCAPTCHA = new AtbCAPTCHA();
atbCAPTCHA.SetAppId("af23e041b22d000a11e22a230fa8991c");
atbCAPTCHA.SetApiServer("https://cap.aisecurius.com");
atbCAPTCHA.SetPageUrl("https://www.example.com/");

try
{
solver.Solve(atbCAPTCHA).Wait();
Console.WriteLine("Captcha solved: " + atbCAPTCHA.Code);
}
catch (AggregateException e)
{
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
}
}
}
}
8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/AudioCaptchaExample.cs
Original file line number Diff line number Diff line change
@@ -5,13 +5,13 @@

namespace TwoCaptcha.Examples
{
internal class AudioCaptchaExample
public class AudioCaptchaExample
{
public void Main()
public AudioCaptchaExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

byte[] bytes = File.ReadAllBytes("../../resources/audio-en.mp3");
byte[] bytes = File.ReadAllBytes("resources/audio-en.mp3");
string base64EncodedImage = Convert.ToBase64String(bytes);

AudioCaptcha captcha = new AudioCaptcha();
8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/AudioCaptchaOpdionsExample.cs
Original file line number Diff line number Diff line change
@@ -5,13 +5,13 @@

namespace TwoCaptcha.Examples
{
internal class AudioCaptchaOptionsExample
public class AudioCaptchaOptionsExample
{
public void Main()
public AudioCaptchaOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

byte[] bytes = File.ReadAllBytes("../../resources/audio-ru.mp3");
byte[] bytes = File.ReadAllBytes("resources/audio-ru.mp3");
string base64EncodedImage = Convert.ToBase64String(bytes);

AudioCaptcha captcha = new AudioCaptcha();
6 changes: 3 additions & 3 deletions TwoCaptcha.Examples/CanvasBase64Example.cs
Original file line number Diff line number Diff line change
@@ -7,11 +7,11 @@ namespace TwoCaptcha.Examples
{
public class CanvasBase64Example
{
public void Main()
public CanvasBase64Example(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

byte[] bytes = File.ReadAllBytes("../../resources/canvas.jpg");
byte[] bytes = File.ReadAllBytes("resources/canvas.jpg");
string base64EncodedImage = Convert.ToBase64String(bytes);

Canvas captcha = new Canvas();
6 changes: 3 additions & 3 deletions TwoCaptcha.Examples/CanvasExample.cs
Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@ namespace TwoCaptcha.Examples
{
public class CanvasExample
{
public void Main()
public CanvasExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Canvas captcha = new Canvas();
captcha.SetFile("../../resources/canvas.jpg");
captcha.SetFile("resources/canvas.jpg");
captcha.SetHintText("Draw around apple");

try
8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/CanvasOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -7,16 +7,16 @@ namespace TwoCaptcha.Examples
{
public class CanvasOptionsExample
{
public void Main()
public CanvasOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Canvas captcha = new Canvas();
captcha.SetFile("../../resources/canvas.jpg");
captcha.SetFile("resources/canvas.jpg");
captcha.SetPreviousId(0);
captcha.SetCanSkip(false);
captcha.SetLang("en");
captcha.SetHintImg(new FileInfo("../../resources/canvas_hint.jpg"));
captcha.SetHintImg(new FileInfo("resources/canvas_hint.jpg"));
captcha.SetHintText("Draw around apple");

try
4 changes: 2 additions & 2 deletions TwoCaptcha.Examples/CapyExample.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ namespace TwoCaptcha.Examples
{
public class CapyExample
{
public void Main()
public CapyExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Capy captcha = new Capy();
captcha.SetSiteKey("PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v");
4 changes: 2 additions & 2 deletions TwoCaptcha.Examples/CapyOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ namespace TwoCaptcha.Examples
{
public class CapyOptionsExample
{
public void Main()
public CapyOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Capy captcha = new Capy();
captcha.SetSiteKey("PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v");
6 changes: 3 additions & 3 deletions TwoCaptcha.Examples/CoordinatesBase64Example.cs
Original file line number Diff line number Diff line change
@@ -7,11 +7,11 @@ namespace TwoCaptcha.Examples
{
public class CoordinatesBase64Example
{
public void Main()
public CoordinatesBase64Example(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

byte[] bytes = File.ReadAllBytes("../../resources/grid.jpg");
byte[] bytes = File.ReadAllBytes("resources/grid.jpg");
string base64EncodedImage = Convert.ToBase64String(bytes);

Coordinates captcha = new Coordinates();
6 changes: 3 additions & 3 deletions TwoCaptcha.Examples/CoordinatesExample.cs
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@ namespace TwoCaptcha.Examples
{
public class CoordinatesExample
{
public void Main()
public CoordinatesExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Coordinates captcha = new Coordinates("../../resources/grid.jpg");
Coordinates captcha = new Coordinates("resources/grid.jpg");

try
{
8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/CoordinatesOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -7,14 +7,14 @@ namespace TwoCaptcha.Examples
{
public class CoordinatesOptionsExample
{
public void Main()
public CoordinatesOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Coordinates captcha = new Coordinates();
captcha.SetFile("src/main/resources/grid_2.jpg");
captcha.SetFile("resources/grid_2.jpg");
captcha.SetLang("en");
captcha.SetHintImg(new FileInfo("../../resources/grid_hint.jpg"));
captcha.SetHintImg(new FileInfo("resources/grid_hint.jpg"));
captcha.SetHintText("Select all images with an Orange");

try
29 changes: 29 additions & 0 deletions TwoCaptcha.Examples/CutcaptchaExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Linq;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Examples
{
public class CutcaptchaExample
{
public CutcaptchaExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha(apiKey);

Cutcaptcha cutcaptcha = new Cutcaptcha();
cutcaptcha.SetMiseryKey("a1488b66da00bf332a1488993a5443c79047e752");
cutcaptcha.SetPageUrl("https://example.cc/foo/bar.html");
cutcaptcha.SetApiKey("SAb83IIB");

try
{
solver.Solve(cutcaptcha).Wait();
Console.WriteLine("Captcha solved: " + cutcaptcha.Code);
}
catch (AggregateException e)
{
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
}
}
}
}
29 changes: 29 additions & 0 deletions TwoCaptcha.Examples/CyberSiARAExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Linq;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Examples
{
public class CyberSiARAExample
{
public CyberSiARAExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha(apiKey);

CyberSiARA cyberSiARA = new CyberSiARA();
cyberSiARA.SetMasterUrlId("tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv");
cyberSiARA.SetPageUrl("https://demo.mycybersiara.com/");
cyberSiARA.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36");

try
{
solver.Solve(cyberSiARA).Wait();
Console.WriteLine("Captcha solved: " + cyberSiARA.Code);
}
catch (AggregateException e)
{
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
}
}
}
}
30 changes: 30 additions & 0 deletions TwoCaptcha.Examples/DataDomeExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Linq;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Examples
{
public class DataDomeExample
{
public DataDomeExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha(apiKey);

DataDome dataDome = new DataDome();
dataDome.SetCapthaUrl("https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAA...P~XFrBVptk&t=fe&referer=https%3A%2F%2Fhexample.com&s=45239&e=c538be..c510a00ea");
dataDome.SetPageUrl("https://example.com/");
dataDome.SetProxy("http", "username:password@1.2.3.4:5678");
dataDome.SetUserAgent("Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.3");

try
{
solver.Solve(dataDome).Wait();
Console.WriteLine("Captcha solved: " + dataDome.Code);
}
catch (AggregateException e)
{
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@

namespace TwoCaptcha.Examples
{
public class HCaptchaExample
public class FriendlyCaptchaExample
{
public void Main()
public FriendlyCaptchaExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

HCaptcha captcha = new HCaptcha();
captcha.SetSiteKey("10000000-ffff-ffff-ffff-000000000001");
captcha.SetUrl("https://www.site.com/page/");
FriendlyCaptcha captcha = new FriendlyCaptcha();
captcha.SetSiteKey("2FZFEVS1FZCGQ9");
captcha.SetUrl("https://example.com");

try
{
5 changes: 3 additions & 2 deletions TwoCaptcha.Examples/FunCaptchaExample.cs
Original file line number Diff line number Diff line change
@@ -5,10 +5,11 @@
namespace TwoCaptcha.Examples
{
public class FunCaptchaExample

{
public void Main()
public FunCaptchaExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

FunCaptcha captcha = new FunCaptcha();
captcha.SetSiteKey("69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC");
4 changes: 2 additions & 2 deletions TwoCaptcha.Examples/FunCaptchaOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ namespace TwoCaptcha.Examples
{
public class FunCaptchaOptionsExample
{
public void Main()
public FunCaptchaOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

FunCaptcha captcha = new FunCaptcha();
captcha.SetSiteKey("69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC");
8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/GeeTestExample.cs
Original file line number Diff line number Diff line change
@@ -6,15 +6,15 @@ namespace TwoCaptcha.Examples
{
public class GeeTestExample
{
public void Main()
public GeeTestExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

GeeTest captcha = new GeeTest();
captcha.SetGt("f2ae6cadcf7886856696502e1d55e00c");
captcha.SetApiServer("api-na.geetest.com");
captcha.SetApiServer("api.geetest.com");
captcha.SetChallenge("12345678abc90123d45678ef90123a456b");
captcha.SetUrl("https://mysite.com/captcha.html");
captcha.SetUrl("https://2captcha.com/demo/geetest");

try
{
8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/GeeTestOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,15 +6,15 @@ namespace TwoCaptcha.Examples
{
public class GeeTestOptionsExample
{
public void Main()
public GeeTestOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

GeeTest captcha = new GeeTest();
captcha.SetGt("f2ae6cadcf7886856696502e1d55e00c");
captcha.SetApiServer("api-na.geetest.com");
captcha.SetApiServer("api.geetest.com");
captcha.SetChallenge("12345678abc90123d45678ef90123a456b");
captcha.SetUrl("https://mysite.com/captcha.html");
captcha.SetUrl("https://2captcha.com/demo/geetest");
captcha.SetProxy("HTTPS", "login:password@IP_address:PORT");

try
6 changes: 3 additions & 3 deletions TwoCaptcha.Examples/GeeTestV4Example.cs
Original file line number Diff line number Diff line change
@@ -6,14 +6,14 @@ namespace TwoCaptcha.Examples
{
public class GeeTestV4Example
{
public void Main()
public GeeTestV4Example(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

GeeTestV4 captcha = new GeeTestV4();
captcha.SetCaptchaId("72bf15796d0b69c43867452fea615052");
captcha.SetChallenge("12345678abc90123d45678ef90123a456b");
captcha.SetUrl("https://mysite.com/captcha.html");
captcha.SetUrl("https://2captcha.com/demo/geetest-v4");

try
{
6 changes: 3 additions & 3 deletions TwoCaptcha.Examples/GeeTestV4OptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,14 +6,14 @@ namespace TwoCaptcha.Examples
{
public class GeeTestV4OptionsExample
{
public void Main()
public GeeTestV4OptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

GeeTestV4 captcha = new GeeTestV4();
captcha.SetCaptchaId("72bf15796d0b69c43867452fea615052");
captcha.SetChallenge("12345678abc90123d45678ef90123a456b");
captcha.SetUrl("https://mysite.com/captcha.html");
captcha.SetUrl("https://2captcha.com/demo/geetest-v4");
captcha.SetProxy("HTTPS", "login:password@IP_address:PORT");

try
7 changes: 4 additions & 3 deletions TwoCaptcha.Examples/GridBase64Example.cs
Original file line number Diff line number Diff line change
@@ -7,15 +7,16 @@ namespace TwoCaptcha.Examples
{
public class GridBase64Example
{
public void Main()
public GridBase64Example(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

byte[] bytes = File.ReadAllBytes("../../resources/grid.jpg");
byte[] bytes = File.ReadAllBytes("resources/grid.jpg");
string base64EncodedImage = Convert.ToBase64String(bytes);

Grid captcha = new Grid();
captcha.SetBase64(base64EncodedImage);
captcha.SetHintText("Select all images with an Orange");

try
{
7 changes: 4 additions & 3 deletions TwoCaptcha.Examples/GridExample.cs
Original file line number Diff line number Diff line change
@@ -6,11 +6,12 @@ namespace TwoCaptcha.Examples
{
public class GridExample
{
public void Main()
public GridExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Grid captcha = new Grid("../../resources/grid.jpg");
Grid captcha = new Grid("resources/grid.jpg");
captcha.SetHintText("Select all images with an Orange");

try
{
8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/GridOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -7,18 +7,18 @@ namespace TwoCaptcha.Examples
{
public class GridOptionsExample
{
public void Main()
public GridOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Grid captcha = new Grid();
captcha.SetFile("../../resources/grid_2.jpg");
captcha.SetFile("resources/grid_2.jpg");
captcha.SetRows(3);
captcha.SetCols(3);
captcha.SetPreviousId(0);
captcha.SetCanSkip(false);
captcha.SetLang("en");
captcha.SetHintImg(new FileInfo("../../resources/grid_hint.jpg"));
captcha.SetHintImg(new FileInfo("resources/grid_hint.jpg"));
captcha.SetHintText("Select all images with an Orange");

try
29 changes: 0 additions & 29 deletions TwoCaptcha.Examples/HCaptchaOptionsExample.cs

This file was deleted.

14 changes: 7 additions & 7 deletions TwoCaptcha.Examples/KeyCaptchaExample.cs
Original file line number Diff line number Diff line change
@@ -6,16 +6,16 @@ namespace TwoCaptcha.Examples
{
public class KeyCaptchaExample
{
public void Main()
public KeyCaptchaExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

KeyCaptcha captcha = new KeyCaptcha();
captcha.SetUserId(10);
captcha.SetSessionId("493e52c37c10c2bcdf4a00cbc9ccd1e8");
captcha.SetWebServerSign("9006dc725760858e4c0715b835472f22");
captcha.SetWebServerSign2("2ca3abe86d90c6142d5571db98af6714");
captcha.SetUrl("https://www.keycaptcha.ru/demo-magnetic/");
captcha.SetUserId(184015);
captcha.SetSessionId("9ff29e0176e78eb7ba59314f92dbac1b");
captcha.SetWebServerSign("964635241a3e5e76980f2572e5f63452");
captcha.SetWebServerSign2("3ca802a38ffc5831fa293ac2819b1204");
captcha.SetUrl("https://2captcha.com/demo/keycaptcha");

try
{
14 changes: 7 additions & 7 deletions TwoCaptcha.Examples/KeyCaptchaOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,16 +6,16 @@ namespace TwoCaptcha.Examples
{
public class KeyCaptchaOptionsExample
{
public void Main()
public KeyCaptchaOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

KeyCaptcha captcha = new KeyCaptcha();
captcha.SetUserId(10);
captcha.SetSessionId("493e52c37c10c2bcdf4a00cbc9ccd1e8");
captcha.SetWebServerSign("9006dc725760858e4c0715b835472f22");
captcha.SetWebServerSign2("2ca3abe86d90c6142d5571db98af6714");
captcha.SetUrl("https://www.keycaptcha.ru/demo-magnetic/");
captcha.SetUserId(184015);
captcha.SetSessionId("9ff29e0176e78eb7ba59314f92dbac1b");
captcha.SetWebServerSign("964635241a3e5e76980f2572e5f63452");
captcha.SetWebServerSign2("3ca802a38ffc5831fa293ac2819b1204");
captcha.SetUrl("https://2captcha.com/demo/keycaptcha");
captcha.SetProxy("HTTPS", "login:password@IP_address:PORT");

try
8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/LeminExample.cs
Original file line number Diff line number Diff line change
@@ -6,14 +6,14 @@ namespace TwoCaptcha.Examples
{
public class LeminExample
{
public void Main()
public LeminExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Lemin captcha = new Lemin();
captcha.SetCaptchaId("CROPPED_d3d4d56_73ca4008925b4f83a8bed59c2dd0df6d");
captcha.SetCaptchaId("CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b");
captcha.SetApiServer("api.leminnow.com");
captcha.SetUrl("http://sat2.aksigorta.com.tr");
captcha.SetUrl("https://2captcha.com/demo/lemin");

try
{
8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/LeminOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,14 +6,14 @@ namespace TwoCaptcha.Examples
{
public class LeminOptionsExample
{
public void Main()
public LeminOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Lemin captcha = new Lemin();
captcha.SetCaptchaId("CROPPED_d3d4d56_73ca4008925b4f83a8bed59c2dd0df6d");
captcha.SetCaptchaId("CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b");
captcha.SetApiServer("api.leminnow.com");
captcha.SetUrl("http://sat2.aksigorta.com.tr");
captcha.SetUrl("https://2captcha.com/demo/lemin");
captcha.SetProxy("HTTPS", "login:password@IP_address:PORT");

try
28 changes: 28 additions & 0 deletions TwoCaptcha.Examples/MTCaptchaExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Linq;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Examples
{
public class MTCaptchaExample
{
public MTCaptchaExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha(apiKey);

MTCaptcha mtCaptcha = new MTCaptcha();
mtCaptcha.SetSiteKey("MTPublic-KzqLY1cKH");
mtCaptcha.SetPageUrl("https://2captcha.com/demo/mtcaptcha");

try
{
solver.Solve(mtCaptcha).Wait();
Console.WriteLine("Captcha solved: " + mtCaptcha.Code);
}
catch (AggregateException e)
{
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
}
}
}
}
7 changes: 4 additions & 3 deletions TwoCaptcha.Examples/NormalBase64Example.cs
Original file line number Diff line number Diff line change
@@ -7,11 +7,12 @@ namespace TwoCaptcha.Examples
{
public class NormalBase64Example
{
public void Main()

public NormalBase64Example(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

byte[] bytes = File.ReadAllBytes("../../resources/normal.jpg");
byte[] bytes = File.ReadAllBytes("resources/normal.jpg");
string base64EncodedImage = Convert.ToBase64String(bytes);

Normal captcha = new Normal();
6 changes: 3 additions & 3 deletions TwoCaptcha.Examples/NormalExample.cs
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@ namespace TwoCaptcha.Examples
{
public class NormalExample
{
public static void Main()
public NormalExample(string apiKey)
{
var solver = new TwoCaptcha("YOUR_API_KEY");
var solver = new TwoCaptcha(apiKey);

Normal captcha = new Normal("../../resources/normal.jpg");
Normal captcha = new Normal("resources/normal.jpg");

try
{
10 changes: 5 additions & 5 deletions TwoCaptcha.Examples/NormalOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -7,21 +7,21 @@ namespace TwoCaptcha.Examples
{
public class NormalOptionsExample
{
public void Main()
public NormalOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Normal captcha = new Normal();
captcha.SetFile("../../resources/normal_2.jpg");
captcha.SetFile("resources/normal_2.jpg");
captcha.SetNumeric(4);
captcha.SetMinLen(4);
captcha.SetMaxLen(20);
captcha.SetPhrase(true);
captcha.SetCaseSensitive(true);
captcha.SetCalc(false);
captcha.SetLang("en");
captcha.SetHintImg(new FileInfo("../../resources/normal_hint.jpg"));
captcha.SetHintText("Type red symbols only");
captcha.SetHintImg(new FileInfo("resources/normal_hint.jpg"));
captcha.SetHintText("Type text");

try
{
20 changes: 20 additions & 0 deletions TwoCaptcha.Examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Examples

In the `TwoCaptcha.Examples` directory, you will find files with examples of solving supported captcha types.
For the successful execution of some examples, it is necessary to update the parameters of the captcha being sent.

To run an example, follow these steps:

1. Open and build the project `Two Captcha.Examples.csproj`
2. Navigate to the output directory.
3. Run the `TwoCaptcha.Examples.exe` file by passing two arguments. The first argument is the class name, which exactly matches the class name from the example. The second argument is the `apikey`.

Example command to run the `TencentExample.cs` file:

```cmd
TwoCaptcha.Examples.exe TencentExample 12345678abcd9012345678abcd901234
```

You can find the full list of supported examples in the [Run.cs](./Run.cs) file.


8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/ReCaptchaV2Example.cs
Original file line number Diff line number Diff line change
@@ -6,13 +6,13 @@ namespace TwoCaptcha.Examples
{
public class ReCaptchaV2Example
{
public void Main()
public ReCaptchaV2Example(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

ReCaptcha captcha = new ReCaptcha();
captcha.SetSiteKey("6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-");
captcha.SetUrl("https://mysite.com/page/with/recaptcha");
captcha.SetSiteKey("6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u");
captcha.SetUrl("https://2captcha.com/demo/recaptcha-v2");

try
{
8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/ReCaptchaV2OptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,13 +6,13 @@ namespace TwoCaptcha.Examples
{
public class ReCaptchaV2OptionsExample
{
public void Main()
public ReCaptchaV2OptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

ReCaptcha captcha = new ReCaptcha();
captcha.SetSiteKey("6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-");
captcha.SetUrl("https://mysite.com/page/with/recaptcha");
captcha.SetSiteKey("6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u");
captcha.SetUrl("https://2captcha.com/demo/recaptcha-v2");
captcha.SetInvisible(true);
captcha.SetDomain("google.com");
captcha.SetAction("verify");
8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/ReCaptchaV3Example.cs
Original file line number Diff line number Diff line change
@@ -6,13 +6,13 @@ namespace TwoCaptcha.Examples
{
public class ReCaptchaV3Example
{
public void Main()
public ReCaptchaV3Example(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

ReCaptcha captcha = new ReCaptcha();
captcha.SetSiteKey("6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-");
captcha.SetUrl("https://mysite.com/page/with/recaptcha");
captcha.SetSiteKey("6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu");
captcha.SetUrl("https://2captcha.com/demo/recaptcha-v3");
captcha.SetVersion("v3");

try
10 changes: 5 additions & 5 deletions TwoCaptcha.Examples/ReCaptchaV3OptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,16 +6,16 @@ namespace TwoCaptcha.Examples
{
public class ReCaptchaV3OptionsExample
{
public void Main()
public ReCaptchaV3OptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

ReCaptcha captcha = new ReCaptcha();
captcha.SetSiteKey("6Le-wvkSVVABCPBMRTvw0Q4Muexq1bi0DJwx_mJ-");
captcha.SetUrl("https://mysite.com/page/with/recaptcha");
captcha.SetSiteKey("6LfB5_IbAAAAAMCtsjEHEHKqcB9iQocwwxTiihJu");
captcha.SetUrl("https://2captcha.com/demo/recaptcha-v3");
captcha.SetVersion("v3");
captcha.SetDomain("google.com");
captcha.SetAction("verify");
captcha.SetAction("demo_action");
captcha.SetScore(0.3);
captcha.SetEnterprise(false);
captcha.SetProxy("HTTPS", "login:password@IP_address:PORT");
6 changes: 3 additions & 3 deletions TwoCaptcha.Examples/RotateExample.cs
Original file line number Diff line number Diff line change
@@ -7,11 +7,11 @@ namespace TwoCaptcha.Examples
{
public class RotateExample
{
public void Main()
public RotateExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

byte[] bytes = File.ReadAllBytes("../../resources/rotate.jpg");
byte[] bytes = File.ReadAllBytes("resources/rotate.jpg");
string base64EncodedImage = Convert.ToBase64String(bytes);
Console.WriteLine("base64EncodedImage: " + base64EncodedImage);

8 changes: 4 additions & 4 deletions TwoCaptcha.Examples/RotateOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -7,19 +7,19 @@ namespace TwoCaptcha.Examples
{
public class RotateOptionsExample
{
public void Main()
public RotateOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

byte[] bytes = File.ReadAllBytes("../../resources/rotate.jpg");
byte[] bytes = File.ReadAllBytes("resources/rotate.jpg");
string base64EncodedImage = Convert.ToBase64String(bytes);


Rotate captcha = new Rotate();
captcha.SetBase64(base64EncodedImage);
captcha.SetAngle(40);
captcha.SetLang("en");
captcha.SetHintImg(new FileInfo("../../resources/rotate.jpg"));
captcha.SetHintImg(new FileInfo("resources/rotate_hint.jpg"));
captcha.SetHintText("Put the images in the correct way up");

try
203 changes: 203 additions & 0 deletions TwoCaptcha.Examples/Run.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
using System;
using System.Runtime.ConstrainedExecution;
using TwoCaptcha.Examples;

public class Run
{
public static void Main(string[] args)
{
string classToRun = args[0];
string apiKey = args[1];

switch (classToRun)
{
case "TextExample":
TextExample textExample = new TextExample(apiKey);
break;

case "TextOptionsExample":
TextOptionsExample TextOptionsExample = new TextOptionsExample(apiKey);
break;

case "MTCaptchaExample":
MTCaptchaExample mtCaptchaExample = new MTCaptchaExample(apiKey);
break;

case "CutcaptchaExample":
CutcaptchaExample cutcaptchaExample = new CutcaptchaExample(apiKey);
break;

case "CyberSiARAExample":
CyberSiARAExample cyberSiARAExample = new CyberSiARAExample(apiKey);
break;

case "DataDomeExample":
DataDomeExample dataDomeExample = new DataDomeExample(apiKey);
break;

case "AtbCAPTCHAExample":
AtbCAPTCHAExample atbCAPTCHAExample = new AtbCAPTCHAExample(apiKey);
break;

case "TencentExample":
TencentExample tencentExample = new TencentExample(apiKey);
break;

case "AmazonWafExample":
AmazonWafExample amazonWafExample = new AmazonWafExample(apiKey);
break;

case "AmazonWafOptionsExample":
AmazonWafOptionsExample amazonWafOptionsExample = new AmazonWafOptionsExample(apiKey);
break;

case "AudioCaptchaExample":
AudioCaptchaExample AudioCaptchaExample = new AudioCaptchaExample(apiKey);
break;

case "AudioCaptchaOptionsExample":
AudioCaptchaOptionsExample AudioCaptchaOptionsExample = new AudioCaptchaOptionsExample(apiKey);
break;

case "CanvasExample":
CanvasExample CanvasExample = new CanvasExample(apiKey);
break;

case "CanvasBase64Example":
CanvasBase64Example CanvasBase64Example = new CanvasBase64Example(apiKey);
break;

case "CanvasOptionsExample":
CanvasOptionsExample CanvasOptionsExample = new CanvasOptionsExample(apiKey);
break;

case "CapyExample":
CapyExample CapyExample = new CapyExample(apiKey);
break;

case "CapyOptionsExample":
CapyOptionsExample CapyOptionsExample = new CapyOptionsExample(apiKey);
break;

case "CoordinatesExample":
CoordinatesExample CoordinatesExample = new CoordinatesExample(apiKey);
break;

case "CoordinatesBase64Example":
CoordinatesBase64Example CoordinatesBase64Example = new CoordinatesBase64Example(apiKey);
break;

case "CoordinatesOptionsExample":
CoordinatesOptionsExample CoordinatesOptionsExample = new CoordinatesOptionsExample(apiKey);
break;

case "FriendlyCaptchaExample":
FriendlyCaptchaExample FriendlyCaptchaExample = new FriendlyCaptchaExample(apiKey);
break;

case "FunCaptchaExample":
FunCaptchaExample FunCaptchaExample = new FunCaptchaExample(apiKey);
break;

case "FunCaptchaOptionsExample":
FunCaptchaOptionsExample FunCaptchaOptionsExample = new FunCaptchaOptionsExample(apiKey);
break;

case "GeeTestExample":
GeeTestExample GeeTestExample = new GeeTestExample(apiKey);
break;

case "GeeTestOptionsExample":
GeeTestOptionsExample GeeTestOptionsExample = new GeeTestOptionsExample(apiKey);
break;

case "GeeTestV4Example":
GeeTestV4Example GeeTestV4Example = new GeeTestV4Example(apiKey);
break;

case "GeeTestV4OptionsExample":
GeeTestV4OptionsExample GeeTestV4OptionsExample = new GeeTestV4OptionsExample(apiKey);
break;

case "GridExample":
GridExample GridExample = new GridExample(apiKey);
break;

case "GridBase64Example":
GridBase64Example GridBase64Example = new GridBase64Example(apiKey);
break;

case "GridOptionsExample":
GridOptionsExample GridOptionsExample = new GridOptionsExample(apiKey);
break;

case "KeyCaptchaExample":
KeyCaptchaExample KeyCaptchaExample = new KeyCaptchaExample(apiKey);
break;

case "KeyCaptchaOptionsExample":
KeyCaptchaOptionsExample KeyCaptchaOptionsExample = new KeyCaptchaOptionsExample(apiKey);
break;

case "LeminExample":
LeminExample LeminExample = new LeminExample(apiKey);
break;

case "LeminOptionsExample":
LeminOptionsExample LeminOptionsExample = new LeminOptionsExample(apiKey);
break;

case "NormalExample":
NormalExample NormalExample = new NormalExample(apiKey);
break;

case "NormalBase64Example":
NormalBase64Example NormalBase64Example = new NormalBase64Example(apiKey);
break;

case "NormalOptionsExample":
NormalOptionsExample NormalOptionsExample = new NormalOptionsExample(apiKey);
break;

case "ReCaptchaV2Example":
ReCaptchaV2Example ReCaptchaV2Example = new ReCaptchaV2Example(apiKey);
break;

case "ReCaptchaV2OptionsExample":
ReCaptchaV2OptionsExample ReCaptchaV2OptionsExample = new ReCaptchaV2OptionsExample(apiKey);
break;

case "ReCaptchaV3Example":
ReCaptchaV3Example ReCaptchaV3Example = new ReCaptchaV3Example(apiKey);
break;

case "ReCaptchaV3OptionsExample":
ReCaptchaV3OptionsExample ReCaptchaV3OptionsExample = new ReCaptchaV3OptionsExample(apiKey);
break;

case "RotateExample":
RotateExample RotateExample = new RotateExample(apiKey);
break;

case "RotateOptionsExample":
RotateOptionsExample RotateOptionsExample = new RotateOptionsExample(apiKey);
break;

case "TurnstileExample":
TurnstileExample TurnstileExample = new TurnstileExample(apiKey);
break;

case "TurnstileOptionsExample":
TurnstileOptionsExample TurnstileOptionsExample = new TurnstileOptionsExample(apiKey);
break;

case "YandexExample":
YandexExample YandexExample = new YandexExample(apiKey);
break;

case "YandexOptionsExample":
YandexOptionsExample YandexOptionsExample = new YandexOptionsExample(apiKey);
break;
}
}
}
28 changes: 28 additions & 0 deletions TwoCaptcha.Examples/TencentExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Linq;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Examples
{
public class TencentExample
{
public TencentExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha(apiKey);

Tencent tencent = new Tencent();
tencent.SetAppId("190014885");
tencent.SetPageUrl("https://www.example.com/");

try
{
solver.Solve(tencent).Wait();
Console.WriteLine("Captcha solved: " + tencent.Code);
}
catch (AggregateException e)
{
Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
}
}
}
}
4 changes: 2 additions & 2 deletions TwoCaptcha.Examples/TextExample.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ namespace TwoCaptcha.Examples
{
public class TextExample
{
public void Main()
public TextExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Text captcha = new Text("If tomorrow is Saturday, what day is today?");

4 changes: 2 additions & 2 deletions TwoCaptcha.Examples/TextOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ namespace TwoCaptcha.Examples
{
public class TextOptionsExample
{
public void Main()
public TextOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Text captcha = new Text();
captcha.SetText("If tomorrow is Saturday, what day is today?");
4 changes: 2 additions & 2 deletions TwoCaptcha.Examples/TurnstileExample.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ namespace TwoCaptcha.Examples
{
public class TurnstileExample
{
public void Main()
public TurnstileExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Turnstile captcha = new Turnstile();
captcha.SetSiteKey("0x4AAAAAAAChNiVJM_WtShFf");
4 changes: 2 additions & 2 deletions TwoCaptcha.Examples/TurnstileOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ namespace TwoCaptcha.Examples
{
public class TurnstileOptionsExample
{
public void Main()
public TurnstileOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Turnstile captcha = new Turnstile();
captcha.SetSiteKey("0x4AAAAAAAChNiVJM_WtShFf");
72 changes: 72 additions & 0 deletions TwoCaptcha.Examples/TwoCaptcha.Examples.csproj
Original file line number Diff line number Diff line change
@@ -10,4 +10,76 @@
<ProjectReference Include="..\TwoCaptcha\TwoCaptcha.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="resources\audio-en.mp3">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="resources\audio-ru.mp3">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="resources\canvas.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="resources\canvas_hint.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="resources\grid.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="resources\grid_2.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="resources\grid_hint.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="resources\normal.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="resources\normal_2.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="resources\normal_hint.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="resources\rotate.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="resources\rotate_hint.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions TwoCaptcha.Examples/YandexExample.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ namespace TwoCaptcha.Examples
{
public class YandexExample
{
public void Main()
public YandexExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Yandex captcha = new Yandex();
captcha.SetSiteKey("Y5Lh0tiycconMJGsFd3EbbuNKSp1yaZESUOIHfeV");
4 changes: 2 additions & 2 deletions TwoCaptcha.Examples/YandexOptionsExample.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ namespace TwoCaptcha.Examples
{
public class YandexOptionsExample
{
public void Main()
public YandexOptionsExample(string apiKey)
{
TwoCaptcha solver = new TwoCaptcha("YOUR_API_KEY");
TwoCaptcha solver = new TwoCaptcha(apiKey);

Yandex captcha = new Yandex();
captcha.SetSiteKey("Y5Lh0tiycconMJGsFd3EbbuNKSp1yaZESUOIHfeV");
Binary file added TwoCaptcha.Examples/resources/normal_hint.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added TwoCaptcha.Examples/resources/rotate_hint.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions TwoCaptcha.Tests/AmazonWafTest.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ public async Task TestAllOptions()
parameters["pageurl"] = "https://non-existent-example.execute-api.us-east-1.amazonaws.com";
parameters["context"] = "test_iv";
parameters["iv"] = "test_context";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
29 changes: 29 additions & 0 deletions TwoCaptcha.Tests/AtbCAPTCHATest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Tests
{
[TestFixture]
public class AtbCaptchaTest : AbstractWrapperTestCase
{
[Test]
public async Task TestAllOptions()
{
AtbCAPTCHA atbCAPTCHA = new AtbCAPTCHA();
atbCAPTCHA.SetAppId("af23e041b22d000a11e22a230fa8991c");
atbCAPTCHA.SetApiServer("https://cap.aisecurius.com");
atbCAPTCHA.SetPageUrl("https://www.example.com/");

var parameters = new Dictionary<string, string>();
parameters["method"] = "atb_captcha";
parameters["app_id"] = "af23e041b22d000a11e22a230fa8991c";
parameters["api_server"] = "https://cap.aisecurius.com";
parameters["pageurl"] = "https://www.example.com/";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(atbCAPTCHA, parameters);
}
}
}
1 change: 1 addition & 0 deletions TwoCaptcha.Tests/AudioTest.cs
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ public async Task TestAllParameters()
parameters["method"] = "audio";
parameters["lang"] = "en";
parameters["body"] = base64EncodedImage;
parameters["soft_id"] = "4582";


await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
3 changes: 3 additions & 0 deletions TwoCaptcha.Tests/CanvasTest.cs
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ public async Task TestSingleFile()
parameters["recaptcha"] = "1";
parameters["canvas"] = "1";
parameters["textinstructions"] = hintText;
parameters["soft_id"] = "4582";

var files = new Dictionary<string, FileInfo>();
files["file"] = image;
@@ -50,6 +51,7 @@ public async Task TestBase64()
parameters["canvas"] = "1";
parameters["body"] = "...";
parameters["textinstructions"] = hintText;
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
@@ -76,6 +78,7 @@ public async Task TestAllParameters()
parameters["can_no_answer"] = "0";
parameters["lang"] = "en";
parameters["textinstructions"] = hintText;
parameters["soft_id"] = "4582";

var files = new Dictionary<string, FileInfo>();
files["file"] = image;
1 change: 1 addition & 0 deletions TwoCaptcha.Tests/CapyTest.cs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ public async Task TestAllOptions()
parameters["captchakey"] = "PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v";
parameters["pageurl"] = "http://mysite.com/";
parameters["api_server"] = "https://myapiserver.com/";
parameters["soft_id"] = "4582";


await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
4 changes: 4 additions & 0 deletions TwoCaptcha.Tests/CoordinatesTest.cs
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ public async Task TestSingleFile()
var parameters = new Dictionary<string, string>();
parameters["method"] = "post";
parameters["coordinatescaptcha"] = "1";
parameters["soft_id"] = "4582";

var files = new Dictionary<string, FileInfo>();
files["file"] = image;
@@ -42,6 +43,7 @@ public async Task TestSingleFileParameter()
var parameters = new Dictionary<string, string>();
parameters["method"] = "post";
parameters["coordinatescaptcha"] = "1";
parameters["soft_id"] = "4582";

var files = new Dictionary<string, FileInfo>();
files["file"] = image;
@@ -59,6 +61,7 @@ public async Task TestBase64()
parameters["method"] = "base64";
parameters["coordinatescaptcha"] = "1";
parameters["body"] = "...";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
@@ -80,6 +83,7 @@ public async Task TestAllParameters()
parameters["coordinatescaptcha"] = "1";
parameters["lang"] = "en";
parameters["textinstructions"] = hintText;
parameters["soft_id"] = "4582";

var files = new Dictionary<string, FileInfo>();
files["file"] = image;
28 changes: 28 additions & 0 deletions TwoCaptcha.Tests/CutcaptchaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Tests
{
class CutcaptchaTest : AbstractWrapperTestCase
{
[Test]
public async Task TestAllOptions()
{
Cutcaptcha cutcaptcha = new Cutcaptcha();
cutcaptcha.SetMiseryKey("a1488b66da00bf332a1488993a5443c79047e752");
cutcaptcha.SetPageUrl("https://example.cc/foo/bar.html");
cutcaptcha.SetApiKey("SAb83IIB");

var parameters = new Dictionary<string, string>();
parameters["method"] = "cutcaptcha";
parameters["misery_key"] = "a1488b66da00bf332a1488993a5443c79047e752";
parameters["pageurl"] = "https://example.cc/foo/bar.html";
parameters["api_key"] = "SAb83IIB";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(cutcaptcha, parameters);
}
}
}
28 changes: 28 additions & 0 deletions TwoCaptcha.Tests/CyberSiARATest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Tests
{
class CyberSiARATest : AbstractWrapperTestCase
{
[Test]
public async Task TestAllOptions()
{
CyberSiARA cyberSiARA = new CyberSiARA();
cyberSiARA.SetMasterUrlId("tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv");
cyberSiARA.SetPageUrl("https://demo.mycybersiara.com/");
cyberSiARA.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36");

var parameters = new Dictionary<string, string>();
parameters["method"] = "cybersiara";
parameters["master_url_id"] = "tpjOCKjjpdzv3d8Ub2E9COEWKt1vl1Mv";
parameters["pageurl"] = "https://demo.mycybersiara.com/";
parameters["userAgent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(cyberSiARA, parameters);
}
}
}
35 changes: 35 additions & 0 deletions TwoCaptcha.Tests/DataDomeTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;
using TwoCaptcha.Captcha;
using static System.Net.WebRequestMethods;

namespace TwoCaptcha.Tests
{
[TestFixture]
public class DataDomeTest : AbstractWrapperTestCase
{
[Test]
public async Task TestAllOptions()
{
DataDome dataDome = new DataDome();
dataDome.SetCapthaUrl("https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAA...P~XFrBVptk&t=fe&referer=https%3A%2F%2Fhexample.com&s=45239&e=c538be..c510a00ea");
dataDome.SetPageUrl("https://example.com/");
dataDome.SetProxy("http", "username:password@1.2.3.4:5678");
dataDome.SetUserAgent("Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.3");

var parameters = new Dictionary<string, string>();
parameters["method"] = "datadome";
parameters["captcha_url"] = "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAA...P~XFrBVptk&t=fe&referer=https%3A%2F%2Fhexample.com&s=45239&e=c538be..c510a00ea";
parameters["pageurl"] = "https://example.com/";
parameters["proxy"] = "https://example.com/";
parameters["proxy"] = "username:password@1.2.3.4:5678";
parameters["proxytype"] = "http";
parameters["userAgent"] = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.3";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(dataDome, parameters);
}
}
}
27 changes: 27 additions & 0 deletions TwoCaptcha.Tests/FriendlyCaptchaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Tests
{
[TestFixture]
public class FriendlyCaptchaTest : AbstractWrapperTestCase
{
[Test]
public async Task TestAllOptions()
{
FriendlyCaptcha captcha = new FriendlyCaptcha();
captcha.SetSiteKey("2FZFEVS1FZCGQ9");
captcha.SetUrl("https://www.site.com/page/");

var parameters = new Dictionary<string, string>();
parameters["method"] = "friendly_captcha";
parameters["sitekey"] = "2FZFEVS1FZCGQ9";
parameters["pageurl"] = "https://www.site.com/page/";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
}
}
1 change: 1 addition & 0 deletions TwoCaptcha.Tests/FunCaptchaTest.cs
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ public async Task TestAllOptions()
parameters["surl"] = "https://client-api.arkoselabs.com";
parameters["userAgent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36";
parameters["data[anyKey]"] = "anyStringValue";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
1 change: 1 addition & 0 deletions TwoCaptcha.Tests/GeeTestTest.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ public async Task TestAllOptions()
parameters["api_server"] = "api-na.geetest.com";
parameters["challenge"] = "69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC";
parameters["pageurl"] = "https://launches.endclothing.com/distil_r_captcha.html";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
1 change: 1 addition & 0 deletions TwoCaptcha.Tests/GeeTestV4Test.cs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ public async Task TestAllOptions()
parameters["captcha_id"] = "72bf15796d0b69c43867452fea615052";
parameters["challenge"] = "12345678abc90123d45678ef90123a456b";
parameters["pageurl"] = "https://mysite.com/captcha.html";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
4 changes: 4 additions & 0 deletions TwoCaptcha.Tests/GridTest.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ public async Task TestSingleFile()
var parameters = new Dictionary<string, string>();
parameters["method"] = "post";
parameters["recaptcha"] = "1";
parameters["soft_id"] = "4582";

var files = new Dictionary<string, FileInfo>();
files["file"] = image;
@@ -41,6 +42,7 @@ public async Task TestSingleFileParameter()
var parameters = new Dictionary<string, string>();
parameters["method"] = "post";
parameters["recaptcha"] = "1";
parameters["soft_id"] = "4582";

var files = new Dictionary<string, FileInfo>();
files["file"] = image;
@@ -58,6 +60,7 @@ public async Task TestBase64()
parameters["method"] = "base64";
parameters["body"] = "...";
parameters["recaptcha"] = "1";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
@@ -87,6 +90,7 @@ public async Task TestAllParameters()
parameters["can_no_answer"] = "0";
parameters["lang"] = "en";
parameters["textinstructions"] = hintText;
parameters["soft_id"] = "4582";

var files = new Dictionary<string, FileInfo>();
files["file"] = image;
3 changes: 3 additions & 0 deletions TwoCaptcha.Tests/HCaptchaTest.cs
Original file line number Diff line number Diff line change
@@ -14,11 +14,14 @@ public async Task TestAllOptions()
HCaptcha captcha = new HCaptcha();
captcha.SetSiteKey("f1ab2cdefa3456789012345b6c78d90e");
captcha.SetUrl("https://www.site.com/page/");
captcha.SetData("foo");

var parameters = new Dictionary<string, string>();
parameters["method"] = "hcaptcha";
parameters["sitekey"] = "f1ab2cdefa3456789012345b6c78d90e";
parameters["pageurl"] = "https://www.site.com/page/";
parameters["data"] = "foo";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
1 change: 1 addition & 0 deletions TwoCaptcha.Tests/KeyCaptchaTest.cs
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ public async Task TestAllOptions()
parameters["s_s_c_web_server_sign"] = "9006dc725760858e4c0715b835472f22-pz-";
parameters["s_s_c_web_server_sign2"] = "2ca3abe86d90c6142d5571db98af6714";
parameters["pageurl"] = "https://www.keycaptcha.ru/demo-magnetic/";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
1 change: 1 addition & 0 deletions TwoCaptcha.Tests/LeminTest.cs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ public async Task TestAllOptions()
parameters["captcha_id"] = "CROPPED_d3d4d56_73ca4008925b4f83a8bed59c2dd0df6d";
parameters["api_server"] = "api.leminnow.com";
parameters["pageurl"] = "http://sat2.aksigorta.com.tr";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
27 changes: 27 additions & 0 deletions TwoCaptcha.Tests/MTCaptchaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Tests
{
[TestFixture]
public class MTCaptchaTest : AbstractWrapperTestCase
{
[Test]
public async Task TestAllOptions()
{
MTCaptcha mtCaptcha = new MTCaptcha();
mtCaptcha.SetSiteKey("MTPublic-KzqLY1cKH");
mtCaptcha.SetPageUrl("https://2captcha.com/demo/mtcaptcha");

var parameters = new Dictionary<string, string>();
parameters["method"] = "mt_captcha";
parameters["sitekey"] = "MTPublic-KzqLY1cKH";
parameters["pageurl"] = "https://2captcha.com/demo/mtcaptcha";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(mtCaptcha, parameters);
}
}
}
4 changes: 4 additions & 0 deletions TwoCaptcha.Tests/NormalTest.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ public async Task TestSingleFile()

var parameters = new Dictionary<string, string>();
parameters["method"] = "post";
parameters["soft_id"] = "4582";

var files = new Dictionary<string, FileInfo>();
files["file"] = image;
@@ -40,6 +41,7 @@ public async Task TestSingleFileParameter()

var parameters = new Dictionary<string, string>();
parameters["method"] = "post";
parameters["soft_id"] = "4582";

var files = new Dictionary<string, FileInfo>();
files["file"] = image;
@@ -56,6 +58,7 @@ public async Task TestBase64()
var parameters = new Dictionary<string, string>();
parameters["method"] = "base64";
parameters["body"] = "...";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
@@ -88,6 +91,7 @@ public async Task TestAllParameters()
parameters["calc"] = "0";
parameters["lang"] = "en";
parameters["textinstructions"] = hintText;
parameters["soft_id"] = "4582";

var files = new Dictionary<string, FileInfo>();
files["file"] = image;
4 changes: 4 additions & 0 deletions TwoCaptcha.Tests/ReCaptchaTest.cs
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ public async Task TestV2()
captcha.SetInvisible(true);
captcha.SetAction("verify");
captcha.SetDomain("recaptcha.net");
captcha.SetDataS("foo");

var parameters = new Dictionary<string, string>();
parameters["method"] = "userrecaptcha";
@@ -26,6 +27,8 @@ public async Task TestV2()
parameters["invisible"] = "1";
parameters["action"] = "verify";
parameters["domain"] = "recaptcha.net";
parameters["data-s"] = "foo";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
@@ -49,6 +52,7 @@ public async Task TestV3()
parameters["action"] = "verify";
parameters["min_score"] = "0.3";
parameters["domain"] = "recaptcha.net";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
1 change: 1 addition & 0 deletions TwoCaptcha.Tests/RotateTest.cs
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ public async Task TestAllParameters()
parameters["lang"] = "en";
parameters["textinstructions"] = "Put the images in the correct way up";
parameters["body"] = base64EncodedImage;
parameters["soft_id"] = "4582";


await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
27 changes: 27 additions & 0 deletions TwoCaptcha.Tests/TencentTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;
using TwoCaptcha.Captcha;

namespace TwoCaptcha.Tests
{
[TestFixture]
public class TencentTest : AbstractWrapperTestCase
{
[Test]
public async Task TestAllOptions()
{
Tencent tencent = new Tencent();
tencent.SetAppId("190014885");
tencent.SetPageUrl("https://www.example.com/");

var parameters = new Dictionary<string, string>();
parameters["method"] = "tencent";
parameters["app_id"] = "190014885";
parameters["pageurl"] = "https://www.example.com/";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(tencent, parameters);
}
}
}
3 changes: 3 additions & 0 deletions TwoCaptcha.Tests/TextTest.cs
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ public async Task TestSimpleText()
var parameters = new Dictionary<string, string>();
parameters["method"] = "post";
parameters["textcaptcha"] = question;
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
@@ -31,6 +32,7 @@ public async Task TestTextParameter()
var parameters = new Dictionary<string, string>();
parameters["method"] = "post";
parameters["textcaptcha"] = question;
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
@@ -46,6 +48,7 @@ public async Task TestAllParameters()
parameters["method"] = "post";
parameters["textcaptcha"] = question;
parameters["lang"] = "en";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
7 changes: 7 additions & 0 deletions TwoCaptcha.Tests/TurnstileTest.cs
Original file line number Diff line number Diff line change
@@ -14,11 +14,18 @@ public async Task TestAllOptions()
Turnstile captcha = new Turnstile();
captcha.SetSiteKey("0x4AAAAAAAChNiVJM_WtShFf");
captcha.SetUrl("https://ace.fusionist.io");
captcha.SetData("foo");
captcha.SetPageData("bar");
captcha.SetAction("baz");

var parameters = new Dictionary<string, string>();
parameters["method"] = "turnstile";
parameters["sitekey"] = "0x4AAAAAAAChNiVJM_WtShFf";
parameters["pageurl"] = "https://ace.fusionist.io";
parameters["data"] = "foo";
parameters["pagedata"] = "bar";
parameters["action"] = "baz";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
1 change: 1 addition & 0 deletions TwoCaptcha.Tests/YandexTest.cs
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ public async Task TestAllOptions()
parameters["method"] = "yandex";
parameters["sitekey"] = "Y5Lh0tiycconMJGsFd3EbbuNKSp1yaZESUOIHfeV";
parameters["pageurl"] = "https://rutube.ru";
parameters["soft_id"] = "4582";

await CheckIfCorrectParamsSendAndResultReturned(captcha, parameters);
}
26 changes: 26 additions & 0 deletions TwoCaptcha/Captcha/AtbCAPTCHA.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

namespace TwoCaptcha.Captcha
{
public class AtbCAPTCHA : Captcha
{
public AtbCAPTCHA() : base()
{
parameters["method"] = "atb_captcha";
}

public void SetPageUrl(string url)
{
parameters["pageurl"] = url;
}

public void SetApiServer(string apiServer)
{
parameters["api_server"] = apiServer;
}

public void SetAppId(string appId)
{
parameters["app_id"] = appId;
}
}
}
22 changes: 22 additions & 0 deletions TwoCaptcha/Captcha/Cutcaptcha.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace TwoCaptcha.Captcha
{
public class Cutcaptcha : Captcha
{
public Cutcaptcha() : base()
{
parameters["method"] = "cutcaptcha";
}
public void SetMiseryKey(string miseryKey)
{
parameters["misery_key"] = miseryKey;
}
public void SetApiKey(string apiKey)
{
parameters["api_key"] = apiKey;
}
public void SetPageUrl(string pageUrl)
{
parameters["pageurl"] = pageUrl;
}
}
}
23 changes: 23 additions & 0 deletions TwoCaptcha/Captcha/CyberSiARA.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace TwoCaptcha.Captcha
{
public class CyberSiARA : Captcha
{
public CyberSiARA() : base()
{
parameters["method"] = "cybersiara";
}
public void SetMasterUrlId(string masterUrlId)
{
parameters["master_url_id"] = masterUrlId;
}
public void SetPageUrl(string pageUrl)
{
parameters["pageurl"] = pageUrl;
}
public void SetUserAgent(string userAgent)
{
parameters["userAgent"] = userAgent;
}

}
}
26 changes: 26 additions & 0 deletions TwoCaptcha/Captcha/DataDome.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

namespace TwoCaptcha.Captcha
{
public class DataDome : Captcha
{
public DataDome() : base()
{
parameters["method"] = "datadome";
}

public void SetCapthaUrl(string capthaUrl)
{
parameters["captcha_url"] = capthaUrl;
}

public void SetPageUrl(string url)
{
parameters["pageurl"] = url;
}

public void SetUserAgent(string userAgent)
{
parameters["userAgent"] = userAgent;
}
}
}
20 changes: 20 additions & 0 deletions TwoCaptcha/Captcha/FriendlyCaptcha.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace TwoCaptcha.Captcha
{
public class FriendlyCaptcha : Captcha
{
public FriendlyCaptcha() : base()
{
parameters["method"] = "friendly_captcha";
}

public void SetSiteKey(string siteKey)
{
parameters["sitekey"] = siteKey;
}

public void SetUrl(string url)
{
parameters["pageurl"] = url;
}
}
}
5 changes: 5 additions & 0 deletions TwoCaptcha/Captcha/HCaptcha.cs
Original file line number Diff line number Diff line change
@@ -16,5 +16,10 @@ public void SetUrl(string url)
{
parameters["pageurl"] = url;
}

public void SetData(string data)
{
parameters["data"] = data;
}
}
}
21 changes: 21 additions & 0 deletions TwoCaptcha/Captcha/MTCaptcha.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

namespace TwoCaptcha.Captcha
{
public class MTCaptcha : Captcha
{
public MTCaptcha() : base()
{
parameters["method"] = "mt_captcha";
}

public void SetPageUrl(string url)
{
parameters["pageurl"] = url;
}

public void SetSiteKey(string siteKey)
{
parameters["sitekey"] = siteKey;
}
}
}
5 changes: 5 additions & 0 deletions TwoCaptcha/Captcha/ReCaptcha.cs
Original file line number Diff line number Diff line change
@@ -48,5 +48,10 @@ public void SetEnterprise(bool invisible)
{
parameters["enterprise"] = invisible ? "1" : "0";
}

public void SetDataS(string data)
{
parameters["data-s"] = data;
}
}
}
21 changes: 21 additions & 0 deletions TwoCaptcha/Captcha/Tencent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

namespace TwoCaptcha.Captcha
{
public class Tencent : Captcha
{
public Tencent() : base()
{
parameters["method"] = "tencent";
}

public void SetPageUrl(string url)
{
parameters["pageurl"] = url;
}

public void SetAppId(string appId)
{
parameters["app_id"] = appId;
}
}
}
13 changes: 13 additions & 0 deletions TwoCaptcha/Captcha/Turnstile.cs
Original file line number Diff line number Diff line change
@@ -16,5 +16,18 @@ public void SetUrl(string url)
{
parameters["pageurl"] = url;
}

public void SetAction(string action)
{
parameters["action"] = action;
}
public void SetData(string data)
{
parameters["data"] = data;
}
public void SetPageData(string pagedata)
{
parameters["pagedata"] = pagedata;
}
}
}
5 changes: 3 additions & 2 deletions TwoCaptcha/TwoCaptcha.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using TwoCaptcha.Captcha;
@@ -20,7 +21,7 @@ public class TwoCaptcha
* ID of software developer. Developers who integrated their software
* with our service get reward: 10% of spendings of their software users.
*/
public int SoftId { get; set; }
public int SoftId { get; set; } = 4582;

/**
* URL to which the result will be sent
@@ -232,7 +233,7 @@ public async Task<string> GetResult(String id)
public async Task<double> Balance()
{
string response = await Res("getbalance");
return Convert.ToDouble(response);
return double.Parse(response, NumberStyles.Any, CultureInfo.InvariantCulture);
}

/**
4 changes: 3 additions & 1 deletion TwoCaptcha/TwoCaptcha.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PackageId>2captcha-csharp</PackageId>
<Version>1.3.0</Version>
<Version>1.4.0</Version>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Authors>2captcha</Authors>
<Company>2captcha</Company>
<Description>C# library for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, funcaptcha, geetest and solve any other captchas.</Description>
<PackageTags>2Captcha;Captcha;reCAPTCHA;CAPTCHA solving;CAPTCHA bypass;C#;.NET;API;Image Recognition;Audio CAPTCHA;Solve CAPTCHA;Anti-bot;CAPTCHA service;CAPTCHA SDK</PackageTags>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>