Source

crawlinsta.login

login(driver: Chrome | Edge | Firefox | Safari | Remote, username: str, password: str, cookies_path: str = 'instagram_cookies.joblib') bool[source]

Login to instagram with given credential, and return True if success, else False.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • username (str) – username for login.

  • password (str) – corresponding password for login.

  • cookies_path (str) – The path to the file to store cookies.

Returns:

True, if login successes; otherwise False.

Return type:

bool

Examples

>>> from crawlinsta import webdriver
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> from crawlinsta.login import login
>>> login(driver, "your_username", "your_password")
>>> time.sleep(5)
>>> driver.quit()
login_with_cookies(driver: Chrome | Edge | Firefox | Safari | Remote, cookies_path: str = 'instagram_cookies.joblib')[source]

Log into Instagram using stored cookies.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • cookies_path (str) – The path to the file containing cookies. Default is “instagram_cookies.joblib”.

Examples

>>> from crawlinsta import webdriver
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> from crawlinsta.login import login_with_cookies
>>> login_with_cookies(driver, 'path_to_cookies_file.joblib')
>>> time.sleep(5)
>>> driver.quit()

crawlinsta.collecting

collect_comments_of_post(driver: Chrome | Edge | Firefox | Safari | Remote, post_code: str, n: int = 100) Json[source]

Collect n comments of a given post.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • post_code (str) – code of the post, whose comments will be collected.

  • n (int) – maximum number of comments, which should be collected. By default, it’s 100. If it’s set to 0, collect all comments.

Returns:

all comments of the given post in json format.

Return type:

Json

Raises:

ValueError – if the number of comments to collect is not a positive integer.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import collect_comments_of_post
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> collect_comments_of_post(driver, "WGDBS3D", 100)
{
  "comments": [
    {
      "id": "18278957755095859",
      "user": {
        "id": "6293392719",
        "username": "dummy_user"
      },
      "post_id": "3275298868401088037",
      "created_at_utc": 1704669275,
      "status": null,
      "share_enabled": null,
      "is_ranked_comment": null,
      "text": "Fantastic Job",
      "has_translation": false,
      "is_liked_by_post_owner": null,
      "comment_like_count": 0
    },
    ...
    ],
  "count": 100
}
collect_followers_of_user(driver: Chrome | Edge | Firefox | Safari | Remote, username: str, n: int = 100) Json[source]

Collect n followers of the given user. This action depends on the account privacy. if the account user limites the visibility of the followers, only the account owner can view all followers and anyone besides the account owner can get maximal 50 followers.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • username (str) – name of the user.

  • n (int) – maximum number of followers, which should be collected. By default, it’s 100. If it’s set to 0, collect all followers.

Returns:

all visible followers’ user information of the given user in json format.

Return type:

Json

Raises:
  • ValueError – if the number of followers to collect is not a positive integer.

  • ValueError – if the user with the given username is not found.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import collect_followers_of_user
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> collect_followers_of_user(driver, "instagram_username", 100)
{
  "users": [
    {
      "id": "528817151",
      "username": "nasa",
      "fullname": "NASA",
      "is_private": false,
      "is_verified": true,
      "profile_pic_url": "https://dummy.pic.com",
    },
    ...
    ],
  "count": 100
}
collect_following_hashtags_of_user(driver: Chrome | Edge | Firefox | Safari | Remote, username: str, n: int = 100) Json[source]

Collect n followings hashtags of the given user.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • username (str) – name of the user.

  • n (int) – maximum number of followings, which should be collected. By default, it’s 100. If it’s set to 0, collect all followings.

Returns:

all visible followings hashtags’ information of the given user in json format.

Return type:

Json

Raises:
  • ValueError – if the number of following hashtags to collect is not a positive integer.

  • ValueError – if the user with the given username is not found.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import collect_following_hashtags_of_user
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> collect_following_hashtags_of_user(driver, "instagram_username", 100)
{
  "hashtags": [
    {
      "id": "528817151",
      "name": "asiangames",
      "post_count": 1000000,
      "profile_pic_url": "https://dummy.pic.com",
    },
    ...
    ],
  "count": 100
}
collect_followings_of_user(driver: Chrome | Edge | Firefox | Safari | Remote, username: str, n: int = 100) Json[source]

Collect n followings of the given user.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • username (str) – name of the user.

  • n (int) – maximum number of followings, which should be collected. By default, it’s 100. If it’s set to 0, collect all followings.

Returns:

all visible followings’ user information of the given user in json format.

Return type:

Json

Raises:
  • ValueError – if the number of followings to collect is not a positive integer.

  • ValueError – if the user with the given username is not found.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import collect_followings_of_user
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> collect_followings_of_user(driver, "instagram_username", 100)
{
  "users": [
    {
      "id": "528817151",
      "username": "nasa",
      "fullname": "NASA",
      "is_private": false,
      "is_verified": true,
      "profile_pic_url": "https://dummy.pic.com",
    },
    ...
    ],
  "count": 100
}
collect_likers_of_post(driver: Chrome | Edge | Firefox | Safari | Remote, post_code: str, n: int = 100) Json[source]

Collect the users, who likes a given post.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • post_code (str) – post code, used for generating post directly accessible url.

  • n (int) – maximum number of likers, which should be collected. By default, it’s 100. If it’s set to 0, collect all likers.

Returns:

all likers’ user information of the given post in json format.

Return type:

Json

Raises:

ValueError – if the number of likers to collect is not a positive integer.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import collect_likers_of_post
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> collect_likers_of_post(driver, "WGDBS3D", 100)
{
  "users": [
    {
      "id": "528817151",
      "username": "nasa",
      "fullname": "NASA",
      "is_private": false,
      "is_verified": true,
      "profile_pic_url": "https://dummy.pic.com",
    },
    ...
    ],
  "count": 100
}
collect_posts_by_music_id(driver: Chrome | Edge | Firefox | Safari | Remote, music_id: str, n: int = 100) Json[source]

Collect n posts containing the given music_id. If n is set to 0, collect all posts.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • music_id (str) – id of the music.

  • n (int) – maximum number of posts, which should be collected. By default, it’s 100. If it’s set to 0, collect all posts.

Returns:

a list of posts containing the music.

Return type:

Json

Raises:
  • ValueError – if the number of posts to collect is not a positive integer.

  • ValueError – if the music id is not found.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import collect_posts_by_music_id
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> collect_posts_by_music_id(driver, "2614441095386924", 100)
{
  "posts": [
    {
      "like_count": 817982,
      "comment_count": 3000,
      "id": "3215769692664507668",
      "code": "CygtX9ivC0U",
      "user": {
        "id": "50269116275",
        "username": "dummy_instagram_username",
        "fullname": "",
        "profile_pic_url": "https://scontent.cdninstagram.com/v",
        "is_private": false,
        "is_verified": false
      },
      "taken_at": 1697569769,
      "media_type": "Reel",
      "caption": {
        "id": "17985380039262083",
        "text": "I know what she’s gonna say before she even has the chance 😂",
        "created_at_utc": null
      },
      "accessibility_caption": "",
      "original_width": 1080,
      "original_height": 1920,
      "urls": [
        "https://scontent.cdninstagram.com/o1"
      ],
      "has_shared_to_fb": false,
      "usertags": [],
      "location": null,
      "music": {
        "id": "2614441095386924",
        "is_trending_in_clips": false,
        "artist": {
          "id": "50269116275",
          "username": "dummy_instagram_username",
          "fullname": "",
          "profile_pic_url": "",
          "is_private": null,
          "is_verified": null
        },
        "title": "Original audio",
        "duration_in_ms": null,
        "url": null
      }
    },
    ...
    ],
  "count": 100
}
collect_posts_of_user(driver: Chrome | Edge | Firefox | Safari | Remote, username: str, n: int = 100) Json[source]

Collect n posts of the given user. If n is set to 0, collect all posts.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • username (str) – name of the user.

  • n (int) – maximum number of posts, which should be collected. By default, it’s 100. If it’s set to 0, collect all posts.

Returns:

all visible post of the given user in json format.

Return type:

Json

Raises:
  • ValueError – if the number of posts to collect is not a positive integer.

  • ValueError – if the user with the given username is not found.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import collect_posts_of_user
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> collect_posts_of_user(driver, "dummy_instagram_username", 100)
{
  "posts": [
    {
      "like_count": 817982,
      "comment_count": 3000,
      "id": "3215769692664507668",
      "code": "CygtX9ivC0U",
      "user": {
        "id": "50269116275",
        "username": "dummy_instagram_username",
        "fullname": "",
        "profile_pic_url": "https://scontent.cdninstagram.com/v",
        "is_private": false,
        "is_verified": false
      },
      "taken_at": 1697569769,
      "media_type": "Photo",
      "caption": {
        "id": "17985380039262083",
        "text": "I know what she’s gonna say before she even has the chance 😂",
        "created_at_utc": null
      },
      "accessibility_caption": "",
      "original_width": 1080,
      "original_height": 1920,
      "urls": [
        "https://scontent.cdninstagram.com/o1"
      ],
      "has_shared_to_fb": false,
      "usertags": [],
      "location": null,
      "music": {
        "id": "2614441095386924",
        "is_trending_in_clips": false,
        "artist": {
          "id": "50269116275",
          "username": "dummy_instagram_username",
          "fullname": "",
          "profile_pic_url": "",
          "is_private": null,
          "is_verified": null
        },
        "title": "Original audio",
        "duration_in_ms": null,
        "url": null
      }
    },
    ...
    ],
  "count": 100
}
collect_reels_of_user(driver: Chrome | Edge | Firefox | Safari | Remote, username: str, n: int = 100) Json[source]

Collect n reels of the given user. If n is set to 0, collect all reels.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • username (str) – name of the user.

  • n (int) – maximum number of reels, which should be collected. By default, it’s 100. If it’s set to 0, collect all posts.

Returns:

all visible reels user information of the given user in json format.

Return type:

Json

Raises:
  • ValueError – if the number of reels to collect is not a positive integer.

  • ValueError – if the user with the given username is not found.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import collect_reels_of_user
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> collect_reels_of_user(driver, "dummy_instagram_username", 100)
{
  "reels": [
    {
      "like_count": 817982,
      "comment_count": 3000,
      "id": "3215769692664507668",
      "code": "CygtX9ivC0U",
      "user": {
        "id": "50269116275",
        "username": "dummy_instagram_username",
        "fullname": "",
        "profile_pic_url": "https://scontent.cdninstagram.com/v",
        "is_private": false,
        "is_verified": false
      },
      "taken_at": 1697569769,
      "media_type": "Reel",
      "caption": {
        "id": "17985380039262083",
        "text": "I know what she’s gonna say before she even has the chance 😂",
        "created_at_utc": null
      },
      "accessibility_caption": "",
      "original_width": 1080,
      "original_height": 1920,
      "urls": [
        "https://scontent.cdninstagram.com/o1"
      ],
      "has_shared_to_fb": false,
      "usertags": [],
      "location": null,
      "music": {
        "id": "2614441095386924",
        "is_trending_in_clips": false,
        "artist": {
          "id": "50269116275",
          "username": "dummy_instagram_username",
          "fullname": "",
          "profile_pic_url": "",
          "is_private": null,
          "is_verified": null
        },
        "title": "Original audio",
        "duration_in_ms": null,
        "url": null
      }
    },
    ...
    ],
  "count": 100
}
collect_tagged_posts_of_user(driver: Chrome | Edge | Firefox | Safari | Remote, username: str, n: int = 100) Json[source]

Collect n posts in which user was tagged. If n is set to 0, collect all tagged posts.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • username (str) – name of the user.

  • n (int) – maximum number of tagged posts, which should be collected. By default, it’s 100. If it’s set to 0, collect all posts.

Returns:

all visible tagged posts in json format.

Return type:

Json

Raises:
  • ValueError – if the number of tagged posts to collect is not a positive integer.

  • ValueError – if the user with the given username is not found.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import collect_tagged_posts_of_user
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> collect_tagged_posts_of_user(driver, "dummy_instagram_username", 100)
{
  "tagged_posts": [
    {
      "like_count": 817982,
      "comment_count": 3000,
      "id": "3215769692664507668",
      "code": "CygtX9ivC0U",
      "user": {
        "id": "50269116275",
        "username": "dummy_instagram_username",
        "fullname": "",
        "profile_pic_url": "https://scontent.cdninstagram.com/v",
        "is_private": false,
        "is_verified": false
      },
      "taken_at": 1697569769,
      "media_type": "Reel",
      "caption": {
        "id": "17985380039262083",
        "text": "I know what she’s gonna say before she even has the chance 😂",
        "created_at_utc": null
      },
      "accessibility_caption": "",
      "original_width": 1080,
      "original_height": 1920,
      "urls": [
        "https://scontent.cdninstagram.com/o1"
      ],
      "has_shared_to_fb": false,
      "usertags": [],
      "location": null,
      "music": {
        "id": "2614441095386924",
        "is_trending_in_clips": false,
        "artist": {
          "id": "50269116275",
          "username": "dummy_instagram_username",
          "fullname": "",
          "profile_pic_url": "",
          "is_private": null,
          "is_verified": null
        },
        "title": "Original audio",
        "duration_in_ms": null,
        "url": null
      }
    },
    ...
    ],
  "count": 100
}
collect_top_posts_of_hashtag(driver: Chrome | Edge | Firefox | Safari | Remote, hashtag: str) Json[source]

Collect top posts of a given hashtag.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • hashtag (str) – hashtag.

Returns:

Hashtag information in a json format.

Return type:

Json

Raises:

ValueError – if the hashtag is not found.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import collect_top_posts_of_hashtag
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> collect_top_posts_of_hashtag(driver, "shanghai", True)
{
  "top_posts": [
    {
      "like_count": 817982,
      "comment_count": 3000,
      "id": "3215769692664507668",
      "code": "CygtX9ivC0U",
      "user": {
        "id": "50269116275",
        "username": "dummy_instagram_username",
        "fullname": "",
        "profile_pic_url": "https://scontent.cdninstagram.com/v",
        "is_private": false,
        "is_verified": false
      },
      "taken_at": 1697569769,
      "media_type": "Reel",
      "caption": {
        "id": "17985380039262083",
        "text": "I know what she’s gonna say before she even has the chance 😂#shanghai",
        "created_at_utc": null
      },
      "accessibility_caption": "",
      "original_width": 1080,
      "original_height": 1920,
      "urls": [
        "https://scontent.cdninstagram.com/o1"
      ],
      "has_shared_to_fb": false,
      "usertags": [],
      "location": null,
      "music": {
        "id": "2614441095386924",
        "is_trending_in_clips": false,
        "artist": {
          "id": "50269116275",
          "username": "dummy_instagram_username",
          "fullname": "",
          "profile_pic_url": "",
          "is_private": null,
          "is_verified": null
        },
        "title": "Original audio",
        "duration_in_ms": null,
        "url": null
      }
    },
    ...
    ],
  "count": 100
}
collect_user_info(driver: Chrome | Edge | Firefox | Safari | Remote, username: str) Json[source]

Collect user information through username, including user_id, username, profile_pic_url, biography, post_count, follower_count, following_count.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • username (str) – name of the user.

Returns:

user information in json format.

Return type:

Json

Raises:

ValueError – if the user with the given username is not found.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import collect_user_info
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> collect_user_info(driver, "nasa")
{
  "id": "528817151",
  "username": "nasa",
  "fullname": "NASA",
  "biography": "Exploring the universe and our home planet.",
  "follower_count": 97956738,
  "following_count": 77,
  "following_tag_count": 10,
  "is_private": false,
  "is_verified": true,
  "profile_pic_url": "https://dummy.pic.com",
  "post_count": 4116,
}
download_media(driver: Chrome | Edge | Firefox | Safari | Remote, media_url: str, file_name: str) None[source]

Download the image/video based on the given media_url, and store it to the given path.

Normally, the media_url is valid for 1 week (max. 3 weeks).

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • media_url (str) – url of the media for downloading.

  • file_name (str) – path for storing the downloaded media.

Raises:

ValueError – if the media url is not found.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import download_media
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> download_media(driver, "https://scontent-muc2-1.xx.fbcdn.net/v/t39.12897-6/4197848_n.m4a", "tmp")
get_friendship_status(driver: Chrome | Edge | Firefox | Safari | Remote, username1: str, username2: str) Json[source]

Get the relationship between the user with username1 and the user with username2, i.e. finding out who is following whom.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • username1 (str) – username of the person A.

  • username2 (str) – username of the person B.

Returns:

friendship indication between person A with username1 and person B with username2. “following” indicates if person A is following person B, and “followed_by” indicates if person A is followed by person B.

Return type:

Json

Raises:

ValueError – if the user with the given username is not found.

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import get_friendship_status
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> get_friendship_status(driver, "instagram_username1", "instagram_username1")
{
  "following": false,
  "followed_by": true
}
search_with_keyword(driver: Chrome | Edge | Firefox | Safari | Remote, keyword: str, pers: bool) Json[source]

Search hashtags or users with given keyword.

Parameters:
  • driver (selenium.webdriver.remote.webdriver.WebDriver) – selenium driver for controlling the browser to perform certain actions.

  • keyword (str) – keyword for searching.

  • pers (bool) – indicating whether results should be personalized or not.

Returns:

found users/hashtags.

Return type:

Json

Examples

>>> from crawlinsta import webdriver
>>> from crawlinsta.login import login, login_with_cookies
>>> from crawlinsta.collecting import search_with_keyword
>>> driver = webdriver.Chrome('path_to_chromedriver')
>>> # if you already used once the login function, you can use the
>>> # login_with_cookies function to login with the cookie file.
>>> login(driver, "your_username", "your_password")  # or login_with_cookies(driver)
>>> search_with_keyword(driver, "shanghai", True)
{
  "hashtags": [
    {
      "position": 1,
      "hashtag": {
        "id": "17841563224118980",
        "name": "shanghai",
        "post_count": 11302316,
        "profile_pic_url": ""
      }
    }
  ],
  "users": [
    {
      "position": 0,
      "user": {
        "id": "7594441262",
        "username": "shanghai.explore",
        "fullname": "Shanghai 🇨🇳 Travel | Hotels | Food | Tips",
        "profile_pic_url": "https://scontent.cdninstagram.com/v13b",
        "is_private": null,
        "is_verified": true
      }
    }
  ],
  "places": [
    {
      "position": 2,
      "place": {
        "location": {
          "id": "106324046073002",
          "name": "Shanghai, China"
        },
        "subtitle": "",
        "title": "Shanghai, China"
      }
    }
  ],
  "personalised": true
}

crawlinsta.data_extraction

create_users_list(json_data_list: List[Dict[str, Any]], key: str = 'users')[source]

Create a list of users from the given json data list.

Parameters:
  • json_data_list (List[Dict[str, Any]]) – The list of json data.

  • key (str) – The key to extract from the json data. Default is “users”.

Returns:

The list of users.

Return type:

List[UserProfile]

Examples

>>> create_users_list([{"user": {"pk": 123, "username": "username", "full_name": "fullname",
... "profile_pic_url": "https://example.com", "is_private": False, "is_verified": True}}], "user")
[UserProfile(id=123, username="username", fullname="fullname", profile_pic_url="https://example.com",
is_private=False, is_verified=True)]
extract_id(info_dict: Dict[str, Any]) str | None[source]

Extracts the id from the given dictionary.

Parameters:

info_dict (Dict[str, Any]) – Dictionary containing the information.

Returns:

The extracted id. If not found, returns None.

Return type:

Union[str, int, None]

Examples

>>> extract_id({"pk": 123})
123
>>> extract_id({"id": "123"})
"123"
>>> extract_id({})
None
extract_music(post_info_dict: Dict[str, Any]) MusicBasicInfo | None[source]

Extracts the music from the given post information dictionary.

Parameters:

post_info_dict (Dict[str, Any]) – Dictionary containing the post information.

Returns:

The extracted music.

Return type:

Union[MusicBasicInfo, None]

Examples

>>> extract_music({"clips_metadata": {"audio_type": "licensed_music", "music_info": {"music_asset_info":
... {"audio_cluster_id": 123, "display_artist": "artist", "title": "title", "duration_in_ms": 1000,
... "progressive_download_url": "https://example.com"},
... "music_consumption_info": {"is_trending_in_clips": True}}}})
MusicBasicInfo(id=123, is_trending_in_clips=True, artist=UserProfile(fullname="artist"), title="title",
duration_in_ms=1000, url="https://example.com")
>>> extract_music({"clips_metadata": {"audio_type": "original_sounds",
... "original_sound_info": {"audio_asset_id": 123, "consumption_info": {"is_trending_in_clips": True},
... "ig_artist": {"pk": 123, "username": "username", "fullname": "fullname",
... "profile_pic_url": "https://example.com", "is_verified": True, "is_private": False},
... "original_audio_title": "title", "duration_in_ms": 1000,
... "progressive_download_url": "https://example.com"}}})
MusicBasicInfo(id=123, is_trending_in_clips=True, artist=UserProfile(id=123, username="username",
fullname="fullname", profile_pic_url="https://example.com", is_verified=True, is_private=False),
title="title", duration_in_ms=1000, url="https://example.com")
extract_music_info(music_info_dict: Dict[str, Any]) MusicBasicInfo[source]

Extracts the music information from the given dictionary.

Parameters:

music_info_dict (Dict[str, Any]) – Dictionary containing the music information.

Returns:

The extracted music information.

Return type:

MusicBasicInfo

Examples

>>> extract_music_info({"music_asset_info": {"audio_cluster_id": 123, "display_artist": "artist",
... "title": "title", "duration_in_ms": 1000, "progressive_download_url": "https://example.com"},
... "music_consumption_info": {"is_trending_in_clips": True}})
MusicBasicInfo(id=123, is_trending_in_clips=True, artist=UserProfile(fullname="artist"), title="title",
duration_in_ms=1000, url="https://example.com")
extract_post(post_info_dict: Dict[str, Any]) Post[source]

Extracts the post from the given post information dictionary.

Parameters:

post_info_dict (Dict[str, Any]) – Dictionary containing the post information.

Returns:

The extracted post.

Return type:

Post

Examples

>>> extract_post({"usertags": {"in": [{"user": {"pk": 123, "username": "username", "full_name": "fullname",
... "profile_pic_url": "https://example.com", "is_private": False, "is_verified": True},
... "position": [0.5, 0.5], "start_time_in_video_in_sec": 0, "duration_in_video_in_sec": 10}]},
... "location": {"pk": 123, "short_name": "short_name", "name": "name", "city": "city", "lng": 123,
... "lat": 123, "address": "address"}, "caption": {"pk": 123, "text": "text", "created_at_utc": 123},
... "user": {"pk": 123, "username": "username", "full_name": "fullname",
... "profile_pic_url": "https://example.com", "is_private": False, "is_verified": True}, "media_type": 1,
... "product_type": "feed", "taken_at": 123, "has_shared_to_fb": 1, "original_width": 123,
... "original_height": 123, "image_versions2": {"candidates": [{"url": "https://example.com"}]},
... "like_count": 123, "comment_count": 123})
Post(id=123, code="123", user=UserProfile(id=123, username="username", fullname="fullname",
profile_pic_url="https://example.com", is_private=False, is_verified=True), taken_at=123,
has_shared_to_fb=True, usertags=[Usertag(user=UserProfile(id=123, username="username", fullname="fullname",
profile_pic_url="https://example.com", is_private=False, is_verified=True), position=[0.5, 0.5],
start_time_in_video_in_sec=0, duration_in_video_in_sec=10)], media_type="photo", caption=Caption(id=123,
text="text", created_at_utc=123), accessibility_caption="text", location=Location(id=123,
short_name="short_name", name="name", city="city", lng=123, lat=123, address="address"), original_width=123,
original_height=123, urls=["https://example.com"], like_count=123, comment_count=123, music=None)
extract_post_urls(post_info_dict: Dict[str, Any]) List[str][source]

Extracts the post urls from the given post information dictionary.

Parameters:

post_info_dict (Dict[str, Any]) – Dictionary containing the post information.

Returns:

The extracted post urls.

Return type:

List[str]

Examples

>>> extract_post_urls({"media_type": 1, "image_versions2": {"candidates": [{"url": "https://example.com"}]})
["https://example.com"]
>>> extract_post_urls({"media_type": 2, "video_versions": [{"url": "https://example.com"}]})
["https://example.com"]
>>> extract_post_urls({"media_type": 8, "carousel_media": [{"image_versions2":
... {"candidates": [{"url": "https://example.com"}]}}]})
["https://example.com"]
extract_sound_info(sound_info_dict: Dict[str, Any]) MusicBasicInfo[source]

Extracts the sound information from the given dictionary.

Parameters:

sound_info_dict (Dict[str, Any]) – Dictionary containing the sound information.

Returns:

The extracted sound information.

Return type:

MusicBasicInfo

Examples

>>> extract_sound_info({"audio_asset_id": 123, "consumption_info": {"is_trending_in_clips": True},
... "ig_artist": {"pk": 123, "username": "username", "fullname": "fullname",
... "profile_pic_url": "https://example.com", "is_verified": True, "is_private": False},
... "original_audio_title": "title", "duration_in_ms": 1000, "progressive_download_url": "https://example.com"})
MusicBasicInfo(id=123, is_trending_in_clips=True, artist=UserProfile(id=123, username="username",
fullname="fullname", profile_pic_url="https://example.com", is_verified=True, is_private=False),
title="title", duration_in_ms=1000, url="https://example.com")

crawlinsta.decorators

driver_implicit_wait(seconds: int = 10)[source]

Decorator to set the implicit wait of the driver before executing the function.

Parameters:

seconds (int, optional) – The number of seconds to wait. Defaults to 10.

Returns:

The wrapped function

Return type:

function

Examples

>>> # Set the implicit wait of the driver to 10 seconds before executing the function
>>> @driver_implicit_wait(10)
... def test_function(chrome_driver):
...     pass

crawlinsta.schemas

pydantic model UserInfo[source]

User information contains id, username, full name, biography and son on .

Show JSON schema
{
   "title": "UserInfo",
   "description": "User information contains `id`, `username`, `full name`, `biography` and son on .",
   "type": "object",
   "properties": {
      "id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "unique identifier if an user. It's 9 digits in string format.",
         "examples": [
            "387381865"
         ],
         "title": "Id"
      },
      "username": {
         "default": "",
         "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
         "examples": [
            "dummy_user"
         ],
         "title": "Username",
         "type": "string"
      },
      "follower_count": {
         "default": 0,
         "description": "Number of the followers.",
         "examples": [
            10
         ],
         "title": "Follower Count",
         "type": "integer"
      },
      "following_count": {
         "default": 0,
         "description": "Number of the following.",
         "examples": [
            10
         ],
         "title": "Following Count",
         "type": "integer"
      },
      "following_tag_count": {
         "default": 0,
         "description": "Number of the tags, which are followed by the user.",
         "examples": [
            0
         ],
         "title": "Following Tag Count",
         "type": "integer"
      },
      "post_count": {
         "default": 0,
         "description": "Number of the posts of the user.",
         "examples": [
            20
         ],
         "title": "Post Count",
         "type": "integer"
      },
      "fullname": {
         "default": "",
         "description": "It's limited to 30 characters and must contain only letters, numbers, periods, underscores and spaces.",
         "examples": [
            "Dummy User"
         ],
         "title": "Fullname",
         "type": "string"
      },
      "profile_pic_url": {
         "default": "",
         "description": "Url of the profile picture for downloading. The generated link is usually available only for couple hours.",
         "examples": [
            "https://dummy-pic.com"
         ],
         "title": "Profile Pic Url",
         "type": "string"
      },
      "is_private": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Indicates that the user account is private or public.Please check https://help.instagram.com/448523408565555for detailed information.",
         "examples": [
            false
         ],
         "title": "Is Private"
      },
      "is_verified": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Indicates whether the user account is verified as business/official account or not.",
         "examples": [
            false
         ],
         "title": "Is Verified"
      },
      "biography": {
         "default": "",
         "description": "A short description of the user account.",
         "examples": [
            "Hello, welcome to my instagram."
         ],
         "title": "Biography",
         "type": "string"
      }
   }
}

Config:
  • coerce_numbers_to_str: bool = True

Fields:
field biography: str = ''

A short description of the user account.

field follower_count: int = 0

Number of the followers.

field following_count: int = 0

Number of the following.

field following_tag_count: int = 0

Number of the tags, which are followed by the user.

field fullname: str = ''

It’s limited to 30 characters and must contain only letters, numbers, periods, underscores and spaces.

field id: str | None = None

unique identifier if an user. It’s 9 digits in string format.

field is_private: bool | None = None

Indicates that the user account is private or public.Please check https://help.instagram.com/448523408565555for detailed information.

field is_verified: bool | None = None

Indicates whether the user account is verified as business/official account or not.

field post_count: int = 0

Number of the posts of the user.

field profile_pic_url: str = ''

Url of the profile picture for downloading. The generated link is usually available only for couple hours.

field username: str = ''

It’s limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It’s the unique identifier for the user besides the user id,which is generated by instagram automatically.

pydantic model Users[source]

An aggregation class to have the field users for storing a list of instances of UserInfo.

Show JSON schema
{
   "title": "Users",
   "description": "An aggregation class to have the field `users` for storing a list of\ninstances of `UserInfo`.",
   "type": "object",
   "properties": {
      "users": {
         "default": [],
         "description": "A list of user information.",
         "examples": [
            [
               {
                  "fullname": "Dummy User",
                  "id": "387381865",
                  "is_private": false,
                  "is_verified": false,
                  "profile_pic_url": "https://dummy-pic.com",
                  "username": "dummy_user"
               }
            ]
         ],
         "items": {
            "$ref": "#/$defs/UserProfile"
         },
         "title": "Users",
         "type": "array"
      },
      "count": {
         "default": 0,
         "description": "Number of users contained.",
         "examples": [
            100
         ],
         "title": "Count",
         "type": "integer"
      }
   },
   "$defs": {
      "UserProfile": {
         "description": "User basic information, contains `id`, `username`, `fullname`, `profile_pic_url` and `is_verified`.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "unique identifier if an user. It's 9 digits in string format.",
               "examples": [
                  "387381865"
               ],
               "title": "Id"
            },
            "username": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
               "examples": [
                  "dummy_user"
               ],
               "title": "Username",
               "type": "string"
            },
            "fullname": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters, numbers, periods, underscores and spaces.",
               "examples": [
                  "Dummy User"
               ],
               "title": "Fullname",
               "type": "string"
            },
            "profile_pic_url": {
               "default": "",
               "description": "Url of the profile picture for downloading. The generated link is usually available only for couple hours.",
               "examples": [
                  "https://dummy-pic.com"
               ],
               "title": "Profile Pic Url",
               "type": "string"
            },
            "is_private": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates that the user account is private or public.Please check https://help.instagram.com/448523408565555for detailed information.",
               "examples": [
                  false
               ],
               "title": "Is Private"
            },
            "is_verified": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates whether the user account is verified as business/official account or not.",
               "examples": [
                  false
               ],
               "title": "Is Verified"
            }
         },
         "title": "UserProfile",
         "type": "object"
      }
   }
}

Fields:
field count: int = 0

Number of users contained.

field users: List[UserProfile] = []

A list of user information.

pydantic model FriendshipStatus[source]

Describe the relationship between the liker and the post owner.

Show JSON schema
{
   "title": "FriendshipStatus",
   "description": "Describe the relationship between the liker and the post owner. ",
   "type": "object",
   "properties": {
      "following": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Does the liker follow the post owner?",
         "examples": [
            false
         ],
         "title": "Following"
      },
      "followed_by": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": false,
         "description": "Does the post owner follow the liker?",
         "examples": [
            false
         ],
         "title": "Followed By"
      }
   }
}

Fields:
field followed_by: bool | None = False

Does the post owner follow the liker?

field following: bool | None = None

Does the liker follow the post owner?

pydantic model Comment[source]

Relevant information about a comment, including id, user_id, post_id type etc.

Show JSON schema
{
   "title": "Comment",
   "description": "Relevant information about a comment, including `id`, `user_id`, `post_id`\n`type` etc.",
   "type": "object",
   "properties": {
      "id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "description": "Unique identifier of the comment. It consists of 17 digits.",
         "examples": [
            "18016617763686865"
         ],
         "title": "Id"
      },
      "user": {
         "allOf": [
            {
               "$ref": "#/$defs/UserBasicInfo"
            }
         ],
         "description": "User, who made the comment.",
         "examples": [
            {
               "id": "387381865",
               "username": "dummy_user"
            }
         ]
      },
      "post_id": {
         "description": "Id reference to the post.",
         "examples": [
            "3194677555662724330"
         ],
         "title": "Post Id",
         "type": "string"
      },
      "created_at_utc": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Timestamp of when the comment was made.",
         "examples": [
            1695060863
         ],
         "title": "Created At Utc"
      },
      "status": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Status of the comment, Active or Inactive. The inactive comments refers to the comments which are hidden by the post owner with certainconditions, such as filtered with certain words, default spam filter, ormanually controlled by the post owner.",
         "examples": [
            "Active"
         ],
         "title": "Status"
      },
      "share_enabled": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Is the comment enabled for sharing? Generally all the visible commends are legit for sharing, only the hidden commends are not enabled for sharing. This is a duplicated feature of status.",
         "examples": [
            true
         ],
         "title": "Share Enabled"
      },
      "is_ranked_comment": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Is the comment a ranked one? The Instagram comments feature is set up in such a way that it shows first the comments of people you follow. Or, sometimes, a comment by a verified account or a comment that is most liked shows up first.",
         "examples": [
            true
         ],
         "title": "Is Ranked Comment"
      },
      "text": {
         "default": "",
         "description": "Comment content in free text format. The Instagram comment character limit is also 2200 characters, just like the caption. Instagram comments can only contain up to 30 hashtags.",
         "examples": [
            "Cool stuff!"
         ],
         "title": "Text",
         "type": "string"
      },
      "has_translation": {
         "default": false,
         "description": "Does the comment have a translation? Captions and comments on posts in feed, as well as the bio that you include on your profile, are translated automatically based on the language they're written in and the language settings of the person viewing it. If your language is available as a translation, you can tap See translation below the text to see it.",
         "examples": [
            true
         ],
         "title": "Has Translation",
         "type": "boolean"
      },
      "is_liked_by_post_owner": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Is the comment liked by the post owner?",
         "examples": [
            true
         ],
         "title": "Is Liked By Post Owner"
      },
      "comment_like_count": {
         "default": 0,
         "description": "Number of people liked the comment.",
         "examples": [
            1
         ],
         "title": "Comment Like Count",
         "type": "integer"
      }
   },
   "$defs": {
      "UserBasicInfo": {
         "description": "User basic information, contains `id`, `username`.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "unique identifier if an user. It's 9 digits in string format.",
               "examples": [
                  "387381865"
               ],
               "title": "Id"
            },
            "username": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
               "examples": [
                  "dummy_user"
               ],
               "title": "Username",
               "type": "string"
            }
         },
         "title": "UserBasicInfo",
         "type": "object"
      }
   },
   "required": [
      "id",
      "user",
      "post_id"
   ]
}

Config:
  • coerce_numbers_to_str: bool = True

Fields:
field comment_like_count: int = 0

Number of people liked the comment.

field created_at_utc: int | None = None

Timestamp of when the comment was made.

field has_translation: bool = False

Does the comment have a translation? Captions and comments on posts in feed, as well as the bio that you include on your profile, are translated automatically based on the language they’re written in and the language settings of the person viewing it. If your language is available as a translation, you can tap See translation below the text to see it.

field id: str | None [Required]

Unique identifier of the comment. It consists of 17 digits.

field is_liked_by_post_owner: bool | None = None

Is the comment liked by the post owner?

field is_ranked_comment: bool | None = None

Is the comment a ranked one? The Instagram comments feature is set up in such a way that it shows first the comments of people you follow. Or, sometimes, a comment by a verified account or a comment that is most liked shows up first.

field post_id: str [Required]

Id reference to the post.

field share_enabled: bool | None = None

Is the comment enabled for sharing? Generally all the visible commends are legit for sharing, only the hidden commends are not enabled for sharing. This is a duplicated feature of status.

field status: str | None = None

Status of the comment, Active or Inactive. The inactive comments refers to the comments which are hidden by the post owner with certainconditions, such as filtered with certain words, default spam filter, ormanually controlled by the post owner.

field text: str = ''

Comment content in free text format. The Instagram comment character limit is also 2200 characters, just like the caption. Instagram comments can only contain up to 30 hashtags.

field user: UserBasicInfo [Required]

User, who made the comment.

pydantic model Comments[source]

An aggregation of comments.

Show JSON schema
{
   "title": "Comments",
   "description": "An aggregation of comments.",
   "type": "object",
   "properties": {
      "comments": {
         "default": [],
         "description": "A list of comments.",
         "examples": [
            [
               {
                  "comment_like_count": 1,
                  "created_at_utc": 1695060863,
                  "has_translation": false,
                  "id": "18016617763686865",
                  "is_liked_by_post_owner": true,
                  "is_ranked_comment": true,
                  "post_id": "3194677555662724330",
                  "share_enabled": true,
                  "status": "Active",
                  "text": "Cool Stuff!",
                  "user": {
                     "id": "387381865",
                     "username": "dummy_user"
                  }
               }
            ]
         ],
         "items": {
            "$ref": "#/$defs/Comment"
         },
         "title": "Comments",
         "type": "array"
      },
      "count": {
         "default": 0,
         "description": "Number of comments contained.",
         "examples": [
            100
         ],
         "title": "Count",
         "type": "integer"
      }
   },
   "$defs": {
      "Comment": {
         "description": "Relevant information about a comment, including `id`, `user_id`, `post_id`\n`type` etc.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the comment. It consists of 17 digits.",
               "examples": [
                  "18016617763686865"
               ],
               "title": "Id"
            },
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/UserBasicInfo"
                  }
               ],
               "description": "User, who made the comment.",
               "examples": [
                  {
                     "id": "387381865",
                     "username": "dummy_user"
                  }
               ]
            },
            "post_id": {
               "description": "Id reference to the post.",
               "examples": [
                  "3194677555662724330"
               ],
               "title": "Post Id",
               "type": "string"
            },
            "created_at_utc": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Timestamp of when the comment was made.",
               "examples": [
                  1695060863
               ],
               "title": "Created At Utc"
            },
            "status": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Status of the comment, Active or Inactive. The inactive comments refers to the comments which are hidden by the post owner with certainconditions, such as filtered with certain words, default spam filter, ormanually controlled by the post owner.",
               "examples": [
                  "Active"
               ],
               "title": "Status"
            },
            "share_enabled": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Is the comment enabled for sharing? Generally all the visible commends are legit for sharing, only the hidden commends are not enabled for sharing. This is a duplicated feature of status.",
               "examples": [
                  true
               ],
               "title": "Share Enabled"
            },
            "is_ranked_comment": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Is the comment a ranked one? The Instagram comments feature is set up in such a way that it shows first the comments of people you follow. Or, sometimes, a comment by a verified account or a comment that is most liked shows up first.",
               "examples": [
                  true
               ],
               "title": "Is Ranked Comment"
            },
            "text": {
               "default": "",
               "description": "Comment content in free text format. The Instagram comment character limit is also 2200 characters, just like the caption. Instagram comments can only contain up to 30 hashtags.",
               "examples": [
                  "Cool stuff!"
               ],
               "title": "Text",
               "type": "string"
            },
            "has_translation": {
               "default": false,
               "description": "Does the comment have a translation? Captions and comments on posts in feed, as well as the bio that you include on your profile, are translated automatically based on the language they're written in and the language settings of the person viewing it. If your language is available as a translation, you can tap See translation below the text to see it.",
               "examples": [
                  true
               ],
               "title": "Has Translation",
               "type": "boolean"
            },
            "is_liked_by_post_owner": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Is the comment liked by the post owner?",
               "examples": [
                  true
               ],
               "title": "Is Liked By Post Owner"
            },
            "comment_like_count": {
               "default": 0,
               "description": "Number of people liked the comment.",
               "examples": [
                  1
               ],
               "title": "Comment Like Count",
               "type": "integer"
            }
         },
         "required": [
            "id",
            "user",
            "post_id"
         ],
         "title": "Comment",
         "type": "object"
      },
      "UserBasicInfo": {
         "description": "User basic information, contains `id`, `username`.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "unique identifier if an user. It's 9 digits in string format.",
               "examples": [
                  "387381865"
               ],
               "title": "Id"
            },
            "username": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
               "examples": [
                  "dummy_user"
               ],
               "title": "Username",
               "type": "string"
            }
         },
         "title": "UserBasicInfo",
         "type": "object"
      }
   }
}

Fields:
field comments: List[Comment] = []

A list of comments.

field count: int = 0

Number of comments contained.

pydantic model Usertag[source]

Usertag information, mainly about who is tagged at which position at what time in video and how long the tagged user appears.

Show JSON schema
{
   "title": "Usertag",
   "description": "Usertag information, mainly about who is tagged at which position at what time\nin video and how long the tagged user appears.",
   "type": "object",
   "properties": {
      "user": {
         "allOf": [
            {
               "$ref": "#/$defs/UserProfile"
            }
         ],
         "description": "User who is tagged in the post.",
         "examples": [
            {
               "fullname": "Dummy User",
               "id": "387381865",
               "is_private": null,
               "is_verified": false,
               "profile_pic_url": "https://dummy-pic.com",
               "username": "dummy_user"
            }
         ]
      },
      "position": {
         "anyOf": [
            {
               "items": {
                  "type": "number"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "A list of two floats, which is used to identify the position of the tagged user in the post.",
         "examples": [
            [
               0.6794871795,
               0.7564102564
            ]
         ],
         "title": "Position"
      },
      "start_time_in_video_in_sec": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Start time in video in seconds when the tagged user shows up",
         "examples": [
            null
         ],
         "title": "Start Time In Video In Sec"
      },
      "duration_in_video_in_sec": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Duration in the video in seconds, when the tagged user shows up",
         "examples": [
            null
         ],
         "title": "Duration In Video In Sec"
      }
   },
   "$defs": {
      "UserProfile": {
         "description": "User basic information, contains `id`, `username`, `fullname`, `profile_pic_url` and `is_verified`.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "unique identifier if an user. It's 9 digits in string format.",
               "examples": [
                  "387381865"
               ],
               "title": "Id"
            },
            "username": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
               "examples": [
                  "dummy_user"
               ],
               "title": "Username",
               "type": "string"
            },
            "fullname": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters, numbers, periods, underscores and spaces.",
               "examples": [
                  "Dummy User"
               ],
               "title": "Fullname",
               "type": "string"
            },
            "profile_pic_url": {
               "default": "",
               "description": "Url of the profile picture for downloading. The generated link is usually available only for couple hours.",
               "examples": [
                  "https://dummy-pic.com"
               ],
               "title": "Profile Pic Url",
               "type": "string"
            },
            "is_private": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates that the user account is private or public.Please check https://help.instagram.com/448523408565555for detailed information.",
               "examples": [
                  false
               ],
               "title": "Is Private"
            },
            "is_verified": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates whether the user account is verified as business/official account or not.",
               "examples": [
                  false
               ],
               "title": "Is Verified"
            }
         },
         "title": "UserProfile",
         "type": "object"
      }
   },
   "required": [
      "user"
   ]
}

Fields:
field duration_in_video_in_sec: float | None = None

Duration in the video in seconds, when the tagged user shows up

field position: List[float] | None = None

A list of two floats, which is used to identify the position of the tagged user in the post.

field start_time_in_video_in_sec: float | None = None

Start time in video in seconds when the tagged user shows up

field user: UserProfile [Required]

User who is tagged in the post.

pydantic model Post[source]

Post information about when it was created, who is tagged in it, its caption, location width, height etc.

Show JSON schema
{
   "title": "Post",
   "description": "Post information about when it was created, who is tagged in it, its\ncaption, location width, height etc. ",
   "type": "object",
   "properties": {
      "like_count": {
         "default": 0,
         "description": "Count of likes.",
         "examples": [
            10
         ],
         "title": "Like Count",
         "type": "integer"
      },
      "comment_count": {
         "default": 0,
         "description": "Count of comments.",
         "examples": [
            10
         ],
         "title": "Comment Count",
         "type": "integer"
      },
      "id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "description": "Unique identifier of the post.",
         "examples": [
            "3179223655971394742"
         ],
         "title": "Id"
      },
      "code": {
         "description": "Short code of the post url. Can be used in form of www.instagram.com/<code> to access the post.",
         "examples": [
            "Cx4I1irBSnk"
         ],
         "title": "Code",
         "type": "string"
      },
      "user": {
         "allOf": [
            {
               "$ref": "#/$defs/UserProfile"
            }
         ],
         "description": "User who owns the post.",
         "examples": [
            {
               "fullname": "Dummy User",
               "id": "387381865",
               "is_private": null,
               "is_verified": false,
               "profile_pic_url": "https://dummy-pic.com",
               "username": "dummy_user"
            }
         ]
      },
      "taken_at": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "When the post was created, in unix epoch time.",
         "examples": [
            1695060863
         ],
         "title": "Taken At"
      },
      "media_type": {
         "description": "Media type: Photo, Video, IGTV, Reel, Album.",
         "examples": [
            "Photo"
         ],
         "title": "Media Type",
         "type": "string"
      },
      "caption": {
         "anyOf": [
            {
               "$ref": "#/$defs/Caption"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Caption of the post.",
         "examples": [
            null
         ]
      },
      "accessibility_caption": {
         "default": "",
         "description": "Accessibility caption in text format. Alt text describes your photos for people with visual impairments. Alt text will be automatically created for your photos or you can choose to write your own.",
         "examples": [
            "Photo is taken by John."
         ],
         "title": "Accessibility Caption",
         "type": "string"
      },
      "original_width": {
         "description": "Original width of the media, can be used to get the downloading url of the media.",
         "examples": [
            1440
         ],
         "title": "Original Width",
         "type": "integer"
      },
      "original_height": {
         "description": "Original height of the media, can be used to get the downloading url of the media.",
         "examples": [
            1440
         ],
         "title": "Original Height",
         "type": "integer"
      },
      "urls": {
         "default": [],
         "description": "Download URL of the media, which is only accessible in a few hours.",
         "examples": [
            [
               "https://scontent-muc2-1.cdninstagram.com/v/t39.30808-6/369866.jpg"
            ]
         ],
         "items": {
            "type": "string"
         },
         "title": "Urls",
         "type": "array"
      },
      "has_shared_to_fb": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Is the post shared to facebook?",
         "examples": [
            false
         ],
         "title": "Has Shared To Fb"
      },
      "usertags": {
         "default": [],
         "description": "Usertags appear in the post.",
         "examples": [],
         "items": {
            "$ref": "#/$defs/Usertag"
         },
         "title": "Usertags",
         "type": "array"
      },
      "location": {
         "anyOf": [
            {
               "$ref": "#/$defs/Location"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Location of the post, most of the time it's not given.",
         "examples": []
      },
      "music": {
         "anyOf": [
            {
               "$ref": "#/$defs/MusicBasicInfo"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "music used in this post.",
         "examples": [
            {
               "artist": {
                  "fullname": "Dummy User",
                  "id": "387381865",
                  "is_private": true,
                  "is_verified": false,
                  "profile_pic_url": "https://dummy-pic.com",
                  "username": "dummy_user"
               },
               "duration_in_ms": 6617,
               "id": "664212705901923",
               "is_trending_in_clips": false,
               "title": "Original audio",
               "url": "https://scontent-muc2-1.xx.fbcdn.net/v.m4a"
            }
         ]
      }
   },
   "$defs": {
      "Caption": {
         "description": "Caption of the post.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Unique identifier of the caption.",
               "examples": [
                  "1107837019238536"
               ],
               "title": "Id"
            },
            "text": {
               "default": "",
               "description": "Text content of the caption. The Instagram caption character limit is also 2200 characters, just like the comment. Instagram caption can only contain up to 30 hashtags.",
               "examples": [
                  "Life's a beach, and I'm just playing in the sand."
               ],
               "title": "Text",
               "type": "string"
            },
            "created_at_utc": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Timestamp when the caption was created. In unix epoch time.",
               "examples": [
                  1693213015
               ],
               "title": "Created At Utc"
            }
         },
         "title": "Caption",
         "type": "object"
      },
      "Location": {
         "description": "Location information, contains location name, city, longitude, latitude and\naddress etc. The location information is provided by the post owner, while\ncreating/editing the post.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the location.",
               "examples": [
                  "1107837019238536"
               ],
               "title": "Id"
            },
            "name": {
               "description": "Full name of the location.",
               "examples": [
                  "Kedrodasos Beach"
               ],
               "title": "Name",
               "type": "string"
            },
            "short_name": {
               "default": "",
               "description": "Short name of the location",
               "examples": [
                  "Kedro-beach"
               ],
               "title": "Short Name",
               "type": "string"
            },
            "city": {
               "default": "",
               "description": "to which city the location belongs",
               "examples": [
                  "K\u00e1ntanos, Khania, Greece"
               ],
               "title": "City",
               "type": "string"
            },
            "lng": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Longitude of the location.",
               "examples": [
                  23.5619
               ],
               "title": "Lng"
            },
            "lat": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Latitude of the location.",
               "examples": [
                  35.26861
               ],
               "title": "Lat"
            },
            "address": {
               "default": "",
               "description": "Address of the location. Typically is empty.",
               "examples": [
                  ""
               ],
               "title": "Address",
               "type": "string"
            }
         },
         "required": [
            "id",
            "name"
         ],
         "title": "Location",
         "type": "object"
      },
      "MusicBasicInfo": {
         "description": "Music information about its url, duration, title, originally from which\npost it comes, artist etc.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "id of this audio asset.",
               "examples": [
                  "664212705901923"
               ],
               "title": "Id"
            },
            "is_trending_in_clips": {
               "default": false,
               "description": "Is this music trending in clips?",
               "examples": [
                  true,
                  false
               ],
               "title": "Is Trending In Clips",
               "type": "boolean"
            },
            "artist": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Artist who created this audio/music. For a music, it will only contain the name of the artist. For a sound, it will contain thecreator's instagram information, such as id, username etc.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "title": {
               "default": "Original audio",
               "description": "Title.",
               "examples": [
                  "Original audio"
               ],
               "title": "Title",
               "type": "string"
            },
            "duration_in_ms": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Music duration",
               "examples": [
                  6617
               ],
               "title": "Duration In Ms"
            },
            "url": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "the download url of the music",
               "examples": [
                  "https://scontent-muc2-1.xx.fbcdn.net/v/t39.12897-6/4.m4a"
               ],
               "title": "Url"
            }
         },
         "required": [
            "id"
         ],
         "title": "MusicBasicInfo",
         "type": "object"
      },
      "UserProfile": {
         "description": "User basic information, contains `id`, `username`, `fullname`, `profile_pic_url` and `is_verified`.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "unique identifier if an user. It's 9 digits in string format.",
               "examples": [
                  "387381865"
               ],
               "title": "Id"
            },
            "username": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
               "examples": [
                  "dummy_user"
               ],
               "title": "Username",
               "type": "string"
            },
            "fullname": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters, numbers, periods, underscores and spaces.",
               "examples": [
                  "Dummy User"
               ],
               "title": "Fullname",
               "type": "string"
            },
            "profile_pic_url": {
               "default": "",
               "description": "Url of the profile picture for downloading. The generated link is usually available only for couple hours.",
               "examples": [
                  "https://dummy-pic.com"
               ],
               "title": "Profile Pic Url",
               "type": "string"
            },
            "is_private": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates that the user account is private or public.Please check https://help.instagram.com/448523408565555for detailed information.",
               "examples": [
                  false
               ],
               "title": "Is Private"
            },
            "is_verified": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates whether the user account is verified as business/official account or not.",
               "examples": [
                  false
               ],
               "title": "Is Verified"
            }
         },
         "title": "UserProfile",
         "type": "object"
      },
      "Usertag": {
         "description": "Usertag information, mainly about who is tagged at which position at what time\nin video and how long the tagged user appears.",
         "properties": {
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  }
               ],
               "description": "User who is tagged in the post.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "position": {
               "anyOf": [
                  {
                     "items": {
                        "type": "number"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A list of two floats, which is used to identify the position of the tagged user in the post.",
               "examples": [
                  [
                     0.6794871795,
                     0.7564102564
                  ]
               ],
               "title": "Position"
            },
            "start_time_in_video_in_sec": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Start time in video in seconds when the tagged user shows up",
               "examples": [
                  null
               ],
               "title": "Start Time In Video In Sec"
            },
            "duration_in_video_in_sec": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Duration in the video in seconds, when the tagged user shows up",
               "examples": [
                  null
               ],
               "title": "Duration In Video In Sec"
            }
         },
         "required": [
            "user"
         ],
         "title": "Usertag",
         "type": "object"
      }
   },
   "required": [
      "id",
      "code",
      "user",
      "media_type",
      "original_width",
      "original_height"
   ]
}

Config:
  • coerce_numbers_to_str: bool = True

Fields:
field accessibility_caption: str = ''

Accessibility caption in text format. Alt text describes your photos for people with visual impairments. Alt text will be automatically created for your photos or you can choose to write your own.

field caption: Caption | None = None

Caption of the post.

field code: str [Required]

Short code of the post url. Can be used in form of www.instagram.com/<code> to access the post.

field comment_count: int = 0

Count of comments.

field has_shared_to_fb: bool | None = None

Is the post shared to facebook?

field id: str | None [Required]

Unique identifier of the post.

field like_count: int = 0

Count of likes.

field location: Location | None = None

Location of the post, most of the time it’s not given.

field media_type: str [Required]

Media type: Photo, Video, IGTV, Reel, Album.

field music: MusicBasicInfo | None = None

music used in this post.

field original_height: int [Required]

Original height of the media, can be used to get the downloading url of the media.

field original_width: int [Required]

Original width of the media, can be used to get the downloading url of the media.

field taken_at: int | None = None

When the post was created, in unix epoch time.

field urls: List[str] = []

Download URL of the media, which is only accessible in a few hours.

field user: UserProfile [Required]

User who owns the post.

field usertags: List[Usertag] = []

Usertags appear in the post.

pydantic model Posts[source]

Aggregate a list of posts into a field to easily render as a JSON response.

Show JSON schema
{
   "title": "Posts",
   "description": "Aggregate a list of posts into a field to easily render as a JSON response. ",
   "type": "object",
   "properties": {
      "posts": {
         "anyOf": [
            {
               "items": {
                  "$ref": "#/$defs/Post"
               },
               "type": "array"
            },
            {
               "items": {
                  "$ref": "#/$defs/PostBasicInfo"
               },
               "type": "array"
            },
            {
               "items": {},
               "type": "array"
            }
         ],
         "default": [],
         "description": "A list of posts.",
         "examples": [],
         "title": "Posts"
      },
      "count": {
         "default": 0,
         "description": "Number of posts contained.",
         "examples": [
            100
         ],
         "title": "Count",
         "type": "integer"
      }
   },
   "$defs": {
      "Caption": {
         "description": "Caption of the post.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Unique identifier of the caption.",
               "examples": [
                  "1107837019238536"
               ],
               "title": "Id"
            },
            "text": {
               "default": "",
               "description": "Text content of the caption. The Instagram caption character limit is also 2200 characters, just like the comment. Instagram caption can only contain up to 30 hashtags.",
               "examples": [
                  "Life's a beach, and I'm just playing in the sand."
               ],
               "title": "Text",
               "type": "string"
            },
            "created_at_utc": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Timestamp when the caption was created. In unix epoch time.",
               "examples": [
                  1693213015
               ],
               "title": "Created At Utc"
            }
         },
         "title": "Caption",
         "type": "object"
      },
      "Location": {
         "description": "Location information, contains location name, city, longitude, latitude and\naddress etc. The location information is provided by the post owner, while\ncreating/editing the post.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the location.",
               "examples": [
                  "1107837019238536"
               ],
               "title": "Id"
            },
            "name": {
               "description": "Full name of the location.",
               "examples": [
                  "Kedrodasos Beach"
               ],
               "title": "Name",
               "type": "string"
            },
            "short_name": {
               "default": "",
               "description": "Short name of the location",
               "examples": [
                  "Kedro-beach"
               ],
               "title": "Short Name",
               "type": "string"
            },
            "city": {
               "default": "",
               "description": "to which city the location belongs",
               "examples": [
                  "K\u00e1ntanos, Khania, Greece"
               ],
               "title": "City",
               "type": "string"
            },
            "lng": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Longitude of the location.",
               "examples": [
                  23.5619
               ],
               "title": "Lng"
            },
            "lat": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Latitude of the location.",
               "examples": [
                  35.26861
               ],
               "title": "Lat"
            },
            "address": {
               "default": "",
               "description": "Address of the location. Typically is empty.",
               "examples": [
                  ""
               ],
               "title": "Address",
               "type": "string"
            }
         },
         "required": [
            "id",
            "name"
         ],
         "title": "Location",
         "type": "object"
      },
      "MusicBasicInfo": {
         "description": "Music information about its url, duration, title, originally from which\npost it comes, artist etc.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "id of this audio asset.",
               "examples": [
                  "664212705901923"
               ],
               "title": "Id"
            },
            "is_trending_in_clips": {
               "default": false,
               "description": "Is this music trending in clips?",
               "examples": [
                  true,
                  false
               ],
               "title": "Is Trending In Clips",
               "type": "boolean"
            },
            "artist": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Artist who created this audio/music. For a music, it will only contain the name of the artist. For a sound, it will contain thecreator's instagram information, such as id, username etc.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "title": {
               "default": "Original audio",
               "description": "Title.",
               "examples": [
                  "Original audio"
               ],
               "title": "Title",
               "type": "string"
            },
            "duration_in_ms": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Music duration",
               "examples": [
                  6617
               ],
               "title": "Duration In Ms"
            },
            "url": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "the download url of the music",
               "examples": [
                  "https://scontent-muc2-1.xx.fbcdn.net/v/t39.12897-6/4.m4a"
               ],
               "title": "Url"
            }
         },
         "required": [
            "id"
         ],
         "title": "MusicBasicInfo",
         "type": "object"
      },
      "Post": {
         "description": "Post information about when it was created, who is tagged in it, its\ncaption, location width, height etc. ",
         "properties": {
            "like_count": {
               "default": 0,
               "description": "Count of likes.",
               "examples": [
                  10
               ],
               "title": "Like Count",
               "type": "integer"
            },
            "comment_count": {
               "default": 0,
               "description": "Count of comments.",
               "examples": [
                  10
               ],
               "title": "Comment Count",
               "type": "integer"
            },
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the post.",
               "examples": [
                  "3179223655971394742"
               ],
               "title": "Id"
            },
            "code": {
               "description": "Short code of the post url. Can be used in form of www.instagram.com/<code> to access the post.",
               "examples": [
                  "Cx4I1irBSnk"
               ],
               "title": "Code",
               "type": "string"
            },
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  }
               ],
               "description": "User who owns the post.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "taken_at": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "When the post was created, in unix epoch time.",
               "examples": [
                  1695060863
               ],
               "title": "Taken At"
            },
            "media_type": {
               "description": "Media type: Photo, Video, IGTV, Reel, Album.",
               "examples": [
                  "Photo"
               ],
               "title": "Media Type",
               "type": "string"
            },
            "caption": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Caption"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Caption of the post.",
               "examples": [
                  null
               ]
            },
            "accessibility_caption": {
               "default": "",
               "description": "Accessibility caption in text format. Alt text describes your photos for people with visual impairments. Alt text will be automatically created for your photos or you can choose to write your own.",
               "examples": [
                  "Photo is taken by John."
               ],
               "title": "Accessibility Caption",
               "type": "string"
            },
            "original_width": {
               "description": "Original width of the media, can be used to get the downloading url of the media.",
               "examples": [
                  1440
               ],
               "title": "Original Width",
               "type": "integer"
            },
            "original_height": {
               "description": "Original height of the media, can be used to get the downloading url of the media.",
               "examples": [
                  1440
               ],
               "title": "Original Height",
               "type": "integer"
            },
            "urls": {
               "default": [],
               "description": "Download URL of the media, which is only accessible in a few hours.",
               "examples": [
                  [
                     "https://scontent-muc2-1.cdninstagram.com/v/t39.30808-6/369866.jpg"
                  ]
               ],
               "items": {
                  "type": "string"
               },
               "title": "Urls",
               "type": "array"
            },
            "has_shared_to_fb": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Is the post shared to facebook?",
               "examples": [
                  false
               ],
               "title": "Has Shared To Fb"
            },
            "usertags": {
               "default": [],
               "description": "Usertags appear in the post.",
               "examples": [],
               "items": {
                  "$ref": "#/$defs/Usertag"
               },
               "title": "Usertags",
               "type": "array"
            },
            "location": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Location"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Location of the post, most of the time it's not given.",
               "examples": []
            },
            "music": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MusicBasicInfo"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "music used in this post.",
               "examples": [
                  {
                     "artist": {
                        "fullname": "Dummy User",
                        "id": "387381865",
                        "is_private": true,
                        "is_verified": false,
                        "profile_pic_url": "https://dummy-pic.com",
                        "username": "dummy_user"
                     },
                     "duration_in_ms": 6617,
                     "id": "664212705901923",
                     "is_trending_in_clips": false,
                     "title": "Original audio",
                     "url": "https://scontent-muc2-1.xx.fbcdn.net/v.m4a"
                  }
               ]
            }
         },
         "required": [
            "id",
            "code",
            "user",
            "media_type",
            "original_width",
            "original_height"
         ],
         "title": "Post",
         "type": "object"
      },
      "PostBasicInfo": {
         "description": "Post information about when it was created, its caption, width, height\netc.",
         "properties": {
            "like_count": {
               "default": 0,
               "description": "Count of likes.",
               "examples": [
                  10
               ],
               "title": "Like Count",
               "type": "integer"
            },
            "comment_count": {
               "default": 0,
               "description": "Count of comments.",
               "examples": [
                  10
               ],
               "title": "Comment Count",
               "type": "integer"
            },
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the post.",
               "examples": [
                  "3179223655971394742"
               ],
               "title": "Id"
            },
            "code": {
               "description": "Short code of the post url. Can be used in form of www.instagram.com/<code> to access the post.",
               "examples": [
                  "Cx4I1irBSnk"
               ],
               "title": "Code",
               "type": "string"
            },
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/UserBasicInfo"
                  }
               ],
               "description": "User who owns the post.",
               "examples": [
                  {
                     "id": "387381865",
                     "username": "dummy_user"
                  }
               ]
            },
            "taken_at": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "When the post was created, in unix epoch time.",
               "examples": [
                  1695060863
               ],
               "title": "Taken At"
            },
            "media_type": {
               "description": "Media type: Photo, Video, IGTV, Reel, Album.",
               "examples": [
                  "Photo"
               ],
               "title": "Media Type",
               "type": "string"
            },
            "caption": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Caption"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Caption of the post.",
               "examples": [
                  null
               ]
            },
            "accessibility_caption": {
               "default": "",
               "description": "Accessibility caption in text format. Alt text describes your photos for people with visual impairments. Alt text will be automatically created for your photos or you can choose to write your own.",
               "examples": [
                  "Photo is taken by John."
               ],
               "title": "Accessibility Caption",
               "type": "string"
            },
            "original_width": {
               "description": "Original width of the media, can be used to get the downloading url of the media.",
               "examples": [
                  1440
               ],
               "title": "Original Width",
               "type": "integer"
            },
            "original_height": {
               "description": "Original height of the media, can be used to get the downloading url of the media.",
               "examples": [
                  1440
               ],
               "title": "Original Height",
               "type": "integer"
            },
            "urls": {
               "default": [],
               "description": "Download URL of the media, which is only accessible in a few hours.",
               "examples": [
                  [
                     "https://scontent-muc2-1.cdninstagram.com/v/t39.30808-6/369866.jpg"
                  ]
               ],
               "items": {
                  "type": "string"
               },
               "title": "Urls",
               "type": "array"
            }
         },
         "required": [
            "id",
            "code",
            "user",
            "media_type",
            "original_width",
            "original_height"
         ],
         "title": "PostBasicInfo",
         "type": "object"
      },
      "UserBasicInfo": {
         "description": "User basic information, contains `id`, `username`.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "unique identifier if an user. It's 9 digits in string format.",
               "examples": [
                  "387381865"
               ],
               "title": "Id"
            },
            "username": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
               "examples": [
                  "dummy_user"
               ],
               "title": "Username",
               "type": "string"
            }
         },
         "title": "UserBasicInfo",
         "type": "object"
      },
      "UserProfile": {
         "description": "User basic information, contains `id`, `username`, `fullname`, `profile_pic_url` and `is_verified`.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "unique identifier if an user. It's 9 digits in string format.",
               "examples": [
                  "387381865"
               ],
               "title": "Id"
            },
            "username": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
               "examples": [
                  "dummy_user"
               ],
               "title": "Username",
               "type": "string"
            },
            "fullname": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters, numbers, periods, underscores and spaces.",
               "examples": [
                  "Dummy User"
               ],
               "title": "Fullname",
               "type": "string"
            },
            "profile_pic_url": {
               "default": "",
               "description": "Url of the profile picture for downloading. The generated link is usually available only for couple hours.",
               "examples": [
                  "https://dummy-pic.com"
               ],
               "title": "Profile Pic Url",
               "type": "string"
            },
            "is_private": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates that the user account is private or public.Please check https://help.instagram.com/448523408565555for detailed information.",
               "examples": [
                  false
               ],
               "title": "Is Private"
            },
            "is_verified": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates whether the user account is verified as business/official account or not.",
               "examples": [
                  false
               ],
               "title": "Is Verified"
            }
         },
         "title": "UserProfile",
         "type": "object"
      },
      "Usertag": {
         "description": "Usertag information, mainly about who is tagged at which position at what time\nin video and how long the tagged user appears.",
         "properties": {
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  }
               ],
               "description": "User who is tagged in the post.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "position": {
               "anyOf": [
                  {
                     "items": {
                        "type": "number"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A list of two floats, which is used to identify the position of the tagged user in the post.",
               "examples": [
                  [
                     0.6794871795,
                     0.7564102564
                  ]
               ],
               "title": "Position"
            },
            "start_time_in_video_in_sec": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Start time in video in seconds when the tagged user shows up",
               "examples": [
                  null
               ],
               "title": "Start Time In Video In Sec"
            },
            "duration_in_video_in_sec": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Duration in the video in seconds, when the tagged user shows up",
               "examples": [
                  null
               ],
               "title": "Duration In Video In Sec"
            }
         },
         "required": [
            "user"
         ],
         "title": "Usertag",
         "type": "object"
      }
   }
}

Fields:
field count: int = 0

Number of posts contained.

field posts: List[Post] | List[PostBasicInfo] | List = []

A list of posts.

pydantic model MusicPosts[source]

Aggregate a list of posts into a field to easily render as a JSON response.

Show JSON schema
{
   "title": "MusicPosts",
   "description": "Aggregate a list of posts into a field to easily render as a JSON response. ",
   "type": "object",
   "properties": {
      "posts": {
         "anyOf": [
            {
               "items": {
                  "$ref": "#/$defs/Post"
               },
               "type": "array"
            },
            {
               "items": {
                  "$ref": "#/$defs/PostBasicInfo"
               },
               "type": "array"
            },
            {
               "items": {},
               "type": "array"
            }
         ],
         "default": [],
         "description": "A list of posts.",
         "examples": [],
         "title": "Posts"
      },
      "count": {
         "default": 0,
         "description": "Number of posts contained.",
         "examples": [
            100
         ],
         "title": "Count",
         "type": "integer"
      },
      "music": {
         "allOf": [
            {
               "$ref": "#/$defs/Music"
            }
         ],
         "description": "A music which is used in all posts.",
         "examples": []
      }
   },
   "$defs": {
      "Caption": {
         "description": "Caption of the post.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Unique identifier of the caption.",
               "examples": [
                  "1107837019238536"
               ],
               "title": "Id"
            },
            "text": {
               "default": "",
               "description": "Text content of the caption. The Instagram caption character limit is also 2200 characters, just like the comment. Instagram caption can only contain up to 30 hashtags.",
               "examples": [
                  "Life's a beach, and I'm just playing in the sand."
               ],
               "title": "Text",
               "type": "string"
            },
            "created_at_utc": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Timestamp when the caption was created. In unix epoch time.",
               "examples": [
                  1693213015
               ],
               "title": "Created At Utc"
            }
         },
         "title": "Caption",
         "type": "object"
      },
      "Location": {
         "description": "Location information, contains location name, city, longitude, latitude and\naddress etc. The location information is provided by the post owner, while\ncreating/editing the post.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the location.",
               "examples": [
                  "1107837019238536"
               ],
               "title": "Id"
            },
            "name": {
               "description": "Full name of the location.",
               "examples": [
                  "Kedrodasos Beach"
               ],
               "title": "Name",
               "type": "string"
            },
            "short_name": {
               "default": "",
               "description": "Short name of the location",
               "examples": [
                  "Kedro-beach"
               ],
               "title": "Short Name",
               "type": "string"
            },
            "city": {
               "default": "",
               "description": "to which city the location belongs",
               "examples": [
                  "K\u00e1ntanos, Khania, Greece"
               ],
               "title": "City",
               "type": "string"
            },
            "lng": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Longitude of the location.",
               "examples": [
                  23.5619
               ],
               "title": "Lng"
            },
            "lat": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Latitude of the location.",
               "examples": [
                  35.26861
               ],
               "title": "Lat"
            },
            "address": {
               "default": "",
               "description": "Address of the location. Typically is empty.",
               "examples": [
                  ""
               ],
               "title": "Address",
               "type": "string"
            }
         },
         "required": [
            "id",
            "name"
         ],
         "title": "Location",
         "type": "object"
      },
      "Music": {
         "description": "Extended Music information, contains time created, original post id,\nclips count and photos count.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "id of this audio asset.",
               "examples": [
                  "664212705901923"
               ],
               "title": "Id"
            },
            "is_trending_in_clips": {
               "default": false,
               "description": "Is this music trending in clips?",
               "examples": [
                  true,
                  false
               ],
               "title": "Is Trending In Clips",
               "type": "boolean"
            },
            "artist": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Artist who created this audio/music. For a music, it will only contain the name of the artist. For a sound, it will contain thecreator's instagram information, such as id, username etc.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "title": {
               "default": "Original audio",
               "description": "Title.",
               "examples": [
                  "Original audio"
               ],
               "title": "Title",
               "type": "string"
            },
            "duration_in_ms": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Music duration",
               "examples": [
                  6617
               ],
               "title": "Duration In Ms"
            },
            "url": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "the download url of the music",
               "examples": [
                  "https://scontent-muc2-1.xx.fbcdn.net/v/t39.12897-6/4.m4a"
               ],
               "title": "Url"
            },
            "clips_count": {
               "default": 0,
               "description": "Number of clips are using this music.",
               "examples": [
                  12
               ],
               "title": "Clips Count",
               "type": "integer"
            },
            "photos_count": {
               "default": 0,
               "description": "Number of photos are using this music.",
               "examples": [
                  10
               ],
               "title": "Photos Count",
               "type": "integer"
            }
         },
         "required": [
            "id"
         ],
         "title": "Music",
         "type": "object"
      },
      "MusicBasicInfo": {
         "description": "Music information about its url, duration, title, originally from which\npost it comes, artist etc.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "id of this audio asset.",
               "examples": [
                  "664212705901923"
               ],
               "title": "Id"
            },
            "is_trending_in_clips": {
               "default": false,
               "description": "Is this music trending in clips?",
               "examples": [
                  true,
                  false
               ],
               "title": "Is Trending In Clips",
               "type": "boolean"
            },
            "artist": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Artist who created this audio/music. For a music, it will only contain the name of the artist. For a sound, it will contain thecreator's instagram information, such as id, username etc.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "title": {
               "default": "Original audio",
               "description": "Title.",
               "examples": [
                  "Original audio"
               ],
               "title": "Title",
               "type": "string"
            },
            "duration_in_ms": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Music duration",
               "examples": [
                  6617
               ],
               "title": "Duration In Ms"
            },
            "url": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "the download url of the music",
               "examples": [
                  "https://scontent-muc2-1.xx.fbcdn.net/v/t39.12897-6/4.m4a"
               ],
               "title": "Url"
            }
         },
         "required": [
            "id"
         ],
         "title": "MusicBasicInfo",
         "type": "object"
      },
      "Post": {
         "description": "Post information about when it was created, who is tagged in it, its\ncaption, location width, height etc. ",
         "properties": {
            "like_count": {
               "default": 0,
               "description": "Count of likes.",
               "examples": [
                  10
               ],
               "title": "Like Count",
               "type": "integer"
            },
            "comment_count": {
               "default": 0,
               "description": "Count of comments.",
               "examples": [
                  10
               ],
               "title": "Comment Count",
               "type": "integer"
            },
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the post.",
               "examples": [
                  "3179223655971394742"
               ],
               "title": "Id"
            },
            "code": {
               "description": "Short code of the post url. Can be used in form of www.instagram.com/<code> to access the post.",
               "examples": [
                  "Cx4I1irBSnk"
               ],
               "title": "Code",
               "type": "string"
            },
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  }
               ],
               "description": "User who owns the post.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "taken_at": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "When the post was created, in unix epoch time.",
               "examples": [
                  1695060863
               ],
               "title": "Taken At"
            },
            "media_type": {
               "description": "Media type: Photo, Video, IGTV, Reel, Album.",
               "examples": [
                  "Photo"
               ],
               "title": "Media Type",
               "type": "string"
            },
            "caption": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Caption"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Caption of the post.",
               "examples": [
                  null
               ]
            },
            "accessibility_caption": {
               "default": "",
               "description": "Accessibility caption in text format. Alt text describes your photos for people with visual impairments. Alt text will be automatically created for your photos or you can choose to write your own.",
               "examples": [
                  "Photo is taken by John."
               ],
               "title": "Accessibility Caption",
               "type": "string"
            },
            "original_width": {
               "description": "Original width of the media, can be used to get the downloading url of the media.",
               "examples": [
                  1440
               ],
               "title": "Original Width",
               "type": "integer"
            },
            "original_height": {
               "description": "Original height of the media, can be used to get the downloading url of the media.",
               "examples": [
                  1440
               ],
               "title": "Original Height",
               "type": "integer"
            },
            "urls": {
               "default": [],
               "description": "Download URL of the media, which is only accessible in a few hours.",
               "examples": [
                  [
                     "https://scontent-muc2-1.cdninstagram.com/v/t39.30808-6/369866.jpg"
                  ]
               ],
               "items": {
                  "type": "string"
               },
               "title": "Urls",
               "type": "array"
            },
            "has_shared_to_fb": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Is the post shared to facebook?",
               "examples": [
                  false
               ],
               "title": "Has Shared To Fb"
            },
            "usertags": {
               "default": [],
               "description": "Usertags appear in the post.",
               "examples": [],
               "items": {
                  "$ref": "#/$defs/Usertag"
               },
               "title": "Usertags",
               "type": "array"
            },
            "location": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Location"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Location of the post, most of the time it's not given.",
               "examples": []
            },
            "music": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MusicBasicInfo"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "music used in this post.",
               "examples": [
                  {
                     "artist": {
                        "fullname": "Dummy User",
                        "id": "387381865",
                        "is_private": true,
                        "is_verified": false,
                        "profile_pic_url": "https://dummy-pic.com",
                        "username": "dummy_user"
                     },
                     "duration_in_ms": 6617,
                     "id": "664212705901923",
                     "is_trending_in_clips": false,
                     "title": "Original audio",
                     "url": "https://scontent-muc2-1.xx.fbcdn.net/v.m4a"
                  }
               ]
            }
         },
         "required": [
            "id",
            "code",
            "user",
            "media_type",
            "original_width",
            "original_height"
         ],
         "title": "Post",
         "type": "object"
      },
      "PostBasicInfo": {
         "description": "Post information about when it was created, its caption, width, height\netc.",
         "properties": {
            "like_count": {
               "default": 0,
               "description": "Count of likes.",
               "examples": [
                  10
               ],
               "title": "Like Count",
               "type": "integer"
            },
            "comment_count": {
               "default": 0,
               "description": "Count of comments.",
               "examples": [
                  10
               ],
               "title": "Comment Count",
               "type": "integer"
            },
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the post.",
               "examples": [
                  "3179223655971394742"
               ],
               "title": "Id"
            },
            "code": {
               "description": "Short code of the post url. Can be used in form of www.instagram.com/<code> to access the post.",
               "examples": [
                  "Cx4I1irBSnk"
               ],
               "title": "Code",
               "type": "string"
            },
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/UserBasicInfo"
                  }
               ],
               "description": "User who owns the post.",
               "examples": [
                  {
                     "id": "387381865",
                     "username": "dummy_user"
                  }
               ]
            },
            "taken_at": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "When the post was created, in unix epoch time.",
               "examples": [
                  1695060863
               ],
               "title": "Taken At"
            },
            "media_type": {
               "description": "Media type: Photo, Video, IGTV, Reel, Album.",
               "examples": [
                  "Photo"
               ],
               "title": "Media Type",
               "type": "string"
            },
            "caption": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Caption"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Caption of the post.",
               "examples": [
                  null
               ]
            },
            "accessibility_caption": {
               "default": "",
               "description": "Accessibility caption in text format. Alt text describes your photos for people with visual impairments. Alt text will be automatically created for your photos or you can choose to write your own.",
               "examples": [
                  "Photo is taken by John."
               ],
               "title": "Accessibility Caption",
               "type": "string"
            },
            "original_width": {
               "description": "Original width of the media, can be used to get the downloading url of the media.",
               "examples": [
                  1440
               ],
               "title": "Original Width",
               "type": "integer"
            },
            "original_height": {
               "description": "Original height of the media, can be used to get the downloading url of the media.",
               "examples": [
                  1440
               ],
               "title": "Original Height",
               "type": "integer"
            },
            "urls": {
               "default": [],
               "description": "Download URL of the media, which is only accessible in a few hours.",
               "examples": [
                  [
                     "https://scontent-muc2-1.cdninstagram.com/v/t39.30808-6/369866.jpg"
                  ]
               ],
               "items": {
                  "type": "string"
               },
               "title": "Urls",
               "type": "array"
            }
         },
         "required": [
            "id",
            "code",
            "user",
            "media_type",
            "original_width",
            "original_height"
         ],
         "title": "PostBasicInfo",
         "type": "object"
      },
      "UserBasicInfo": {
         "description": "User basic information, contains `id`, `username`.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "unique identifier if an user. It's 9 digits in string format.",
               "examples": [
                  "387381865"
               ],
               "title": "Id"
            },
            "username": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
               "examples": [
                  "dummy_user"
               ],
               "title": "Username",
               "type": "string"
            }
         },
         "title": "UserBasicInfo",
         "type": "object"
      },
      "UserProfile": {
         "description": "User basic information, contains `id`, `username`, `fullname`, `profile_pic_url` and `is_verified`.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "unique identifier if an user. It's 9 digits in string format.",
               "examples": [
                  "387381865"
               ],
               "title": "Id"
            },
            "username": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
               "examples": [
                  "dummy_user"
               ],
               "title": "Username",
               "type": "string"
            },
            "fullname": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters, numbers, periods, underscores and spaces.",
               "examples": [
                  "Dummy User"
               ],
               "title": "Fullname",
               "type": "string"
            },
            "profile_pic_url": {
               "default": "",
               "description": "Url of the profile picture for downloading. The generated link is usually available only for couple hours.",
               "examples": [
                  "https://dummy-pic.com"
               ],
               "title": "Profile Pic Url",
               "type": "string"
            },
            "is_private": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates that the user account is private or public.Please check https://help.instagram.com/448523408565555for detailed information.",
               "examples": [
                  false
               ],
               "title": "Is Private"
            },
            "is_verified": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates whether the user account is verified as business/official account or not.",
               "examples": [
                  false
               ],
               "title": "Is Verified"
            }
         },
         "title": "UserProfile",
         "type": "object"
      },
      "Usertag": {
         "description": "Usertag information, mainly about who is tagged at which position at what time\nin video and how long the tagged user appears.",
         "properties": {
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  }
               ],
               "description": "User who is tagged in the post.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "position": {
               "anyOf": [
                  {
                     "items": {
                        "type": "number"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A list of two floats, which is used to identify the position of the tagged user in the post.",
               "examples": [
                  [
                     0.6794871795,
                     0.7564102564
                  ]
               ],
               "title": "Position"
            },
            "start_time_in_video_in_sec": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Start time in video in seconds when the tagged user shows up",
               "examples": [
                  null
               ],
               "title": "Start Time In Video In Sec"
            },
            "duration_in_video_in_sec": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Duration in the video in seconds, when the tagged user shows up",
               "examples": [
                  null
               ],
               "title": "Duration In Video In Sec"
            }
         },
         "required": [
            "user"
         ],
         "title": "Usertag",
         "type": "object"
      }
   },
   "required": [
      "music"
   ]
}

Fields:
field music: Music [Required]

A music which is used in all posts.

pydantic model HashtagBasicInfos[source]

A list of hashtag basic infos are contained for storing user following hashtags information.

Show JSON schema
{
   "title": "HashtagBasicInfos",
   "description": "A list of hashtag basic infos are contained for storing user following\nhashtags information.",
   "type": "object",
   "properties": {
      "hashtags": {
         "default": [],
         "description": "Found hashtags matched to the keywords.",
         "examples": [
            [
               {
                  "id": "17843654935044234",
                  "name": "primeleague",
                  "post_count": 16,
                  "profile_pic_url": "https://cdninstagram.com/vad"
               }
            ]
         ],
         "items": {
            "$ref": "#/$defs/HashtagBasicInfo"
         },
         "title": "Hashtags",
         "type": "array"
      },
      "count": {
         "default": 0,
         "description": "Number of hashtags contained.",
         "examples": [
            100
         ],
         "title": "Count",
         "type": "integer"
      }
   },
   "$defs": {
      "HashtagBasicInfo": {
         "description": "Hashtag basic information",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the hashtag.",
               "examples": [
                  "17843820562040860"
               ],
               "title": "Id"
            },
            "name": {
               "description": "name of the hashtag.",
               "examples": [
                  "asiangames"
               ],
               "title": "Name",
               "type": "string"
            },
            "post_count": {
               "default": 0,
               "description": "Count of the posts with the hashtag.",
               "examples": [
                  405268
               ],
               "title": "Post Count",
               "type": "integer"
            },
            "profile_pic_url": {
               "default": "",
               "description": "Hashtag profile picture url. It's created by instagram using one of the popular pictures from posts with the hashtag.",
               "examples": [
                  "https://scontent-muc2-1.cdninstagram.com/vad"
               ],
               "title": "Profile Pic Url",
               "type": "string"
            }
         },
         "required": [
            "id",
            "name"
         ],
         "title": "HashtagBasicInfo",
         "type": "object"
      }
   }
}

Fields:
field count: int = 0

Number of hashtags contained.

field hashtags: List[HashtagBasicInfo] = []

Found hashtags matched to the keywords.

pydantic model Hashtag[source]

Hashtag information

Show JSON schema
{
   "title": "Hashtag",
   "description": "Hashtag information",
   "type": "object",
   "properties": {
      "id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "description": "Unique identifier of the hashtag.",
         "examples": [
            "17843820562040860"
         ],
         "title": "Id"
      },
      "name": {
         "description": "name of the hashtag.",
         "examples": [
            "asiangames"
         ],
         "title": "Name",
         "type": "string"
      },
      "post_count": {
         "default": 0,
         "description": "Count of the posts with the hashtag.",
         "examples": [
            405268
         ],
         "title": "Post Count",
         "type": "integer"
      },
      "profile_pic_url": {
         "default": "",
         "description": "Hashtag profile picture url. It's created by instagram using one of the popular pictures from posts with the hashtag.",
         "examples": [
            "https://scontent-muc2-1.cdninstagram.com/vad"
         ],
         "title": "Profile Pic Url",
         "type": "string"
      },
      "is_trending": {
         "default": false,
         "description": "Is it a trending hashtag?",
         "examples": [
            false
         ],
         "title": "Is Trending",
         "type": "boolean"
      },
      "related_tags": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Related tags in a list. This is calculated by instagram based on co-occurrence of posts.",
         "examples": [
            "asiangames2023"
         ],
         "title": "Related Tags"
      },
      "subtitle": {
         "default": "",
         "description": "subtitle of the hastag.",
         "examples": [
            "See a few top posts each week"
         ],
         "title": "Subtitle",
         "type": "string"
      },
      "posts": {
         "default": [],
         "description": "A list of top posts. Instagram only shows top posts (up to 30) from the hashtag.",
         "examples": [
            []
         ],
         "items": {
            "$ref": "#/$defs/Post"
         },
         "title": "Posts",
         "type": "array"
      }
   },
   "$defs": {
      "Caption": {
         "description": "Caption of the post.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Unique identifier of the caption.",
               "examples": [
                  "1107837019238536"
               ],
               "title": "Id"
            },
            "text": {
               "default": "",
               "description": "Text content of the caption. The Instagram caption character limit is also 2200 characters, just like the comment. Instagram caption can only contain up to 30 hashtags.",
               "examples": [
                  "Life's a beach, and I'm just playing in the sand."
               ],
               "title": "Text",
               "type": "string"
            },
            "created_at_utc": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Timestamp when the caption was created. In unix epoch time.",
               "examples": [
                  1693213015
               ],
               "title": "Created At Utc"
            }
         },
         "title": "Caption",
         "type": "object"
      },
      "Location": {
         "description": "Location information, contains location name, city, longitude, latitude and\naddress etc. The location information is provided by the post owner, while\ncreating/editing the post.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the location.",
               "examples": [
                  "1107837019238536"
               ],
               "title": "Id"
            },
            "name": {
               "description": "Full name of the location.",
               "examples": [
                  "Kedrodasos Beach"
               ],
               "title": "Name",
               "type": "string"
            },
            "short_name": {
               "default": "",
               "description": "Short name of the location",
               "examples": [
                  "Kedro-beach"
               ],
               "title": "Short Name",
               "type": "string"
            },
            "city": {
               "default": "",
               "description": "to which city the location belongs",
               "examples": [
                  "K\u00e1ntanos, Khania, Greece"
               ],
               "title": "City",
               "type": "string"
            },
            "lng": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Longitude of the location.",
               "examples": [
                  23.5619
               ],
               "title": "Lng"
            },
            "lat": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Latitude of the location.",
               "examples": [
                  35.26861
               ],
               "title": "Lat"
            },
            "address": {
               "default": "",
               "description": "Address of the location. Typically is empty.",
               "examples": [
                  ""
               ],
               "title": "Address",
               "type": "string"
            }
         },
         "required": [
            "id",
            "name"
         ],
         "title": "Location",
         "type": "object"
      },
      "MusicBasicInfo": {
         "description": "Music information about its url, duration, title, originally from which\npost it comes, artist etc.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "id of this audio asset.",
               "examples": [
                  "664212705901923"
               ],
               "title": "Id"
            },
            "is_trending_in_clips": {
               "default": false,
               "description": "Is this music trending in clips?",
               "examples": [
                  true,
                  false
               ],
               "title": "Is Trending In Clips",
               "type": "boolean"
            },
            "artist": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Artist who created this audio/music. For a music, it will only contain the name of the artist. For a sound, it will contain thecreator's instagram information, such as id, username etc.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "title": {
               "default": "Original audio",
               "description": "Title.",
               "examples": [
                  "Original audio"
               ],
               "title": "Title",
               "type": "string"
            },
            "duration_in_ms": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Music duration",
               "examples": [
                  6617
               ],
               "title": "Duration In Ms"
            },
            "url": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "the download url of the music",
               "examples": [
                  "https://scontent-muc2-1.xx.fbcdn.net/v/t39.12897-6/4.m4a"
               ],
               "title": "Url"
            }
         },
         "required": [
            "id"
         ],
         "title": "MusicBasicInfo",
         "type": "object"
      },
      "Post": {
         "description": "Post information about when it was created, who is tagged in it, its\ncaption, location width, height etc. ",
         "properties": {
            "like_count": {
               "default": 0,
               "description": "Count of likes.",
               "examples": [
                  10
               ],
               "title": "Like Count",
               "type": "integer"
            },
            "comment_count": {
               "default": 0,
               "description": "Count of comments.",
               "examples": [
                  10
               ],
               "title": "Comment Count",
               "type": "integer"
            },
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the post.",
               "examples": [
                  "3179223655971394742"
               ],
               "title": "Id"
            },
            "code": {
               "description": "Short code of the post url. Can be used in form of www.instagram.com/<code> to access the post.",
               "examples": [
                  "Cx4I1irBSnk"
               ],
               "title": "Code",
               "type": "string"
            },
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  }
               ],
               "description": "User who owns the post.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "taken_at": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "When the post was created, in unix epoch time.",
               "examples": [
                  1695060863
               ],
               "title": "Taken At"
            },
            "media_type": {
               "description": "Media type: Photo, Video, IGTV, Reel, Album.",
               "examples": [
                  "Photo"
               ],
               "title": "Media Type",
               "type": "string"
            },
            "caption": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Caption"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Caption of the post.",
               "examples": [
                  null
               ]
            },
            "accessibility_caption": {
               "default": "",
               "description": "Accessibility caption in text format. Alt text describes your photos for people with visual impairments. Alt text will be automatically created for your photos or you can choose to write your own.",
               "examples": [
                  "Photo is taken by John."
               ],
               "title": "Accessibility Caption",
               "type": "string"
            },
            "original_width": {
               "description": "Original width of the media, can be used to get the downloading url of the media.",
               "examples": [
                  1440
               ],
               "title": "Original Width",
               "type": "integer"
            },
            "original_height": {
               "description": "Original height of the media, can be used to get the downloading url of the media.",
               "examples": [
                  1440
               ],
               "title": "Original Height",
               "type": "integer"
            },
            "urls": {
               "default": [],
               "description": "Download URL of the media, which is only accessible in a few hours.",
               "examples": [
                  [
                     "https://scontent-muc2-1.cdninstagram.com/v/t39.30808-6/369866.jpg"
                  ]
               ],
               "items": {
                  "type": "string"
               },
               "title": "Urls",
               "type": "array"
            },
            "has_shared_to_fb": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Is the post shared to facebook?",
               "examples": [
                  false
               ],
               "title": "Has Shared To Fb"
            },
            "usertags": {
               "default": [],
               "description": "Usertags appear in the post.",
               "examples": [],
               "items": {
                  "$ref": "#/$defs/Usertag"
               },
               "title": "Usertags",
               "type": "array"
            },
            "location": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Location"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Location of the post, most of the time it's not given.",
               "examples": []
            },
            "music": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MusicBasicInfo"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "music used in this post.",
               "examples": [
                  {
                     "artist": {
                        "fullname": "Dummy User",
                        "id": "387381865",
                        "is_private": true,
                        "is_verified": false,
                        "profile_pic_url": "https://dummy-pic.com",
                        "username": "dummy_user"
                     },
                     "duration_in_ms": 6617,
                     "id": "664212705901923",
                     "is_trending_in_clips": false,
                     "title": "Original audio",
                     "url": "https://scontent-muc2-1.xx.fbcdn.net/v.m4a"
                  }
               ]
            }
         },
         "required": [
            "id",
            "code",
            "user",
            "media_type",
            "original_width",
            "original_height"
         ],
         "title": "Post",
         "type": "object"
      },
      "UserProfile": {
         "description": "User basic information, contains `id`, `username`, `fullname`, `profile_pic_url` and `is_verified`.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "unique identifier if an user. It's 9 digits in string format.",
               "examples": [
                  "387381865"
               ],
               "title": "Id"
            },
            "username": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
               "examples": [
                  "dummy_user"
               ],
               "title": "Username",
               "type": "string"
            },
            "fullname": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters, numbers, periods, underscores and spaces.",
               "examples": [
                  "Dummy User"
               ],
               "title": "Fullname",
               "type": "string"
            },
            "profile_pic_url": {
               "default": "",
               "description": "Url of the profile picture for downloading. The generated link is usually available only for couple hours.",
               "examples": [
                  "https://dummy-pic.com"
               ],
               "title": "Profile Pic Url",
               "type": "string"
            },
            "is_private": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates that the user account is private or public.Please check https://help.instagram.com/448523408565555for detailed information.",
               "examples": [
                  false
               ],
               "title": "Is Private"
            },
            "is_verified": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates whether the user account is verified as business/official account or not.",
               "examples": [
                  false
               ],
               "title": "Is Verified"
            }
         },
         "title": "UserProfile",
         "type": "object"
      },
      "Usertag": {
         "description": "Usertag information, mainly about who is tagged at which position at what time\nin video and how long the tagged user appears.",
         "properties": {
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  }
               ],
               "description": "User who is tagged in the post.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            },
            "position": {
               "anyOf": [
                  {
                     "items": {
                        "type": "number"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A list of two floats, which is used to identify the position of the tagged user in the post.",
               "examples": [
                  [
                     0.6794871795,
                     0.7564102564
                  ]
               ],
               "title": "Position"
            },
            "start_time_in_video_in_sec": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Start time in video in seconds when the tagged user shows up",
               "examples": [
                  null
               ],
               "title": "Start Time In Video In Sec"
            },
            "duration_in_video_in_sec": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Duration in the video in seconds, when the tagged user shows up",
               "examples": [
                  null
               ],
               "title": "Duration In Video In Sec"
            }
         },
         "required": [
            "user"
         ],
         "title": "Usertag",
         "type": "object"
      }
   },
   "required": [
      "id",
      "name"
   ]
}

Config:
  • coerce_numbers_to_str: bool = True

Fields:
field id: str | None [Required]

Unique identifier of the hashtag.

Is it a trending hashtag?

field name: str [Required]

name of the hashtag.

field post_count: int = 0

Count of the posts with the hashtag.

field posts: List[Post] = []

A list of top posts. Instagram only shows top posts (up to 30) from the hashtag.

field profile_pic_url: str = ''

Hashtag profile picture url. It’s created by instagram using one of the popular pictures from posts with the hashtag.

field related_tags: List[str] | None = None

Related tags in a list. This is calculated by instagram based on co-occurrence of posts.

field subtitle: str = ''

subtitle of the hastag.

pydantic model SearchingResult[source]

Searching result contains found hashtags, users and places.

Show JSON schema
{
   "title": "SearchingResult",
   "description": "Searching result contains found hashtags, users and places.",
   "type": "object",
   "properties": {
      "hashtags": {
         "default": [],
         "description": "Found hashtags matched to the keywords.",
         "examples": [
            [
               {
                  "hashtag": {
                     "id": "17843654935044234",
                     "name": "primeleague",
                     "post_count": 16,
                     "profile_pic_url": "https://scontent-muc2-1.cdninstagram.com/vad"
                  },
                  "position": 0
               }
            ]
         ],
         "items": {
            "$ref": "#/$defs/SearchingResultHashtag"
         },
         "title": "Hashtags",
         "type": "array"
      },
      "users": {
         "default": [],
         "description": "Found users matched to the keywords.",
         "examples": [
            [
               {
                  "position": 1,
                  "user": {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               }
            ]
         ],
         "items": {
            "$ref": "#/$defs/SearchingResultUser"
         },
         "title": "Users",
         "type": "array"
      },
      "places": {
         "default": [],
         "description": "Found places matched to the keywords.",
         "examples": [
            [
               {
                  "place": {
                     "location": {
                        "id": "213502500",
                        "name": "Beijing, China"
                     },
                     "subtitle": "",
                     "title": "Beijing, China"
                  },
                  "position": 1
               }
            ]
         ],
         "items": {
            "$ref": "#/$defs/SearchingResultPlace"
         },
         "title": "Places",
         "type": "array"
      },
      "personalised": {
         "description": "Indicate whether the searching result is personalised or not.",
         "examples": [
            true,
            false
         ],
         "title": "Personalised",
         "type": "boolean"
      }
   },
   "$defs": {
      "HashtagBasicInfo": {
         "description": "Hashtag basic information",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the hashtag.",
               "examples": [
                  "17843820562040860"
               ],
               "title": "Id"
            },
            "name": {
               "description": "name of the hashtag.",
               "examples": [
                  "asiangames"
               ],
               "title": "Name",
               "type": "string"
            },
            "post_count": {
               "default": 0,
               "description": "Count of the posts with the hashtag.",
               "examples": [
                  405268
               ],
               "title": "Post Count",
               "type": "integer"
            },
            "profile_pic_url": {
               "default": "",
               "description": "Hashtag profile picture url. It's created by instagram using one of the popular pictures from posts with the hashtag.",
               "examples": [
                  "https://scontent-muc2-1.cdninstagram.com/vad"
               ],
               "title": "Profile Pic Url",
               "type": "string"
            }
         },
         "required": [
            "id",
            "name"
         ],
         "title": "HashtagBasicInfo",
         "type": "object"
      },
      "LocationBasicInfo": {
         "description": "Location information, contains location name, city, longitude, latitude and\naddress etc. The location information is provided by the post owner, while\ncreating/editing the post.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "description": "Unique identifier of the location.",
               "examples": [
                  "1107837019238536"
               ],
               "title": "Id"
            },
            "name": {
               "description": "Full name of the location.",
               "examples": [
                  "Kedrodasos Beach"
               ],
               "title": "Name",
               "type": "string"
            }
         },
         "required": [
            "id",
            "name"
         ],
         "title": "LocationBasicInfo",
         "type": "object"
      },
      "Place": {
         "properties": {
            "location": {
               "allOf": [
                  {
                     "$ref": "#/$defs/LocationBasicInfo"
                  }
               ],
               "description": "Place appears in the search result at the associated position.",
               "examples": [
                  {
                     "id": "213502500",
                     "name": "Beijing, China"
                  }
               ]
            },
            "subtitle": {
               "default": "",
               "description": "Subtitle of the place, normally it can be in a different language.",
               "examples": [
                  "Puerto Del Rosario, Canarias, Spain"
               ],
               "title": "Subtitle",
               "type": "string"
            },
            "title": {
               "default": "",
               "description": "Title of the place, normally it can be in a different language.",
               "examples": [
                  "Morro Jable"
               ],
               "title": "Title",
               "type": "string"
            }
         },
         "required": [
            "location"
         ],
         "title": "Place",
         "type": "object"
      },
      "SearchingResultHashtag": {
         "description": "Hashtag appears in searching result.",
         "properties": {
            "position": {
               "description": "Position of the search result.",
               "examples": [
                  0,
                  1
               ],
               "title": "Position",
               "type": "integer"
            },
            "hashtag": {
               "allOf": [
                  {
                     "$ref": "#/$defs/HashtagBasicInfo"
                  }
               ],
               "description": "Hashtag shows in the search result at the associated position.",
               "examples": [
                  {
                     "id": "17843654935044234",
                     "name": "primeleague",
                     "post_count": 16,
                     "profile_pic_url": "https://sconte.cdninstagram.com/vad"
                  }
               ]
            }
         },
         "required": [
            "position",
            "hashtag"
         ],
         "title": "SearchingResultHashtag",
         "type": "object"
      },
      "SearchingResultPlace": {
         "description": "User appears in searching result.",
         "properties": {
            "position": {
               "description": "Position of the search result.",
               "examples": [
                  0,
                  1
               ],
               "title": "Position",
               "type": "integer"
            },
            "place": {
               "allOf": [
                  {
                     "$ref": "#/$defs/Place"
                  }
               ],
               "description": "Place appears in the search result at the associated position.",
               "examples": [
                  {
                     "location": {
                        "id": "213502500",
                        "name": "Beijing, China"
                     },
                     "subtitle": "",
                     "title": "Beijing, China"
                  }
               ]
            }
         },
         "required": [
            "position",
            "place"
         ],
         "title": "SearchingResultPlace",
         "type": "object"
      },
      "SearchingResultUser": {
         "description": "User appears in searching result.",
         "properties": {
            "position": {
               "description": "Position of the search result.",
               "examples": [
                  0,
                  1
               ],
               "title": "Position",
               "type": "integer"
            },
            "user": {
               "allOf": [
                  {
                     "$ref": "#/$defs/UserProfile"
                  }
               ],
               "description": "User appears in the search result at the associated position.",
               "examples": [
                  {
                     "fullname": "Dummy User",
                     "id": "387381865",
                     "is_private": null,
                     "is_verified": false,
                     "profile_pic_url": "https://dummy-pic.com",
                     "username": "dummy_user"
                  }
               ]
            }
         },
         "required": [
            "position",
            "user"
         ],
         "title": "SearchingResultUser",
         "type": "object"
      },
      "UserProfile": {
         "description": "User basic information, contains `id`, `username`, `fullname`, `profile_pic_url` and `is_verified`.",
         "properties": {
            "id": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "unique identifier if an user. It's 9 digits in string format.",
               "examples": [
                  "387381865"
               ],
               "title": "Id"
            },
            "username": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters in lowercase, numbers, periods, and underscores.It's the unique identifier for the user besides the user id,which is generated by instagram automatically.",
               "examples": [
                  "dummy_user"
               ],
               "title": "Username",
               "type": "string"
            },
            "fullname": {
               "default": "",
               "description": "It's limited to 30 characters and must contain only letters, numbers, periods, underscores and spaces.",
               "examples": [
                  "Dummy User"
               ],
               "title": "Fullname",
               "type": "string"
            },
            "profile_pic_url": {
               "default": "",
               "description": "Url of the profile picture for downloading. The generated link is usually available only for couple hours.",
               "examples": [
                  "https://dummy-pic.com"
               ],
               "title": "Profile Pic Url",
               "type": "string"
            },
            "is_private": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates that the user account is private or public.Please check https://help.instagram.com/448523408565555for detailed information.",
               "examples": [
                  false
               ],
               "title": "Is Private"
            },
            "is_verified": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates whether the user account is verified as business/official account or not.",
               "examples": [
                  false
               ],
               "title": "Is Verified"
            }
         },
         "title": "UserProfile",
         "type": "object"
      }
   },
   "required": [
      "personalised"
   ]
}

Fields:
field hashtags: List[SearchingResultHashtag] = []

Found hashtags matched to the keywords.

field personalised: bool [Required]

Indicate whether the searching result is personalised or not.

field places: List[SearchingResultPlace] = []

Found places matched to the keywords.

field users: List[SearchingResultUser] = []

Found users matched to the keywords.

crawlinsta.utils

filter_requests(requests: List[Request], response_content_type: str = 'application/json; charset=utf-8') List[Request][source]

Filter requests based on the response content type.

Parameters:
  • requests (list of seleniumwire.request.Request) – The list of requests.

  • response_content_type (str) – The content type of the response.

Returns:

The filtered list of requests.

Return type:

seleniumwire.request.Request

Raises:

ValueError – If there are no requests to filter.

Examples

>>> from crawlinsta import webdriver
>>> driver = webdriver.Chrome()
>>> driver.get("https://www.instagram.com")
>>> from crawlinsta.utils import filter_requests
>>> json_requests = filter_requests(driver.requests)
find_brackets(text: str) List[Tuple[int, int]][source]

Find the brackets in the text.

Parameters:

text (str) – The text to search for brackets.

Returns:

The list of tuples containing the start and end indices of the brackets.

Return type:

List[tuple]

Examples

>>> from crawlinsta.utils import find_brackets
>>> brackets = find_brackets("{{hello}}")
>>> print(brackets)
[(0, 7)]
get_json_data(response: Response) Dict[str, Any][source]

Get the json data from the response.

Parameters:

response (list of seleniumwire.request.Response) – The response object.

Returns:

The json data from the response.

Return type:

Json

Examples

>>> from crawlinsta import webdriver
>>> driver = webdriver.Chrome()
>>> driver.get("https://www.instagram.com")
>>> from crawlinsta.utils import get_json_data
>>> json_data = get_json_data(driver.requests[0].response)
get_media_type(media_type: int, product_type: str) str[source]

Determine the media type based on the provided media type and product type.

Parameters:
  • media_type (int) – The numeric identifier representing the media type.

  • product_type (str) – The type of product (e.g., ‘feed’, ‘igtv’, ‘clips’) associated with the media.

Returns:

A string indicating the determined media type.

Return type:

str

Raises:
  • ValueError – If the provided media_type or product_type does not match

  • expected values.

Examples

>>> # Determine media type for media_type = 1 and product_type = 'feed'
>>> media = get_media_type(1, 'feed')  # Returns: "Photo"
>>> # Determine media type for media_type = 2 and product_type = 'igtv'
>>> media = get_media_type(2, 'igtv')  # Returns: "IGTV"
>>> # Determine media type for media_type = 8
>>> media = get_media_type(8, 'any')  # Returns: "Album"
>>> # Raises a ValueError for invalid media_type or product_type
>>> get_media_type(3, 'unknown')  # Raises ValueError
search_request(requests: List[Request], request_url: str, response_content_type: str | None = 'application/json; charset=utf-8', additional_search_func: Callable | None = None, *args, **kwargs) int | None[source]

Search for a request in the list of requests.

Parameters:
  • requests (list of seleniumwire.request.Request) – The list of requests.

  • request_url (str) – The url to search for.

  • response_content_type (Optional[str]) – The content type of the response.

  • additional_search_func (callable) – Additional search function to apply.

Returns:

The index of the request in the list of requests. If the request is not found, returns None.

Return type:

int

Raises:
  • ValueError – If there are no requests to search.

  • ValueError – If no response with the specified content type to the url is found.

Examples

>>> from crawlinsta import webdriver
>>> driver = webdriver.Chrome()
>>> driver.get("https://www.instagram.com")
>>> from crawlinsta.utils import search_request
>>> idx = search_request(driver.requests, "https://www.instagram.com", "application/json; charset=utf-8")