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] Different dates (times) for filename and post #6081

Closed
FuwaWata opened this issue Aug 23, 2024 · 2 comments
Closed

[Instagram] Different dates (times) for filename and post #6081

FuwaWata opened this issue Aug 23, 2024 · 2 comments

Comments

@FuwaWata
Copy link

A similar issue was mentioned here: #4600
There's a difference of one or two seconds between the filename datetime gallery-dl outputted and the real datetime from the post.
Based on what I observed, this only happens for SOME posts with more than one photo.

For posts with only one photo or one video:
Example: https://www.instagram.com/p/C-xuZTmtNQR/
Using flag -K, gallery-dl outputted the following dates for directory and filenames.

Keywords for directory names:
-----------------------------
category
  instagram
count
  1
date
  2024-08-17 16:00:11

Keywords for filenames and --filter:
------------------------------------
category
  instagram
count
  1
date
  2024-08-17 16:00:11

The dates for both directory and filenames are the same in this case.

However, for some posts with more than one photo, the dates are different:
Example: https://www.instagram.com/p/C-BJm6VScvU/?img_index=1

Keywords for directory names:
-----------------------------
category
  instagram
count
  10
date
  2024-07-29 19:15:06

Keywords for filenames and --filter:
------------------------------------
category
  instagram
count
  10
date
  2024-07-29 19:15:05

There's a one second difference in this case.
Checking the source code for the post date, it shows the same datetime as the directory date gallery-dl outputted.
Capture

Another example with two seconds difference:
https://www.instagram.com/p/C9koxyoqgQX/?img_index=1

Keywords for directory names:
-----------------------------
category
  instagram
count
  4
date
  2024-07-18 17:29:30

Keywords for filenames and --filter:
------------------------------------
category
  instagram
count
  4
date
  2024-07-18 17:29:28

But there are also cases when gallery-dl outputted same datetimes for posts with more than one photo:
Example: https://www.instagram.com/p/C-nUW1STK1c/?img_index=1

Keywords for directory names:
-----------------------------
category
  instagram
count
  4
date
  2024-08-13 15:00:13

Keywords for filenames and --filter:
------------------------------------
category
  instagram
count
  4
date
  2024-08-13 15:00:13

And so when I use --filename "{date:%Y-%m-%d %H.%M.%S}.{extension}", sometimes gallery-dl output the wrong datetime.
Is there any way I can output the directory date instead of the filename date?

mikf added a commit that referenced this issue Aug 25, 2024
and restore 'date' metadata for GraphQL file results,
which got accidentally removed in a001c9c
@mikf
Copy link
Owner

mikf commented Aug 25, 2024

There's now a post_date metadata field, which is the "directory" / post datetime. Its value is the same for all files in a post. (a364263)

@mikf mikf closed this as completed Aug 25, 2024
@FuwaWata
Copy link
Author

Thank you for the update.
I can now use post_date when downloading instagram posts. However, a key error occurred when I'm downloading story.

It's indicating an error on line 216:
data["date"] = data["post_date"]

It seems that post_date is only added in the regular image/video post code block but not the story or highlight block under the def _parse_post_rest(self, post) function.

I added "post_date": text.parse_timestamp(post.get("taken_at")), in the story code block and I can download successfully again. But I'm not sure if post.get("taken_at") is a valid key for instagram story.

@mikf mikf reopened this Aug 25, 2024
mikf added a commit that referenced this issue Aug 29, 2024
@mikf mikf closed this as completed Aug 29, 2024
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

2 participants