Skip to content

2Captcha Implementation - #1487

Open
TempleLain wants to merge 1 commit into
Gujal00:masterfrom
TempleLain:2Captcha-Implementation
Open

2Captcha Implementation#1487
TempleLain wants to merge 1 commit into
Gujal00:masterfrom
TempleLain:2Captcha-Implementation

Conversation

@TempleLain

@TempleLain TempleLain commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

description

dr0pstream.com put a standalone Cloudflare Turnstile widget in front of every embed path (#1481). The widget runs in reCAPTCHA compatibility mode (api.js?compat=recaptcha), the form posts op=embed, file_code and the token back to the embed URL, and the player page then carries the sources in a packed jwplayer setup.

This PR adds optional 2Captcha support and uses it in the DropLoad plugin - same idea as the ByParr setting, as a hosted service. Measurements and reasoning are in #1481.

Changes

  • lib/resolveurl/__init__.py: new optional setting twocaptcha_key (text, masked, default empty) in the ResolveURL category after the ByParr settings
  • lib/resolveurl/lib/captcha_lib.py: do_turnstile(sitekey, page_url) - createTask/getTaskResult against api.2captcha.com (TurnstileTaskProxyless, poll 5 s, timeout 120 s), notification "Solving Captcha, please wait" while it runs, returns the cf-turnstile-response / g-recaptcha-response fields or {} without a key
  • lib/resolveurl/lib/strings.py, resources/language/resource.language.en_gb/strings.po: ids 33107 "2Captcha API Key", 33108 "Solving Captcha, please wait"
  • lib/resolveurl/plugins/dropload.py: detect the widget, fetch the token, POST the hidden fields + token to the embed URL (final host after the dropload.co/.pro redirect), scrape the sources via helpers.scrape_sources (unpacks the packed setup); without a key a clear ResolverError, without the gate the old path

Setup: Settings -> ResolveURL -> first tab "ResolveURL" -> "2Captcha API Key" (directly under "Enable ByParr access", or under "ByParr timeout" when ByParr is enabled; masked input). Key is global, entered once; the solving itself has to be wired per plugin - find the sitekey, captcha_lib.do_turnstile(sitekey, page_url), POST the hidden fields plus the returned dict. This PR wires DropLoad only.

Tested: sandbox with the real plugin on y5gc8a1dj600 (issue), 1srjaaed9it5, 22bw0d6w3uy3 (kinoger.to) - master.m3u8 -> child -> first .ts segment; Kodi on Android with DropLoad links from a German streaming site - plays, fast. Negative cases: no key -> ResolverError, wrong key -> 2Captcha: ERROR_KEY_DOES_NOT_EXIST, fake token -> gate again -> "Unable to locate stream URL".

Cost: 0.00145 USD per solve (single-use token, one solve per resolve), a 10 USD top-up is roughly 6,900 resolves.

Limits: only the en_gb labels are added, the other language files still need 33107/33108; the poll blocks for the solve time; addon.xml/changelog untouched.

@Gujal00

Gujal00 commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Will think this over. I am thinking of removing byparr support and and add cf-clearance-scraper support. cf-clearance-scraper can do whatever byparr does and in addition solve turnstile without 2captcha subscription

@TempleLain

Copy link
Copy Markdown
Contributor Author

Makes sense, your call either way. One thing on the 2Captcha side:

  • It is not a subscription. 2Captcha's own pricing page states they offer no
    subscriptions, plans or bulk packages - you top up a balance from $1 and
    pay per solved captcha, same rate at any volume. Cloudflare Turnstile is
    listed at $1.45 per 1000, which matches what I measured on my own account
    (0.00145 USD per resolve, single-use token, one solve per resolve). The
    setting defaults to empty, so it costs nothing for anyone who never fills
    it in.

  • The difference between the two is not which one solves Turnstile, it is
    what the user has to run. cf-clearance-scraper and ByParr both need a
    container with a real browser on the local network. That is fine for
    anyone with a NAS or a PC running 24/7, but a large part of the Kodi user
    base is on Android TV boxes, Fire sticks, a Shield or a Pi, where that is
    not an option. A key in a text field works on every platform Kodi runs on.

So I don't think the two compete. do_turnstile only fires when a key is set,
so a local solver can take priority and the key stays as the fallback for
people who cannot host anything.

For the record, I have not tested cf-clearance-scraper against dr0pstream
myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants