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] Allow Sidecar posts taken_at to populate date #2660

Closed
bradenhilton opened this issue Jun 5, 2022 · 0 comments
Closed

[Instagram] Allow Sidecar posts taken_at to populate date #2660

bradenhilton opened this issue Jun 5, 2022 · 0 comments

Comments

@bradenhilton
Copy link
Contributor

bradenhilton commented Jun 5, 2022

Recently I noticed that Sidecar post images weren't sorting by mtime in a way I'd expect. Evidently it's because they do not return a date value in their metadata:

gallery-dl --cookies <cookies.txt> -j -- "https://www.instagram.com/p/BoHk1haB5tM/"
[
  ...
  [
    3,
    "https://scontent-lcy1-1.cdninstagram.com/v/t51.2885-15/40758827_2138611023072230_4073975203662780931_n.jpg?stp=dst-jpg_e35&_nc_ht=scontent-lcy1-1.cdninstagram.com&_nc_cat=102&_nc_ohc=XGO4XoxbCekAX_UqD53&edm=ALQROFkBAAAA&ccb=7-5&ig_cache_key=MTg3NTYyODgzNzQxNTI3MDM0NQ%3D%3D.2-ccb7-5&oh=00_AT_PAS7ojN9bi5FJY677ochh-llalkMjr_OtGnrogyukCw&oe=62A30A48&_nc_sid=30a2ef",
    {
      ...
      "date": null,
      ...
    }
  ],
  ...
]

I believe this line of code

destroys all of the metadata that media gets from post["media"], including post["media"]["taken_at"].

If I change

"date" : text.parse_timestamp(item.get("taken_at") or
media.get("taken_at")),

to

 "date"       : text.parse_timestamp(item.get("taken_at") or
-                                    media.get("taken_at")),
+                                    media.get("taken_at") or
+                                    post.get("media", {}).get("taken_at")), 

the date metadata is returned successfully:

gallery-dl --cookies <cookies.txt> -j -- "https://www.instagram.com/p/BoHk1haB5tM/"
[
  ...
  [
    3,
    "https://scontent-lcy1-1.cdninstagram.com/v/t51.2885-15/40758827_2138611023072230_4073975203662780931_n.jpg?stp=dst-jpg_e35&_nc_ht=scontent-lcy1-1.cdninstagram.com&_nc_cat=102&_nc_ohc=XGO4XoxbCekAX_UqD53&edm=ALQROFkBAAAA&ccb=7-5&ig_cache_key=MTg3NTYyODgzNzQxNTI3MDM0NQ%3D%3D.2-ccb7-5&oh=00_AT_PAS7ojN9bi5FJY677ochh-llalkMjr_OtGnrogyukCw&oe=62A30A48&_nc_sid=30a2ef",
    {
      ...
      "date": "2018-09-24 18:08:34",
      ...
    }
  ],
  ...
]

Put simply, I'd like to be able to use post["media"]["taken_at"] to populate date metadata on each file.

Note: This isn't a PR as it's not particularly elegant and I'm unsure if it contains any breaking changes. If it does, perhaps this could be achieved with an option/config entry?

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