From 16d7f26feda0e3f35f046f20bff0a2db7e13b98d Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Mon, 29 Nov 2021 18:45:21 +0100
Subject: gnu: Add python-woob.

* gnu/packages/python-web.scm (python-woob): New variable.
---
 gnu/packages/python-web.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

(limited to 'gnu/packages/python-web.scm')

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 4ddf89c207..5d0cbda0cc 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -86,6 +86,7 @@ (define-module (gnu packages python-web)
   #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-science)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages texinfo)
@@ -6310,6 +6311,48 @@ (define-public python-webcolors
 can be handled by the @code{colorsys} module in the Python standard library.")
     (license license:bsd-3)))
 
+(define-public python-woob
+  (package
+    (name "python-woob")
+    (version "3.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "woob" version))
+       (sha256
+        (base32 "09hpxy5zhn2b8li0xjf3zd7s46lawb0315p5mdcsci3bj3s4v1j7"))))
+    (build-system python-build-system)
+    ;; A small number of tests for optional applications fails due to missing
+    ;; inputs.
+    (arguments `(#:tests? #f))
+    (propagated-inputs
+     `(("python-babel" ,python-babel)
+       ("python-colorama" ,python-colorama)
+       ("python-cssselect" ,python-cssselect)
+       ("python-dateutil" ,python-dateutil)
+       ("python-feedparser" ,python-feedparser)
+       ("python-html2text" ,python-html2text)
+       ("python-lxml" ,python-lxml)
+       ("python-pillow" ,python-pillow)
+       ("python-prettytable" ,python-prettytable)
+       ("python-pyqt" ,python-pyqt)
+       ("python-pyyaml" ,python-pyyaml)
+       ("python-requests" ,python-requests)
+       ("python-six" ,python-six)
+       ("python-unidecode" ,python-unidecode)))
+    (native-inputs
+     `(("python-coverage" ,python-coverage)
+       ("python-flake8" ,python-flake8)
+       ("python-nose" ,python-nose)
+       ("python-selenium" ,python-selenium)
+       ("python-xunitparser" ,python-xunitparser)))
+    (home-page "https://woob.tech/")
+    (synopsis "Woob, Web Outside Of Browsers")
+    (description "Woob is a collection of applications able to interact with
+websites, without requiring the user to open them in a browser.  It also
+provides well-defined APIs to talk to websites lacking one.")
+    (license license:lgpl3+)))
+
 (define-public python-flask-combo-jsonapi
   (package
     (name "python-flask-combo-jsonapi")
-- 
cgit v1.2.3


From e35cfeb25336d9e7a4dcd5ddf8f2345ce195067b Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Tue, 30 Nov 2021 20:48:22 +0100
Subject: gnu: Add python-pyjsparser.

* gnu/packages/python-web.scm (python-pyjsparser): New variable.
---
 gnu/packages/python-web.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

(limited to 'gnu/packages/python-web.scm')

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 5d0cbda0cc..9939a1b238 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -5943,6 +5943,23 @@ (define-public python-pysolr
 using a pure Python implementation.")
     (license license:bsd-3)))
 
+(define-public python-pyjsparser
+  (package
+    (name "python-pyjsparser")
+    (version "2.7.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "pyjsparser" version))
+       (sha256
+        (base32 "0ycmf9fsvwliqmm1n6sfz7x71y7i2kbfgn39d8lsbiccfxmxlq5y"))))
+    (build-system python-build-system)
+    (home-page "https://github.com/PiotrDabkowski/pyjsparser")
+    (synopsis "Fast JavaScript parser")
+    (description "This package provides a fast JavaScript parser (based on
+esprima.js)")
+    (license license:expat)))
+
 (define-public python-http-ece
   (package
     (name "python-http-ece")
-- 
cgit v1.2.3


From 1a139682107582e663adf38ae217fc0029b10888 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Tue, 30 Nov 2021 20:48:34 +0100
Subject: gnu: Add python-js2py.

* gnu/packages/python-web.scm (python-js2py): New variable.
---
 gnu/packages/python-web.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

(limited to 'gnu/packages/python-web.scm')

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 9939a1b238..fcc2ed6752 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -5960,6 +5960,29 @@ (define-public python-pyjsparser
 esprima.js)")
     (license license:expat)))
 
+(define-public python-js2py
+  (package
+    (name "python-js2py")
+    (version "0.71")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "Js2Py" version))
+       (sha256
+        (base32 "1kkzkys6dfcbdv51vqxr9cmak350ab4mmykb8dysx60lvl4i06x4"))))
+    (build-system python-build-system)
+    (arguments '(#:tests? #false)) ; none included
+    (propagated-inputs
+     `(("python-pyjsparser" ,python-pyjsparser)
+       ("python-six" ,python-six)
+       ("python-tzlocal" ,python-tzlocal)))
+    (home-page "https://github.com/PiotrDabkowski/Js2Py")
+    (synopsis "JavaScript to Python translator")
+    (description
+     "This package provides a JavaScript to Python translator and a JavaScript
+interpreter written in pure Python.")
+    (license license:expat)))
+
 (define-public python-http-ece
   (package
     (name "python-http-ece")
-- 
cgit v1.2.3


From e4e50229f19f79079982e8017b20e3988a5c9226 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Tue, 30 Nov 2021 20:49:18 +0100
Subject: gnu: python-cloudscraper: Update to 1.2.58.

* gnu/packages/python-web.scm (python-cloudscraper): Update to 1.2.58.
[source]: Do not delete as many files in snippet; fetch sources via git.
[arguments]: Add build phase 'fix-references; replace 'check phase.
[inputs]: Add node.
[propagated-inputs]: Add python-js2py, python-polling2, and python-responses.
---
 gnu/packages/python-web.scm | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

(limited to 'gnu/packages/python-web.scm')

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index fcc2ed6752..2d13b17829 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -79,6 +79,7 @@ (define-module (gnu packages python-web)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages libffi)
+  #:use-module (gnu packages node)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-build)
@@ -6020,26 +6021,26 @@ (define-public python-http-ece
 (define-public python-cloudscraper
   (package
     (name "python-cloudscraper")
-    (version "1.2.48")
+    (version "1.2.58")
     (source
      (origin
-       (method url-fetch)
-       (uri (pypi-uri "cloudscraper" version))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/VeNoMouS/cloudscraper")
+             ;; Corresponds to 1.2.58
+             (commit "f3a3d067ea8b5238e9a0948aed0c3fa0d9c29b96")))
        (sha256
-        (base32 "0qjxzb0z5bprvmdhx42ayqhlhi2h49d9dwc0vvycj817s71f2sxv"))
+        (base32 "18fbp086imabjxly04rrchbf6n6m05bpd150zxbw7z2w3mjnpsqd"))
        (modules '((guix build utils)))
        (snippet
         '(with-directory-excursion "cloudscraper"
            (for-each delete-file
-                     '("captcha/2captcha.py"
-                       "captcha/9kw.py"
-                       "captcha/anticaptcha.py"
-                       "captcha/deathbycaptcha.py"))
+                     '("captcha/9kw.py"
+                       "captcha/anticaptcha.py"))
            (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 ".'")))
-           #t))))
+              (string-append prefix ".'")))))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -6050,12 +6051,25 @@ (define-public python-cloudscraper
            (lambda _
              (with-directory-excursion "cloudscraper"
                (for-each delete-file
-                         '("interpreters/js2py.py"
-                           "interpreters/v8.py")))
-             #t)))))
+                         '("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" "not test_getCookieString_challenge_js_challenge1_16_05_2020")))))))
+    (inputs
+     `(("node" ,node)))
     (propagated-inputs
-     `(("python-requests" ,python-requests)
+     `(("python-js2py" ,python-js2py)
+       ("python-polling2" ,python-polling2)
+       ("python-requests" ,python-requests)
        ("python-requests-toolbelt" ,python-requests-toolbelt-0.9.1)
+       ("python-responses" ,python-responses)
        ("python-pyparsing" ,python-pyparsing-2.4.7)))
     (native-inputs
      `(("python-pytest" ,python-pytest)))
-- 
cgit v1.2.3


From 6367c92c6eb99551ede1a2f12fc8ce73a3ddfa6f Mon Sep 17 00:00:00 2001
From: Alice BRENON <alice.brenon@ens-lyon.fr>
Date: Tue, 16 Nov 2021 16:04:02 +0100
Subject: gnu: Add python-mwparserfromhell.

* gnu/packages/python-web.scm (python-mwparserfromhell): New variable.

Signed-off-by: Ricardo Wurmus <rekado@elephly.net>
---
 gnu/packages/python-web.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

(limited to 'gnu/packages/python-web.scm')

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 2d13b17829..d4a785b2fc 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -46,6 +46,7 @@
 ;;; Copyright © 2021 Pradana Aumars <paumars@courrier.dev>
 ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2021 jgart <jgart@dismail.de>
+;;; Copyright © 2021 Alice Brenon <alice.brenon@ens-lyon.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -6445,3 +6446,32 @@ (define-public python-flask-combo-jsonapi
 Flask-RESTful to quickly build APIs that fit the complexity of existing
 real-life projects with legacy data and diverse storage providers.")
     (license license:expat)))
+
+(define-public python-mwparserfromhell
+  (package
+    (name "python-mwparserfromhell")
+    (version "0.6.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "mwparserfromhell" version))
+       (sha256
+        (base32 "0zh9zaqbac18s7mivqk8am9xw97lfkgcj9hhxj0d4208pkqpkmqs"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-pytest" ,python-pytest)
+       ("python-pytest-runner" ,python-pytest-runner)))
+    (home-page "https://github.com/earwig/mwparserfromhell")
+    (synopsis "Python parser for MediaWiki wikicode")
+    (description
+     "The MediaWiki Parser From Hell is a python library package that provides
+a parser for MediaWiki.
+
+It exposes parses as normal string objects with additional methods giving
+access to the special Wikicode features it contains (hyperlinks, tags,
+templates…).  The parser doesn't interpolate strings at all, it remains at a
+purely formal level.
+
+Full documentation may be found at
+@uref{https://mwparserfromhell.readthedocs.io, ReadTheDocs}")
+    (license license:expat)))
-- 
cgit v1.2.3