From 8e8dbb408fffabebaa9515c31590b3417778aafe Mon Sep 17 00:00:00 2001 From: Chris Ellsworth Date: Thu, 13 Feb 2025 12:19:50 -0800 Subject: [PATCH] [IG] Allow integer media IDs This value may already be in its integer form thus it will not be necessary to parse it out of a string --- yt_dlp/extractor/instagram.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/instagram.py b/yt_dlp/extractor/instagram.py index 55086d0b2..1cb97b229 100644 --- a/yt_dlp/extractor/instagram.py +++ b/yt_dlp/extractor/instagram.py @@ -28,7 +28,8 @@ def _pk_to_id(media_id): """Source: https://stackoverflow.com/questions/24437823/getting-instagram-post-url-from-media-id""" - return encode_base_n(int(media_id.split('_')[0]), table=_ENCODING_CHARS) + pk = int(str(media_id).split('_')[0]) + return encode_base_n(pk, table=_ENCODING_CHARS) def _id_to_pk(shortcode):