destreamer
destreamer copied to clipboard
Download videos with only a certain date creation property
Hi, this is not an issue but a practical need that i have (and also it could be a simple feature to be implemented in destreamer). I need to download from a channel only the videos created in this year, 2021, and not the videos created by precedent years.
I've explored some of the destreamer code (I dont know typescript, but i've managed to understand it a little bit). I've detected this portion of code that might be usefull to my purposes, in destreamer.ts:
https://www.flickr.com/photos/189079799@N02/51002102968/in/dateposted-public/
I want to insert inside the for loop something like :
if ( video.publishDate.year != 2021) { print("Old video, skipping") continue }
PS: I know that I couldn't retrive the year like that, it's just pseudocode, in fact i need to know just how can I retrive the year from the publishDate attribute.
Thanks for the answers :)
PPS: If we could want, we could then implement a new argv in destreamer in the format YYYY.MM.DD that will let you download only the videos with a date creation >= of YYYY.MM.DD, and skip the previous one.
You could try this
if (video.publishDate.split('-')[0] !== '2021') {
logger.info(`Old video, skipping: ${video.outPath} \n`);
continue;
}
here https://github.com/snobu/destreamer/blob/7efa54932f6a52d1f4240009494ad11cbf6555fa/src/destreamer.ts#L145-L147
I'm not sure if it will work and if it does it's a quick and dirty hack...
@snobu thoughts about implementing a 'not before' flag?
You could try this
if (video.publishDate.split('-')[0] !== '2021') { logger.info(`Old video, skipping: ${video.outPath} \n`); continue; }
here https://github.com/snobu/destreamer/blob/7efa54932f6a52d1f4240009494ad11cbf6555fa/src/destreamer.ts#L145-L147
I'm not sure if it will work and if it does it's a quick and dirty hack...
@snobu thoughts about implementing a 'not before' flag?
It works perfectly +_+ Thanks very much!!!
For my personal needs this is enough.. if someone else needs this functionality it would be awesome ot have it as a command line option, a 'not before' flag like you said
@lukaarma First, you are an absolute hero here and all around this repo, there's just no better job resume that what you already have here if you ever need one.
To the point, if we're treating a channel like we do with a group
then we could expose a filter parameter to the CLI that adds an OData condition to this thing here -
https://github.com/snobu/destreamer/blob/f8207f4fd1c62aabdd8f100b39cc7f870d5752f9/src/Utils.ts#L31
publishDate gt 2021-03-03T12:00:00.000Z
Something like that should work. I guess. All speculation here, i don't have a Swagger or anything.