orakaro / rainbowstream

A smart and nice Twitter client on terminal written in Python.
https://github.com/orakaro/rainbowstream
MIT License
3.54k stars 260 forks source link

Open video #319

Open melroy89 opened 2 years ago

melroy89 commented 2 years ago

Would it not be cool if we introduce a new command: show video 12 or open video 12. Which will show the video in the tweet with [id=12] in your OS's default video player?

Basically allowing you to watch videos, just like what show image does with images!?

I think this should not be too hard to implement.

Regards, Melroy vd Berg

slarrain commented 2 years ago

Indeed, it should not be too hard to implement. The method that implements the show image is here.

this is part of a tweet that has a video:

                    "type": "video",
                    "url": "https://t.co/agzj4I0BGh",
                    "video_info": {
                        "aspect_ratio": [
                            47,
                            26
                        ],
                        "duration_millis": 30093,
                        "variants": [
                            {
                                "content_type": "application/x-mpegURL",
                                "url": "https://video.twimg.com/ext_tw_video/1484906516817788929/pu/pl/wNA8xL_ENVExO-1P.m3u8?tag=12&container=fmp4"
                            },
                            {
                                "bitrate": 832000,
                                "content_type": "video/mp4",
                                "url": "https://video.twimg.com/ext_tw_video/1484906516817788929/pu/vid/752x416/74Psc2G5pmI_fNC7.mp4?tag=12"
                            },
                            {
                                "bitrate": 256000,
                                "content_type": "video/mp4",
                                "url": "https://video.twimg.com/ext_tw_video/1484906516817788929/pu/vid/488x270/SDWfzcP6DQJ9LUDm.mp4?tag=12"
                            }
                        ]
                    }

I think this is the part that should be parsed and made to be played by mpv of the default video player.

melroy89 commented 2 years ago

That would be great. Thanks in advance.