Browse Source

gn: python-twint: Patch twint to fix some bugs

* gn/packages/twint.scm (python-twint):
[patches]: Add 2 new patches.
[arguments]: Rename 'cast-variables-properly to 'twint-hot-fixes.
* python-twint-mentions.patch: New file.
* python-twint-userlist.patch: New file.

See: https://github.com/twintproject/twint/issues/1012
pull/1/head
Bonface Munyoki 2 years ago
parent
commit
2efe8a26f0
Signed by: bonfacemunyoki GPG Key ID: F5BBAE1E0392253F
  1. 6
      gn/packages/twint.scm
  2. 16
      python-twint-mentions.patch
  3. 19
      python-twint-userlist.patch

6
gn/packages/twint.scm

@ -197,7 +197,9 @@
(commit "a45a8ac719d5710e7da92f77d9801b351e505c1f")))
(sha256
(base32
"1bixwrwh1v7vpv0y6skgkml8zm82w00qwkvd6q79pkdj3hczha75"))))
"1bixwrwh1v7vpv0y6skgkml8zm82w00qwkvd6q79pkdj3hczha75"))
(patches (search-patches "python-twint-userlist.patch"
"python-twint-mentions.patch"))))
(build-system python-build-system)
(arguments
`(#:tests? #f
@ -207,7 +209,7 @@
(lambda _
(substitute* "setup.py"
(("'dataclasses',") ""))))
(add-after 'remove-deps 'cast-variables-properly
(add-after 'unpack 'twint-hot-fixes
(lambda _
;; TODO: Upstream this fix
(begin

16
python-twint-mentions.patch

@ -0,0 +1,16 @@
diff --git a/twint/format.py b/twint/format.py
index 334b43a..3eeb8c2 100644
--- a/twint/format.py
+++ b/twint/format.py
@@ -29,7 +29,10 @@ def Tweet(config, t):
output = output.replace("{quote_url}", t.quote_url)
output = output.replace("{near}", t.near)
output = output.replace("{geo}", t.geo)
- output = output.replace("{mentions}", ",".join(t.mentions))
+ output = output.replace("{mentions}",
+ ",".join(map(lambda x: x.get("screen_name",
+ None),
+ t.mentions)))
output = output.replace("{translate}", t.translate)
output = output.replace("{trans_src}", t.trans_src)
output = output.replace("{trans_dest}", t.trans_dest)

19
python-twint-userlist.patch

@ -0,0 +1,19 @@
diff --git a/twint/cli.py b/twint/cli.py
index f463d68..68244c9 100644
--- a/twint/cli.py
+++ b/twint/cli.py
@@ -69,10 +69,10 @@ def loadUserList(ul, _type):
else:
userlist = ul.split(",")
if _type == "search":
- un = ""
- for user in userlist:
- un += "%20OR%20from%3A" + user
- return un[15:]
+ un = userlist[0]
+ for user in userlist[1:]:
+ un += " OR from:" + user
+ return un
return userlist
Loading…
Cancel
Save