2.1.0 • Published 3 years ago
reddit-grabber v2.1.0
reddit-grabber, a simple tool to get images and videos from Reddit
import { get } from 'reddit-grabber'
async function (
type: 'Image' | 'Video',
subreddit: string,
isOver18?: boolean
) {
return await get(type, subreddit, isOver18).catch((e) => {
console.error(
`An error has occured, it's probably because the grabber can't find anything. ${e.message}`
)
})
}
// the catch here, is because the grabber will error if it can't find a post
import { validMedia } from 'reddit-grabber'
validMedia.ImageExtensions.push('png')
validMedia.VideoExtensions.push('mp4')
validMedia.VideoUrls.push('youtu.be')
Don't add any dots to extensions, and don't add http/https to urls.
Got any issues? Be sure to report them on GitHub/Issues!