twitch-dl icon indicating copy to clipboard operation
twitch-dl copied to clipboard

Return output as well instead of only printing

Open FunnyPocketBook opened this issue 2 years ago • 2 comments

It would be nice if the data that's printed (especially when using the json flag) would be returned by the function instead of only printing it It would make it easier to use the printed data without having to tap into stdout to retrieve the data

FunnyPocketBook avatar Apr 19 '22 16:04 FunnyPocketBook

Sorry for sitting on this for such a long time.

I'm confused why you need info to return the data. You can instead write a couple of lines of code which have the same result:

from twitchdl import twitch

video_id = "1657460453"
video = twitch.get_video(video_id)
access_token = twitch.get_access_token(video_id)
playlists = twitch.get_playlists(video_id, access_token)

I'm hesitant to merge the PR because I would prefer that the functions which implement console commands don't return any value.

ihabunek avatar Nov 20 '22 14:11 ihabunek

No worries for taking your time!

You are right, it's not needed at all and your reason to not merge the PR is totally understandable. I figured it would just be a QoL improvement if the same function could be used to return the data, as for now it wouldn't change or break anything for the CLI application (although it might in the future)

FunnyPocketBook avatar Nov 20 '22 15:11 FunnyPocketBook