Skip to content

Download videos hosted on v.redd.it as well as get post & media details

Notifications You must be signed in to change notification settings

cp6/Reddit-video-downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Reddit video downloader

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.

Features and usage

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/');
Download video
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.

Get Post title
echo $call->videoTitle();
Get sub
echo $call->videoPostedSub();
Get date when posted
echo $call->videoPostedDate();
Get user who posted
echo $call->videoPostedby();
Get video thumbnail
echo $call->videoThumb();
Get video dimensions and duration
$video_details = $call->videoDetails();

$height = $video_details['height'];
$width = $video_details['width'];
$duration = $video_details['duration'];

About

Download videos hosted on v.redd.it as well as get post & media details

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages