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] Add {num} to file name only if there are multiple media #2741

Closed
the-blank-x opened this issue Jul 9, 2022 · 5 comments
Closed

Comments

@the-blank-x
Copy link
Contributor

I am aware of setting extractor.*.filename to an object to use different file names depending on an expression, but I can't find a way to check if a tweet has multiple media or not. I could do it with Reddit and Imgur though, as Reddit sets num to 0 if there's only one media, and Imgur has image_count (or album["image_count"]), which shows how many images there are. Here's my config file where I do it with Reddit and Imgur and try to with Twitter: gdl-config.json.gz

@Hrxn
Copy link
Contributor

Hrxn commented Jul 10, 2022

Wait...

You can use {num} with Twitter just like with Reddit... how is that not working for you?

@mikf
Copy link
Owner

mikf commented Jul 10, 2022

He wants to use {num} only if a tweet has more than one file, and I don't think that's possible at the moment. With the currently available metadata for Twitter, there is no way to determine the number of files in a Tweet or whether it contains more than one.

I'll probably just add a count field that contains the total number of files in a Tweet, like it is already done for several other sites.

@Hrxn
Copy link
Contributor

Hrxn commented Jul 10, 2022

Sounds like a reasonable improvement, something I think I'd use as well..

Buuuut.. based on his description here:

[..] I could do it with Reddit and Imgur though, as Reddit sets num to 0 if there's only one media, [..]

How's that different for what the Twitter extractor is doing right now? Except that maybe num is 1 instead of 0, if there's only one image file in the post?

@mikf
Copy link
Owner

mikf commented Jul 10, 2022

The difference is that the Twitter extractor always started its enumeration at 1, regardless of the number of files in a Tweet, and changing that now to

  • 0 if it is the only file
  • 1-n if there is more than one file

would cause all sorts of problems for users that have downloaded files with the "old" filenames. Backwards compatibility and all that.

Adding a new field at least doesn't break any existing setup.

@Hrxn
Copy link
Contributor

Hrxn commented Jul 10, 2022

True, that wouldn't break anything..

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

No branches or pull requests

3 participants