Super simple PHP class that downloads videos hosted on v.redd.it as well as getting the post details such as thumbnail, video dimensions, duration, posted date, title, user and subreddit.
The Reddit post URL is used as the input (see example below).
Note you will need FFmpeg installed on your web server for this to work.
Make sure the class is included with:
require_once('rdt-video.php');
Call the RDTvideo class with the Reddit post url that you want to download the video from:
$call = new RDTvideo();
$call->getVideoLink('https://www.reddit.com/r/funny/comments/d8qo81/baby_crocodiles_sound_like_theyre_shooting_laser/');
echo $call->download('thevideo');//Saves as thevideo.mp4
If FFmpeg is on system it will save the video as thevideo.mp4
You can also define the preset and crf if you want to compress the video:
echo $call->download('thevideo', 'faster', 23);
The default is fast and 20.
echo $call->videoTitle();
echo $call->videoPostedSub();
echo $call->videoPostedDate();
echo $call->videoPostedby();
echo $call->videoThumb();
$video_details = $call->videoDetails();
$height = $video_details['height'];
$width = $video_details['width'];
$duration = $video_details['duration'];