Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[instagram] Private account user timelines not supported #195

Closed
turbomund opened this issue Mar 19, 2019 · 9 comments
Closed

[instagram] Private account user timelines not supported #195

turbomund opened this issue Mar 19, 2019 · 9 comments

Comments

@turbomund
Copy link

gallery-dl -v -d "D:\Div M\Pictures" https://www.instagram.com/adult.x.entertainment/
[gallery-dl][debug] Version 1.8.0
[gallery-dl][debug] Python 3.6.5 - Windows-10-10.0.17134-SP0
[gallery-dl][debug] requests 2.21.0 - urllib3 1.24.1
[gallery-dl][debug] Starting DownloadJob for 'https://www.instagram.com/adult.x.entertainment/'
[instagram][debug] Using InstagramUserExtractor for 'https://www.instagram.com/adult.x.entertainment/'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.instagram.com:443
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /adult.x.entertainment/ HTTP/1.1" 200 9916
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /graphql/query/?query_hash=66eb9403e44cc12e5b5ecda48b667d41&variables=%7B%22id%22:%227837666884%22,%22first%22:12,%22after%22:%22QVFCblBzeGM3Qm1YbFg1LUMtWC1BZko1MUNqcHJqTm83QUhtSEJ1OXFBSk1Uc01DaEgtalE1ZzluTHlUMTVSOVNRMlFObXZBMTFMLU1nMmc5cU5CY3JibQ==%22%7D HTTP/1.1" 200 239
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /graphql/query/?query_hash=66eb9403e44cc12e5b5ecda48b667d41&variables=%7B%22id%22:%227837666884%22,%22first%22:12,%22after%22:%22QVFDN2RoUnNGQ3VwalZyUWZlWTRGc3VWcDZ3QWpsTXBrWXE1aGxUNTZ2SWRlbk04aWwzMXEtQmJYTEVBMjdoRXRNRzU4cEE1aG5NbjVqaHRqVEQ4SkhGVQ==%22%7D HTTP/1.1" 200 143

@iamleot
Copy link
Contributor

iamleot commented Mar 19, 2019 via email

@iamleot
Copy link
Contributor

iamleot commented Mar 19, 2019

Sejer, if you can, please change the title to [instagram] Private account user timelines not supported to better reflect the problem! :) (probably also the single page has the same problems... it should be quick to check by opening a private account on a browser, going to a media and then trying to pass to gallery-dl the URL with the shortcode_id, e.g. https://www.instagram.com/p/<shortcode_id>)

Thank you!

@mikf mikf changed the title Instagram issue on some gallery´s [instagram] Private account user timelines not supported Mar 19, 2019
@KaMyKaSii
Copy link

I also want to download private accounts from Instagram. @mikf will you add support for this?

@iamleot
Copy link
Contributor

iamleot commented Apr 6, 2019 via email

@KaMyKaSii
Copy link

KaMyKaSii commented Apr 6, 2019

Hello KaMyKaSii, KaMyKaSii writes:
I also want to download private accounts from Instagram. @mikf will you add support for this?
It would be nice and probably will just steal 30-60 seconds trying @mikf's suggestion of #214:
Log into your twitter account in a web browser, export cookies to a cookies.txt file, and load them with --cookies. I'll see if I can get "native" Twitter login support with -u and -p up and running, but using exported cookies has the same effect as being logged in and also works.
Can you please try it and let us know if it does the trick?

Thanks for letting me know about cookies. I exported them using the cookies.txt extension but an error occurs when trying to use them in gallery-dl:
$ gallery-dl --verbose --cookies /sdcard/cookies.txt https://instagram.com/censored [gallery-dl][debug] Version 1.8.2-dev [gallery-dl][debug] Python 3.7.3 - Linux-4.4.78-perf+-aarch64-with-libc [gallery-dl][debug] requests 2.20.1 - urllib3 1.24.1 [gallery-dl][debug] Starting DownloadJob for 'https://instagram.com/censored' [instagram][debug] Using InstagramUserExtractor for 'https://instagram.com/censored' [urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.instagram.com:443 [urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /censored/ HTTP/1.1" 200 16691 [urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /p/Bv2DboRg4bJ-Zq0pwUDkXMXrLnCyR-_EZOdThY0/ HTTP/1.1" 200 15583 [instagram][error] An unexpected error occurred: KeyError - 'edge_media_to_comment'. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues . [instagram][debug] Traceback (most recent call last): File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/gallery_dl/job.py", line 54, in run for msg in self.extractor: File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/gallery_dl/extractor/instagram.py", line 32, in items for data in self.instagrams(): File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/gallery_dl/extractor/instagram.py", line 159, in _extract_profilepage yield from self._extract_page(url, 'ProfilePage') File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/gallery_dl/extractor/instagram.py", line 135, in _extract_page yield from self._extract_postpage(url) File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/gallery_dl/extractor/instagram.py", line 53, in _extract_postpage 'comments': text.parse_int(media['edge_media_to_comment']['count']), KeyError: 'edge_media_to_comment' $

@iamleot
Copy link
Contributor

iamleot commented Apr 6, 2019 via email

@mikf
Copy link
Owner

mikf commented Jul 1, 2019

a9c8908 adds login support with -u/--username and -p/--password for Instagram. It doesn't support any "special" cases like 2FA, but I was able to log into my own account and download stuff from https://www.instagram.com/adult.x.entertainment/.
The cookie method suggested by iamleot also worked. The only necessary cookie appears to be sessionid, which has a lifetime of at least 360 days.

The error from #195 (comment) is most likely related to missing edge_media_to_comment fields which has been fixed some time ago in #250.

@mikf mikf closed this as completed Jul 1, 2019
@KaMyKaSii
Copy link

a9c8908 adds login support with -u/--username and -p/--password for Instagram. It doesn't support any "special" cases like 2FA, but I was able to log into my own account and download stuff from https://www.instagram.com/adult.x.entertainment/.
The cookie method suggested by iamleot also worked. The only necessary cookie appears to be sessionid, which has a lifetime of at least 360 days.

The error from #195 (comment) is most likely related to missing edge_media_to_comment fields which has been fixed some time ago in #250.

Yes, after this commit I was able to download using the cookies file. But now with authentication support, I wonder if it is possible for accounts with Facebook login? I tried both with my Instagram username and Facebook email but could not authenticate

@mikf
Copy link
Owner

mikf commented Jul 7, 2019

But now with authentication support, I wonder if it is possible for accounts with Facebook login?

I used the "Log in with Facebook" button on Instagram's main page to initially create an Instagram account without having to input my phone number, and then used that to re-create what happens when the "Log in" button on https://www.instagram.com/accounts/login/ is clicked. So whatever username & password can be used to log directly into Instagram should also work with gallery-dl.

Implementing a round-trip over to Facebook is a bit much, especially since providing cookies also works. Speaking of: you don't need to use a separate cookies file. It is also possible to put them directly in your config file:

...
        "instagram": {
            "cookies": {
                "sessionid": "...",
                "mid"      : "...",
                "csrftoken": "..."
            }
        },
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants