Effortlessly Download Instagram Stories with the Instagram Scrapper Cognitive Actions

23 Apr 2025
Effortlessly Download Instagram Stories with the Instagram Scrapper Cognitive Actions

In the world of social media, Instagram stands out as a platform where users share captivating stories. If you're a developer looking to integrate Instagram story downloading capabilities into your application, the Instagram Scrapper – Posts & Reels & Stories Downloader offers a powerful solution. This spec provides pre-built Cognitive Actions that simplify the process of accessing and retrieving Instagram stories using user IDs. By leveraging these actions, you can enhance your applications with seamless story downloading functionality.

Prerequisites

Before you begin integrating the Cognitive Actions, ensure you have the following:

  • An API key for accessing the Cognitive Actions platform.
  • Basic familiarity with making HTTP requests and handling JSON data.

For authentication, you'll typically pass your API key in the request headers, allowing you to access the Cognitive Actions service securely.

Cognitive Actions Overview

Download Instagram Stories

The Download Instagram Stories action allows you to download Instagram stories using a specified user ID. This operation provides a fast and reliable method to obtain stories from a given Instagram user.

Category: Web-scraping

Input

The input for this action requires the following fields:

  • userId (required): A unique identifier for the user whose stories you want to download. The default value is 25025320.

Example Input:

{
  "userId": "25025320"
}

Output

The action typically returns a JSON array containing details of the downloaded stories. Each story object includes attributes like the story ID, user details, media type, and URLs for the media content.

Example Output:

[
  {
    "id": "3600591476771230476_25025320",
    "pk": 3600591476771230700,
    "user": {
      "pk": 25025320,
      "username": "",
      "full_name": "",
      "is_private": false,
      "is_verified": false,
      "strong_id__": 25025320,
      "avatar_status": {
        "has_avatar": false
      },
      "profile_pic_url": ""
    },
    "taken_at": 1743443960,
    "media_type": 2,
    "expiring_at": 1743530360,
    "original_width": 1080,
    "video_duration": 11.5,
    "video_versions": [
      {
        "id": "1939249433488690v",
        "url": "https://scontent-fra5-2.cdninstagram.com/o1/v/t2/f2/m78/AQMSP11vhcWNCJJTmv3-lE2q3TNQFsUEFh6RnLljnC4CzlUjE60VgaZ0ly2awFGOy6k7h91sLN6jbElA-1VjQjzvOM5vBcqa60rLVZM.mp4?_nc_cat=1&_nc_sid=5e9851&_nc_ht=scontent-fra5-2.cdninstagram.com&_nc_ohc=s5m9Af0o9e4Q7kNvgFkM7NY&efg=eyJ2ZW5jb2RlX3RhZyI6Inhwdl9wcm9ncmVzc2l2ZS5JTlNUQUdSQU0uU1RPUlkuQzMuNzIwLmRhc2hfYmFzZWxpbmVfMV92MSIsInhwdl9hc3NldF9pZCI6NTU2ODczMTYwNzUyMDg5LCJ2aV91c2VjYXNlX2lkIjoxMDEwMCwiZHVyYXRpb25fcyI6MTEsInVybGdlbl9zb3VyY2UiOiJ3d3cifQ%3D%3D&ccb=17-1&vs=ccce4361d270104d&_nc_vs=HBkcFQIYUWlnX3hwdl9wbGFjZW1nZW50X3YyL0VGNDhCNThCRDIwOTA3NUI4QkMyNzQzQjQyRjAyRTlBX3ZpZGVvX2Rhc2hpbml0Lm1wNBUAAsgBACgAGAAbAogHdXNlX29pbAExEnByb2dyZXNzaXZlX3JlY2lwZQExFQAAJrLv866knv0BFQIoAkMzLBdAJwAAAAAAABgSZGFzaF9iYXNlbGluZV8xX3YxEQB16AcA&_nc_zt=28&oh=00_AYFHUZs-Qn9xzdKZlpL-FRTCCP2LSotKneq8u1VIfW7-Nw&oe=67EDC8C8",
        "type": 101,
        "width": 720,
        "height": 1280,
        "bandwidth": 766397
      }
    ],
    "supports_reel_reactions": true
  }
]

Conceptual Usage Example (Python)

Below is a conceptual Python code snippet demonstrating how to invoke the Download Instagram Stories action. This example assumes you have the necessary API key and endpoint.

import requests
import json

# Replace with your Cognitive Actions API key and endpoint
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute" # Hypothetical endpoint

action_id = "8fdfa37f-47ea-4166-b503-5e6a5436f99d" # Action ID for Download Instagram Stories

# Construct the input payload based on the action's requirements
payload = {
    "userId": "25025320"
}

headers = {
    "Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
    "Content-Type": "application/json"
}

try:
    response = requests.post(
        COGNITIVE_ACTIONS_EXECUTE_URL,
        headers=headers,
        json={"action_id": action_id, "inputs": payload} # Hypothetical structure
    )
    response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)

    result = response.json()
    print("Action executed successfully:")
    print(json.dumps(result, indent=2))

except requests.exceptions.RequestException as e:
    print(f"Error executing action {action_id}: {e}")
    if e.response is not None:
        print(f"Response status: {e.response.status_code}")
        try:
            print(f"Response body: {e.response.json()}")
        except json.JSONDecodeError:
            print(f"Response body: {e.response.text}")

In this code snippet:

  • Replace YOUR_COGNITIVE_ACTIONS_API_KEY with your actual API key.
  • The action_id is set to the ID of the Download Instagram Stories action.
  • The payload is structured according to the action's input schema.

Conclusion

Integrating the Download Instagram Stories action into your application enables you to effortlessly access and download Instagram stories, enhancing user engagement and content management capabilities. With just a few lines of code, you can leverage the power of this Cognitive Action to provide a seamless user experience. Explore additional use cases and consider expanding your application’s functionality with more actions from the Instagram Scrapper spec!