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

C# 

recaptcha solving with 2captcha

Hello, this is a simple class I use in some of my projects.



usage:


Probably can be improved, but works fine for me (so far).
You must wait 120 seconds for it to be solved? Can't you just wait for the blocking io operation (request sent to the server) to be done and get the response?
(Jul 24, 2019 08:28 AM)riu41776 Wrote:  You must wait 120 seconds for it to be solved? Can't you just wait for the blocking io operation (request sent to the server) to be done and get the response?

If you mean wait for the downloadstring to finish, that won't work because technically 2captcha is async compared to us (when our request finishes, they haven't solved it).
Haven't you heard of regular expressions and string interpolation feature in C# 6.0?

(Jul 24, 2019 08:29 AM)int Wrote:  If you mean wait for the downloadstring to finish, that won't work because technically 2captcha is async compared to us (when our request finishes, they haven't solved it).

Yeah, after looking at the usage second time i understood that the first request is to upload the captcha and then process it. But damn, this is inefficient waiting two minutes lol. This is no use.
(Jul 24, 2019 08:29 AM)riu41776 Wrote:  Haven't you heard of regular expressions and string interpolation feature in C# 6.0?


Yeah, after looking at the usage second time i understood that the first request is to upload the captcha and then process it. But damn, this is inefficient waiting two minutes lol. This is no use.

what the fuck does regex or string interpolation have to do with this?
and if its inefficient waiting 2 minutes, then write a better way (I'm doing 2 minutes so I don't spam their servers and waste my money)
(Jul 24, 2019 08:32 AM)int Wrote:  what the fugg does regex or string interpolation have to do with this?
and if its inefficient waiting 2 minutes, then write a better way (I'm doing 2 minutes so I don't spam their servers and waste my money)

You're doing string concatenation which is slow and ugly to the eyes.

String interpolation is easy as $"{Variable}SomeString".

Regex is to extract information easily... from the input text.
(Jul 24, 2019 08:37 AM)riu41776 Wrote:  You're doing string concatenation which is slow and ugly to the eyes.

String interpolation is easy as $"{Variable}SomeString".

Regex is to extract information easily... from the input text.

agreed with the string interpolation, disagree with the regex

regex is slow.
stuff to improve:
-go the OOP way with this to make it "more flexible"
-start using string interpolation, much easier to read
-its 2k19, go asynchronous
-after checking the status code, get the response by split
-never ever make that delay hard-coded but rather use a slow poll loop (with a timeout ofc)
-for god's sake, dont expect everything to be perfect and at least check the status codes
-remove the console.write part
-use tasks (for cancellation + tons of other shit)

I'll leave the learning part to you. if you're confused with any part lmk
“I wish I could say everything in one word. I hate all the things that can happen between the beginning of a sentence and the end.” ~ Leonard Cohen
(Jul 24, 2019 08:37 AM)riu41776 Wrote:  You're doing string concatenation which is slow and ugly to the eyes.

String interpolation is easy as $"{Variable}SomeString".

Regex is to extract information easily... from the input text.

I would have just called it string.format instead of string interpolation, which I guess is better, but I'm used to string concat

(Jul 24, 2019 08:42 AM)vaiperboy Wrote:  stuff to improve:
-go the OOP way with this to make it "more flexible"
-start using string interpolation, much easier to read
-its 2k19, go asynchronous
-after checking the status code, get the response by split
-never ever make that delay hard-coded but rather use a slow poll loop (with a timeout ofc)
-for god's sake, dont expect everything to be perfect and at least check the status codes
-remove the console.write part
-use tasks (for cancellation + tons of other shit)

I'll leave the learning part to you. if you're confused with any part lmk

- ok
- maybe
- probably not
- should probably check status code
- delay is a slow poll loop RN, in my other projects
- yeah, in C++ I would have done more error handling and shit
- used for debugging
- fuck tasks
(Jul 24, 2019 08:39 AM)tweety Wrote:  agreed with the string interpolation, disagree with the regex

regex is slow.

Regex is "slow" on huge inputs, but i still don't agree with it being slow.

We're in 2019, hardware are getting better so your opinion would be true years ago.
(Jul 24, 2019 08:44 AM)riu41776 Wrote:  Regex is "slow" on huge inputs, but i still don't agree with it being slow.

We're in 2019, hardware are getting better so your opinion would be true years ago.

regex is for fucking idiots fuck regex
Most of the "coders" i see here are amateurs not applying OOP techniques like SOLID principles and programming against interfaces instead of implementations.
(Jul 24, 2019 08:42 AM)int Wrote:  I would have just called it string.format instead of string interpolation, which I guess is better, but I'm used to string concat


- ok
- maybe
- probably not
- should probably check status code
- delay is a slow poll loop RN, in my other projects
- yeah, in C++ I would have done more error handling and shit
- used for debugging
- fugg tasks
and why is that? tasks are perfect for your job
you can cancel one whenever you like
“I wish I could say everything in one word. I hate all the things that can happen between the beginning of a sentence and the end.” ~ Leonard Cohen
(Jul 24, 2019 08:47 AM)vaiperboy Wrote:  and why is that? tasks are perfect for your job
you can cancel one whenever you like

tasks are retarded as fuck, last I tried it was either in java for some android garbage or discord bots
didn't like the format
(Jul 24, 2019 08:51 AM)int Wrote:  tasks are retarded as fugg, last I tried it was either in java for some android garbage or discord bots
didn't like the format
mate, whats the issue?

Code
public static Task<string> send_captcha(CancellationToken cancel) {
      await the stuff;
return big ?? string.Empty; // never return null
}

Code
await send_captcha(CancellationToken.None); // <<< This will return string
“I wish I could say everything in one word. I hate all the things that can happen between the beginning of a sentence and the end.” ~ Leonard Cohen


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by xx1ben99xxApr 7, 2020 02:45 PM 10 302 Apr 7, 2020 02:45 PM
Last Post: xx1ben99xx
[C] by xmackzJan 10, 2020 12:11 PM 3 183 Jan 10, 2020 12:11 PM
Last Post: JordanClutch
[C] by xmackzOct 18, 2019 07:04 AM 2 167 Oct 18, 2019 07:04 AM
Last Post: SP_Consulting