Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

fix(xurl): pin search to app-only bearer auth — OAuth1 signing 401s on percent-encoded queries in xurl >=1.1

Ruby4142665a4f04
diff --git a/skills/last30days/scripts/lib/xurl_x.py b/skills/last30days/scripts/lib/xurl_x.py
index c2a60ef8..de4b2cd5 100644
--- a/skills/last30days/scripts/lib/xurl_x.py
+++ b/skills/last30days/scripts/lib/xurl_x.py
@@ -1,11 +1,12 @@
-"""X (Twitter) search via xurl CLI — official X API v2 with OAuth2.
+"""X (Twitter) search via xurl CLI — official X API v2.
-xurl is an open-source CLI for the X API (https://github.com/openclaw/xurl).
-It uses OAuth2 with PKCE and automatic token refresh, requiring only a free
+xurl is X's official CLI for the X API
+(https://github.com/xdevplatform/xurl). It requires only a free
X Developer App. No xAI subscription or browser cookies needed.
-Install: npm install -g xurl
-Auth: xurl auth oauth2 login
+Install: npm install -g @xdevplatform/xurl
+Auth: xurl auth app-only <bearer-token> (search)
+ xurl auth oauth1 ... (whoami / availability check)
Priority: xAI API > Bird/GraphQL > xurl > web-only fallback
"""
@@ -72,8 +73,11 @@ def search_x(
max_results = max(10, min(100, max_results))
try:
+ # --auth app (app-only bearer): xurl >=1.1 mis-signs OAuth1 requests
+ # whose query needs percent-encoding (spaces, parens, ...) -> 401.
+ # Bearer auth sends no signature, so multi-word queries work.
result = subprocess.run(
- ["xurl", "search", query, "-n", str(max_results)],
+ ["xurl", "search", query, "-n", str(max_results), "--auth", "app"],
capture_output=True,
text=True,
timeout=30,
diff --git a/tests/test_xurl_x.py b/tests/test_xurl_x.py
index d79673d1..723dd955 100644
--- a/tests/test_xurl_x.py
+++ b/tests/test_xurl_x.py
@@ -98,6 +98,16 @@ class TestSearchX(unittest.TestCase):
self.assertIn("error", result)
self.assertIn("timed out", result["error"])
+ def test_search_uses_app_only_auth(self):
+ # Regression: default (OAuth1) auth 401s on any query needing
+ # percent-encoding (xurl >=1.1 signing bug); search must pin app-only.
+ completed = mock.Mock(returncode=0, stdout=json.dumps({}))
+ with mock.patch("subprocess.run", return_value=completed) as run_mock:
+ xurl_x.search_x("claude code")
+ call_args = run_mock.call_args[0][0]
+ self.assertIn("--auth", call_args)
+ self.assertEqual(call_args[call_args.index("--auth") + 1], "app")
+
def test_max_results_clamped_to_100(self):
# DEPTH_CONFIG["deep"] = 60, should stay at 60 (within 10-100 range)
completed = mock.Mock(returncode=0, stdout=json.dumps({}))