AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
fix(pinterest): use 'query' param for ScrapeCreators search (returns 0 pins otherwise) (#562)
S E R A Y AI8f843ad66516
diff --git a/skills/last30days/scripts/lib/pinterest.py b/skills/last30days/scripts/lib/pinterest.pyindex 609205f5..06df7c53 100644--- a/skills/last30days/scripts/lib/pinterest.py+++ b/skills/last30days/scripts/lib/pinterest.py@@ -138,7 +138,7 @@ def search_pinterest(try:data = http.get(f"{SCRAPECREATORS_BASE}/search",- params={"keyword": core_topic},+ params={"query": core_topic},headers=http.scrapecreators_headers(token),timeout=30,retries=2,diff --git a/tests/test_pinterest.py b/tests/test_pinterest.pynew file mode 100644index 00000000..f4489511--- /dev/null+++ b/tests/test_pinterest.py@@ -0,0 +1,72 @@+"""Tests for pinterest.py — ScrapeCreators Pinterest search module."""++import unittest+from unittest.mock import patch++from lib import pinterest+++class TestSearchPinterestRequest(unittest.TestCase):+ """Pin the ScrapeCreators request contract.++ Regression guard: the SC Pinterest endpoint requires a `query` param.+ A prior version sent `keyword`, which the API rejects with+ 400 bad_request ("You must provide a 'query' param"), making every+ Pinterest search silently return zero pins.+ """++ def test_uses_query_param_not_keyword(self):+ from lib import http as http_module+ with patch.object(http_module, "get") as mock_http_get:+ mock_http_get.return_value = {"pins": []}+ pinterest.search_pinterest(+ "robot vacuum", "2026-05-01", "2026-06-01",+ depth="default", token="fake-token",+ )+ self.assertEqual(mock_http_get.call_count, 1)+ params = mock_http_get.call_args.kwargs["params"]+ # The fix this test guards is the param *name* — SC requires `query`,+ # not `keyword`. Assert the contract only; the exact value is derived+ # from _extract_core_subject() and is that function's concern, not ours.+ self.assertIn("query", params)+ self.assertNotIn("keyword", params)+ self.assertTrue(params["query"])++ def test_no_token_skips_http_call(self):+ from lib import http as http_module+ with patch.object(http_module, "get") as mock_http_get:+ result = pinterest.search_pinterest(+ "robot vacuum", "2026-05-01", "2026-06-01", token=None,+ )+ mock_http_get.assert_not_called()+ self.assertEqual(result["items"], [])+ self.assertIn("error", result)++ def test_parses_pins_response_shape(self):+ from lib import http as http_module+ payload = {+ "pins": [+ {+ "id": "123",+ "description": "Robot vacuum that handles pet hair",+ "link": "https://example.com/p/123",+ "save_count": 42,+ "pinner": {"username": "petowner"},+ },+ ],+ }+ with patch.object(http_module, "get") as mock_http_get:+ mock_http_get.return_value = payload+ result = pinterest.search_pinterest(+ "robot vacuum pet hair", "2026-05-01", "2026-06-01",+ depth="default", token="fake-token",+ )+ self.assertEqual(len(result["items"]), 1)+ item = result["items"][0]+ self.assertEqual(item["pin_id"], "123")+ self.assertEqual(item["engagement"]["saves"], 42)+ self.assertEqual(item["url"], "https://example.com/p/123")+++if __name__ == "__main__":+ unittest.main()