CrypticGuy / pyigdl

A Python package for downloading Instagram videos, posts, stories, and more. This package provides an unofficial scraping functionality to retrieve content from Instagram, similar to saveig.app and https://github.com/sasmeee/igdl (Node.Js)
MIT License
6 stars 1 forks source link

Download link to only thumbnail #1

Closed Fakhrillo closed 3 months ago

Fakhrillo commented 3 months ago

Hey there, I saw your work, that's great, but I couldn't use it to download Instagram videos, instead, it's giving download links to the thumbnail only, if you can fix that part it would be very great, thanks.

CrypticGuy commented 3 months ago

Looking into this. Can you share some urls that are not working? Will attempt to fix it today.

Fakhrillo commented 3 months ago
from pyigdl import IGDownloader

data = IGDownloader("https://www.instagram.com/reel/C-0CTl6o7SO/?igsh=MTRqeGJyY3hsdThhaA==")
print(data[0]["download_link"])

I tried this one and got link to it's thumbnail image:

https://dl.snapcdn.app/download?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJodHRwczovL3Njb250ZW50LmNkbmluc3RhZ3JhbS5jb20vdi90NTEuMjkzNTAtMTUvNDU2MDc0MjcyXzkwOTc0OTE0NDMxODg4NV83ODA4NDY4NjY5MDc1NzcyOTI5X24uanBnP3N0cD1kc3QtanBnX2UxNSZfbmNfaHQ9c2NvbnRlbnQtaGVsMy0xLmNkbmluc3RhZ3JhbS5jb20mX25jX2NhdD0xJl9uY19vaGM9czZJaWNPRFAycndRN2tOdmdIZ3Z2QTgmZWRtPUFQX1YxMEVCQUFBQSZjY2I9Ny01Jm9oPTAwX0FZQ1RFNEhrTG5KWlVMMHVKR1JXYVFxOVRRVnpva0gySWxnRTUtbW8wQ01mNEEmb2U9NjZDQjkzMkImX25jX3NpZD0yOTk5YjgiLCJmaWxlbmFtZSI6IlNhdmVJRy5BcHBfNDU2MDc0MjcyXzkwOTc0OTE0NDMxODg4NV83ODA4NDY4NjY5MDc1NzcyOTI5X24uanBnIiwibmJmIjoxNzI0MjMxNjczLCJleHAiOjE3MjQyMzUyNzMsImlhdCI6MTcyNDIzMTY3M30.dV-zOImyD41VtlIFUsMACu1bhECEaQ_K5xJHDXU22bk

CrypticGuy commented 3 months ago

Quick update on the issue, so, the API response from the scraper had been changed. Updating the new code and testing it before sharing it. Should be live in an hour or so.

CrypticGuy commented 3 months ago

Hey @Fakhrillo , try now, patched it. Let me know if you still face any issue.

Will look into an improved solution in near future.

amiteshore commented 3 months ago

Hey @CrypticGuy , love your work.

I’m encountering an issue with the IGDownloader function from pyigdl. When running the following code:

from pyigdl import IGDownloader

data = IGDownloader("https://www.instagram.com/p/C_B03_ry0aK/?utm_source=ig_web_copy_link")
# print(data[0]["download_link"])
print(data)

I noticed that the thumbnail_link values are not returned correctly after the first three items. It returns thumbnail_link': '/imgs/loader.gif, whereas download_link is returned correctly.

I'm including the response in JSON format:

Click to see the JSON response ```json [ { "download_link": "https://dl.snapcdn.app/download?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJodHRwczovL3Njb250ZW50LmNkbmluc3RhZ3JhbS5jb20vdi90NTEuMjkzNTAtMTUvNDU2NTcyMjY3XzM3NzA5MTMyMTk4MzEyOTZfMTMxOTk1NDgyOTM3MjE1NjYyOV9uLmpwZz9zdHA9ZHN0LWpwZ19lMzVfcDEwODB4MTA4MCZlZmc9ZXlKMlpXNWpiMlJsWDNSaFp5STZJbWx0WVdkbFgzVnliR2RsYmk0eE5EUXdlREU0TURBdWMyUnlMbVl5T1RNMU1DNWtaV1poZFd4MFgybHRZV2RsSW4wJl9uY19odD1zY29udGVudC1oZWwzLTEuY2RuaW5zdGFncmFtLmNvbSZfbmNfY2F0PTEmX25jX29oYz1hOEZjamlFUGp4WVE3a052Z0hxVUlzNSZlZG09QVBfVjEwRUJBQUFBJmNjYj03LTUmb2g9MDBfQVlCU2lhcDdJd254VmVhS0JqdDBZZkFtbFByV3Znd2JLOEx5U1N4Zno3d2k1dyZvZT02NkNGMzFCNCZfbmNfc2lkPTI5OTliOCIsImZpbGVuYW1lIjoiU2F2ZUlHLkFwcF80NTY1NzIyNj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3n0gQUJPI", "thumbnail_link": "/imgs/loader.gif" }, { "download_link": "https://dl.snapcdn.app/download?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJodHRwczovL3Njb250ZW50LmNkbmluc3RhZ3JhbS5jb20vdi90NTEuMjkzNTAtMTUvNDU2OTA3NDEzXzEwMjIyNDk0NjI2ODM0NzJfNDQxNzI4OTA3MjkzNTEyMzc1Nl9uLmpwZz9zdHA9ZHN0LWpwZ19lMzVfcDEwODB4MTA4MCZlZmc9ZXlKMlpXNWpiMlJsWDNSaFp5STZJbWx0WVdkbFgzVnliR2RsYmk0eE5EUXdlREU0TURBdWMyUnlMbVl5T1RNMU1DNWtaV1poZFd4MFgybHRZV2RsSW4wJl9uY19odD1zY29udGVudC1oZWwzLTEuY2RuaW5zdGFncmFtLmNvbSZfbmNfY2F0PTEwOCZfbmNfb2hjPU04UmFadkJwd1dzUTdrTnZnSENnbmctJmVkbT1BUF9WMTBFQkFBQUEmY2NiPTctNSZvaD0wMF9BWURRSWF1NmVFelg5eTZsOU00bGxpYTV2S3VLa0dRcklablozeXZUbTdhU1ZRJm9lPTY2Q0YzQUJCJl9uY19zaWQ9Mjk5OWI4IiwiZmlsZW5hbWUiOiJTYXZlSUcuQXBwXzQ1NjkwNzQxM18xMDIyMjQ5NDYyNjgzNDcyXzQ0MTcyODkwNzI5MzUxMjM3NTZfbi5qcGciLCJuYmYiOjE3MjQ0Nzk3MjgsImV4cCI6MTcyNDQ4MzMyOCwiaWF0IjoxNzI0NDc5NzI4fQ.2lQGkFew9wDi0DQWqV4jraif_gAlCM93D-FidxdRf7k", "thumbnail_link": "/imgs/loader.gif" }, { "download_link": "https://dl.snapcdn.app/download?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJodHRwczovL3Njb250ZW50LmNkbmluc3RhZ3JhbS5jb20vdi90NTEuMjkzNTAtMTUvNDU2NDYwNDM5XzExNzcxNzU1NzMzNDc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MTcyNDQ3OTcyOH0.c-wGm6zwWKzGqHOy-QUmgj9GEhLpO5n3jRhCIsrRPq0", "thumbnail_link": "/imgs/loader.gif" } ] ```

Is there a known issue or limitation with the IGDownloader function that could explain this behavior?

I appreciate your help in resolving this issue. Thank you!

CrypticGuy commented 3 months ago

Hey @amiteshore , looking into this. Is this like one of those carousel posts? I haven't evaluated those yet, but I'll check this and get back.

amiteshore commented 3 months ago

@CrypticGuy Yes, the issue I'm describing occurs specifically with carousel posts.

The IGDownloader function works correctly for single photos or reels. However, when handling links that contain multiple posts (such as carousel posts), it seems to encounter problems, leading to incorrect thumbnail_link values after the initial items.

CrypticGuy commented 3 months ago

Sure. Will check it out and see what the issue is.

CrypticGuy commented 3 months ago

Hey @amiteshore , try running it now. Made some patches to support carousel downloads. It should work now.

amiteshore commented 3 months ago

Hi @CrypticGuy,

Thanks for the quick update! The changes you made have indeed resolved the issues with carousel posts—they are now working as expected.

However, I've encountered a new issue with single photo posts. Here’s the test code I used:

from pyigdl import IGDownloader
import json

# data = IGDownloader("https://www.instagram.com/p/C-VlefaxDc9") # Carousel, works
# data = IGDownloader("https://www.instagram.com/reel/C-TIiK4y7_w") # Reel, works
data = IGDownloader("https://www.instagram.com/p/C-5szP6xjoC") # Single photo, doesn't work

formatted_data = json.dumps(data, indent=4, sort_keys=True)
print(formatted_data)

When attempting to download a single photo, I get the following error:

Traceback (most recent call last):
  File "/home/username/exp/downloader/venv/lib/python3.12/site-packages/pyigdl/igdl.py", line 59, in IGDownloader
    return _sendPostRequest(serverUrl, payloadData, headers)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/exp/downloader/venv/lib/python3.12/site-packages/pyigdl/igdl.py", line 52, in _sendPostRequest
    return _parseResponse(response)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/exp/downloader/venv/lib/python3.12/site-packages/pyigdl/igdl.py", line 42, in _parseResponse
    "download_link": elem.css(".download-items__btn > a").attrib["href"]
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'href'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/username/exp/downloader/venv/src/new.py", line 6, in <module>
    data = IGDownloader("https://www.instagram.com/p/C-5szP6xjoC") # Single photo
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/exp/downloader/venv/lib/python3.12/site-packages/pyigdl/igdl.py", line 61, in IGDownloader
    print(e.with_traceback())
          ^^^^^^^^^^^^^^^^^^
TypeError: BaseException.with_traceback() takes exactly one argument (0 given)

It seems there’s a problem specifically with handling single photo posts. Could you please take a look at this?

Thanks again for your time!

CrypticGuy commented 3 months ago

Yeah, the initial idea was never about downloading photos, but I'll try to add support for the same in a day. @amiteshore , I'll probably close this issue, and open a new one for downloading posts containing single photos.

CrypticGuy commented 3 months ago

Also, if this is something that you can share @amiteshore and @Fakhrillo , I would be excited to hear more about the use cases. Maybe just drop me an email if that works for you. And if it's a public project, I would be glad to add it to the README. Thanks.

CrypticGuy commented 3 months ago

Resolving the issue as the original query has been addressed. Creating new issue for photos download url.