You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否通过图片文件名计算包含该图片的Instagram帖子shortcode?

Can you calculate an Instagram post's shortcode from an image filename?

Yes, you absolutely can! Instagram's image filename structure includes the key piece of data needed to derive the post's shortcode. Let's break this down using your example.

Step 1: Extract the Media ID from the filename

Instagram's native image filenames follow a consistent pattern: {user_id}_{media_id}_{random_suffix}_n.jpg (the suffix might change slightly for different image sizes, but the core structure stays the same).

For your example filename 130603078_209367414109482_797155749429813539_n.jpg, the media ID is the numeric string between the first and second underscores: 209367414109482.

Step 2: Convert the Media ID to the Shortcode

Instagram shortcodes are a modified Base64 encoding of the media ID. Here's the exact conversion process:

  1. Treat the media ID as a 64-bit integer (pad it with leading zeros if it's shorter than 8 bytes to fill the 64-bit length).
  2. Encode this 8-byte sequence using standard Base64.
  3. Swap the standard Base64 special characters: replace + with - and / with _ (Instagram uses these alternatives to avoid URL conflicts).
  4. Remove any trailing padding = characters (shortcodes don't include these).

Applying this to your example:

  1. The media ID 209367414109482 converts to an 8-byte big-endian sequence.
  2. Standard Base64 encoding gives CIvvID/MEXO=.
  3. Replace / with _ and strip the trailing =, resulting in CIvvID_MEXO — exactly the shortcode you expected.

Important Caveats

  • This only works for images directly saved or downloaded from Instagram. Third-party tools may rename files or remove the media ID segment, making this method useless.
  • The random suffix after the media ID in the filename has no impact on the shortcode — you only need the middle numeric segment.

内容的提问来源于stack exchange,提问作者KeyKi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 08:14:00