subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
3.99k stars 641 forks source link

[BUG] Null video_url #1543

Open florifull opened 10 months ago

florifull commented 10 months ago

I've realized on SOME content on Instagram, videos/reels will have a NULL video_url.

Is there any reason for this? I would say this happens for 20% ish content.

adw0rd commented 10 months ago

@florifull give an example please

thewolfprod commented 9 months ago

@florifull give an example please

I think I found myself in a similar situation to @florifull

I'm trying to download an image from random post, but the API doesn't return me any URL that can be saved on my PC as an image (not counting the thumbnail - the API gives me a link to it but the quality of that image is poor as we can except).

The link to the example post that doesn't work for me: https://www.instagram.com/p/CxwqqfOsD-V/?utm_source=ig_web_copy_link

My script:

    urlToPost = input("URL to Post: ")

    postMediaPK = client.media_pk_from_url(urlToPost)
    try:
        postMedia = client.media_info(postMediaPK)
    except LoginRequired:
        resetSessionID()
        loginUser("You need to re-login!")

    if postMedia == None:
        print("Media is None!")
        return

    thumbUrl = str(postMedia.thumbnail_url or "None")
    print("Type: " + getMediaType(postMedia.media_type))
    print("Product Type: " + str(postMedia.product_type or "None"))
    print("Video URL: " + str(postMedia.video_url or "None"))
    print("Video Length: " + str(postMedia.video_duration or "None"))
    print("Amount of resources: " + str(len(postMedia.resources) or "None"))
    print("Thumbnail: " + thumbUrl)

    ## DOESN'T WORK ##
    img = client.photo_download_by_url_origin(urlToPost)
    saveFile('testimg.jpg', img) ## FILE IS CORRUPTED
    ## DOESN'T WORK ##

Output:

URL to Post: https://www.instagram.com/p/CxwqqfOsD-V/?utm_source=ig_web_copy_link
Type: Image
Product Type: feed
Video URL: None
Video Length: None
Amount of resources: None
Thumbnail:
https://scontent-waw1-1.cdninstagram.com/v/t51.2885-15/385174082_251560954545094_3180730719918433015_n.jpg?stp=dst-jpg_e
35_s1080x1080&_nc_ht=scontent-waw1-1.cdninstagram.com&_nc_cat=1&_nc_ohc=KZ_DD89KFBMAX9f8N4N&edm=ALQROFkBAAAA&ccb=7-5&ig_
cache_key=MzIwMjI0Njk3Mjc2NDM0MDExNw%3D%3D.2-ccb7-5&oh=00_AfCByB66n68k6uS170q7EWexcP4_CCQjdG0ATJ9Is2Yjog&oe=651AE623&_nc
_sid=fc8dfb