aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanketsu <hanketsu@egregore.fun>2025-03-04 15:47:38 +0100
committerHanketsu <hanketsu@egregore.fun>2025-06-13 00:04:48 +0200
commitb0dbf7af50861f6729947bcbf97bc12fe8aebd0e (patch)
treee364a473ddca42c54f5e59c12ce6b8480ede39e5
parenta3ad28dd18464adf616f8fcc51045e4f48b4f8b6 (diff)
battering: Add python-cloudscraper.
* battering/packages/python-xyz.scm (python-cloudscraper): New variable.
-rw-r--r--battering/packages/python-xyz.scm62
1 files changed, 62 insertions, 0 deletions
diff --git a/battering/packages/python-xyz.scm b/battering/packages/python-xyz.scm
index 9140aa4..6102553 100644
--- a/battering/packages/python-xyz.scm
+++ b/battering/packages/python-xyz.scm
@@ -11,6 +11,7 @@
#:prefix license:)
#:use-module (gnu packages certs)
#:use-module (gnu packages check)
+ #:use-module (gnu packages node)
#:use-module (gnu packages pdf)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
@@ -802,3 +803,64 @@ library. Makes use of python 3.2's @code{concurrent.futures}.")
(description
"Client library for solve captchas with anticaptcha.com support.")
(license license:expat)))
+
+(define-public python-cloudscraper
+ (package
+ (name "python-cloudscraper")
+ (version "1.2.68")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/venomous/cloudscraper")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "198rgc7jq97ab5bjm9mbd4mdm2wslnwhdgim6vhl90dbxh55li6k"))
+ (modules '((guix build utils)))
+ (snippet
+ '(with-directory-excursion "cloudscraper"
+ (substitute* "__init__.py"
+ ;; Perhaps it's a joke, but don't promote proprietary software.
+ (("([Th]is feature is not available) in the .*'" _ prefix)
+ (string-append prefix ".'")))))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ ;; XXX: Dependencies, that have not yet been packaged
+ ;; and cause an import error when included.
+ (add-after 'unpack 'drop-unsupported-sources
+ (lambda _
+ (with-directory-excursion "cloudscraper"
+ (for-each delete-file
+ '("interpreters/v8.py")))))
+ (add-after 'unpack 'fix-references
+ (lambda _
+ (substitute* "cloudscraper/interpreters/nodejs.py"
+ (("'node'")
+ (string-append "'" (which "node") "'")))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "pytest" "-vv"
+ "-k" (string-append "not test_bad_interpreter_js_challenge1_16_05_2020 "
+ "and not test_bad_solve_js_challenge1_16_05_2020 "
+ "and not Captcha"))))))))
+ (inputs
+ (list node-lts))
+ (propagated-inputs
+ (list python-js2py
+ python-polling2
+ python-requests
+ python-requests-toolbelt
+ python-responses
+ python-pyparsing))
+ (native-inputs
+ (list python-pytest))
+ (home-page "https://github.com/venomous/cloudscraper")
+ (synopsis "Cloudflare anti-bot bypass")
+ (description
+ "This module acts as a webbrowser solving Cloudflare's Javascript
+challenges.")
+ (license license:expat)))