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

Twitter KeyError: 'user' --versbose #891

Closed
beakwood opened this issue Jul 13, 2020 · 7 comments
Closed

Twitter KeyError: 'user' --versbose #891

beakwood opened this issue Jul 13, 2020 · 7 comments

Comments

@beakwood
Copy link

I'm following the profile and it's also public. I can't grab anything (even logged in) and receive this error when trying to do so.

[gallery-dl][debug] Starting DownloadJob for 'https://twitter.com/heythisispaty/media'
[twitter][debug] Using TwitterMediaExtractor for 'https://twitter.com/heythisispaty/media'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): api.twitter.com:443
[urllib3.connectionpool][debug] https://api.twitter.com:443 "GET /graphql/-xfUfZsnR_zqjFd-IfrN5A/UserByScreenName?variables=%7B%22screen_name%22%3A%22heythisispaty%22%2C%22withHighlightedLabel%22%3Atrue%7D HTTP/1.1" 200 157
[twitter][error] An unexpected error occurred: KeyError - 'user'. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[twitter][debug]
Traceback (most recent call last):
File "c:\python38\lib\site-packages\gallery_dl\job.py", line 61, in run
for msg in self.extractor:
File "c:\python38\lib\site-packages\gallery_dl\extractor\twitter.py", line 43, in items
for tweet in self.tweets():
File "c:\python38\lib\site-packages\gallery_dl\extractor\twitter.py", line 265, in tweets
return TwitterAPI(self).timeline_media(self.user)
File "c:\python38\lib\site-packages\gallery_dl\extractor\twitter.py", line 447, in timeline_media
user = self.user_by_screen_name(screen_name)
File "c:\python38\lib\site-packages\gallery_dl\extractor\twitter.py", line 477, in user_by_screen_name
return self._call(endpoint, params)["data"]["user"]
KeyError: 'user'

@shinji257
Copy link
Contributor

Are you sure that is the correct twitter username? I've checked for the user "@heythisispaty" and it comes back and says the user doesn't exist.

[gallery-dl][debug] Starting DownloadJob for 'https://twitter.com/heythisispaty/media' <<

@iamleot
Copy link
Contributor

iamleot commented Jul 13, 2020 via email

@beakwood
Copy link
Author

Apologies, I was looking at it working lol. Yes, it was punctual incorrection. Thanks.

@outlaw240
Copy link

It would be great if it also logged the username like before, I'm using a list with hundreds of users in it and it would help with cleaning up.

@Hrxn
Copy link
Contributor

Hrxn commented Jul 22, 2020

What do you mean? Log settings? Output directory option?

@outlaw240
Copy link

outlaw240 commented Jul 22, 2020

In earlier versions of gallery-dl, the logs would include which line/url in a list file is causing errors, which usually indicates a non-existent or removed user. This no longer seems to be the case, or I'm just missing something.

@Hrxn
Copy link
Contributor

Hrxn commented Jul 22, 2020

Not sure which earlier versions of gallery-dl you mean here, but this should indeed be possible.

With something like this for the logging configuration:

"output":
    {
        "mode": "auto",
        "progress": true,
        "shorten": true,
        "log": "[{name}][{levelname}] {message}",
        "logfile": {
                          "level": "info",
                          "format":  {
                                             "debug"  : "D: {asctime} [{name}][{levelname}] {message}",
                                             "info"   : "I: {asctime} [{name}][{levelname}] {message}",
                                             "warning": "W: {asctime} [{name}][{levelname}] {message}",
                                             "error"  : "E: {asctime} [{name}][{levelname}] {message} Error-URL: {extractor.url}"
                            },
                           "format-date": "%H:%M:%S",
                           "path": "~/log.txt",
                           "encoding": "utf-8",
                           "mode": "a"
                      },
        "unsupportedfile": null
    },

The options set here (i.e. the {..} object) for logfile can also be used in log, so that would then be the standard output you usually see. The interesting part is the {extractor.url} in the log string.

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

5 participants