yt-dlp / yt-dlp

A feature-rich command-line audio/video downloader
https://discord.gg/H5MNcFW63r
The Unlicense
76.39k stars 6.01k forks source link

[Feature Request] Add expiry date to applicable extractors' metadata #615

Open BobVarioa opened 2 years ago

BobVarioa commented 2 years ago

Checklist

Description

When certain extractors download the metadata of a video, they sometimes provide a url that will expire in a certain amount of time. For example, the links the youtube extractor provides expire after 6-ish hours (21598 ± 1 seconds, if the video link's "expire" parameter is accurate) and unless you parse the output url then it is impossible to gauge when this would occur. All I would like to see is, when applicable, a simple unix timestamp on when a videos link would expire provided when you extract the metadata of a video.

Ex.

{
  "title": "Example Video",
  "url": "https://example.com/v?id=12345&expires=1627919375",
  // The new feature 
  "expiry_date": 1627919375,
  "formats": [
    // ...
    {
      // ...
      "url": "https://example.com/v?id=12345&expires=1627919375",
      // The new feature 
      "expiry_date": 1627919375,
    }
  ]
}
pukkandan commented 2 years ago

This will need to be implemented in each extractor separately. Other than youtube, do you know of any other sites that could benefit from this?

BobVarioa commented 2 years ago

I don't know of any in particular, but I imagine that a good majority of the bigger sites that are supported have this, as it is a common practice in general. Through, a small script to test for common url parameters (like expiry, expires, etc.) in the downloaded urls from the already present tests, should give us a better idea on exactly how many.

garret1317 commented 7 months ago

i would also like this, but in a slightly different way some sites, particularly broadcasters, only stream their stuff for a limited period of time, then it's gone forever i think it could be quite useful to know when something's going to expire (and if the info's there, why not extract it tbh)

release_timestamp for when it's made available, expiry_timestamp for when it's taken away :+1:

pukkandan commented 7 months ago

release_timestamp for when it's made available, expiry_timestamp for when it's taken away 👍

Reasonable request, but not the same as OP's. They want to know when the download url expires, not when the content expires. Combining these into the same field does not sound like a good idea.

garret1317 commented 7 months ago

yes, fair enough maybe OP's request could go in for each format, since it's about the specific stream, and mine could go in the main infodict, since it's about the content as a whole should i open a new issue for my request?