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(instagram): unwrap user reels media envelopes (#1042)
Boboc53374a8c0e5
diff --git a/changelog.d/1017.fixed.md b/changelog.d/1017.fixed.mdnew file mode 100644index 00000000..392429c6--- /dev/null+++ b/changelog.d/1017.fixed.md@@ -0,0 +1 @@+Instagram creator reels now unwrap ScrapeCreators `media` envelopes before parsing, preserving their metadata and date filtering.diff --git a/skills/last30days/scripts/lib/instagram.py b/skills/last30days/scripts/lib/instagram.pyindex a377a08a..354ea02a 100644--- a/skills/last30days/scripts/lib/instagram.py+++ b/skills/last30days/scripts/lib/instagram.py@@ -271,7 +271,15 @@ def _user_reels(raw_items = data.get("items") or data.get("reels") or data.get("data") or []_log(f" -> {len(raw_items)} reels from @{handle}")- return raw_items++ # User-reels responses wrap each reel in a ``media`` envelope, while+ # other Instagram endpoints already return flat reel dictionaries.+ return [+ item["media"]+ if isinstance(item, dict) and isinstance(item.get("media"), dict)+ else item+ for item in raw_items+ ]def search_instagram(diff --git a/tests/test_instagram.py b/tests/test_instagram.pyindex 8056c999..4f8b6eea 100644--- a/tests/test_instagram.py+++ b/tests/test_instagram.py@@ -40,6 +40,37 @@ class TestInstagramOwnerTypeSafety(unittest.TestCase):self.assertEqual("fallbackuser", items[0]["author_name"])+class TestInstagramUserReelsEnvelope(unittest.TestCase):+ def test_wrapped_user_reel_is_parsed_with_its_fields(self):+ from unittest.mock import patch+ from lib import instagram++ reel = {+ "id": "reel-1017",+ "code": "ABC1017",+ "taken_at": "2026-08-01T12:34:56.000Z",+ "caption": {"text": "Wrapped reel caption"},+ "video_play_count": 123,+ "like_count": 45,+ "comment_count": 6,+ }+ response = {"items": [{"media": reel}]}++ with patch.object(instagram.http, "get", return_value=response):+ raw_items = instagram._user_reels("creator", token="test-token")++ items = _parse_items(raw_items, "wrapped reel")++ self.assertEqual(1, len(items))+ self.assertEqual("reel-1017", items[0]["video_id"])+ self.assertEqual("2026-08-01", items[0]["date"])+ self.assertEqual("Wrapped reel caption", items[0]["text"])+ self.assertEqual(+ {"views": 123, "likes": 45, "comments": 6},+ items[0]["engagement"],+ )++class TestInstagramComments(unittest.TestCase):"""U1: Instagram comment fetching via ScrapeCreators."""