destreamer icon indicating copy to clipboard operation
destreamer copied to clipboard

Download videos with only a certain date creation property

Open FraH90 opened this issue 3 years ago • 4 comments

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 :)

FraH90 avatar Mar 04 '21 11:03 FraH90

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.

FraH90 avatar Mar 04 '21 11:03 FraH90

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?

lukaarma avatar Mar 04 '21 11:03 lukaarma

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

FraH90 avatar Mar 04 '21 12:03 FraH90

@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.

snobu avatar Mar 04 '21 13:03 snobu