How to get data from Reddit with Python | Praw Tutorial + Meme Command in a Discord Bot

preview_player
Показать описание
In this video, we will learn how to get data from Reddit using python for a Discord bot. We will make the meme command in this video.

If you have any suggestions for future videos, leave it in the comments below.

Some Useful Links -

Queries solved in the video:
1) How to use Reddit with Python
2) How to make a meme command with reddit
3) How to get data from Reddit | Praw Tutorial
#reddit #discord #praw
Рекомендации по теме
Комментарии
Автор

Whats the url u typed in about url and redirect one?

HerschelleT
Автор

for everyone wondering, you need import random somewhere otherwise random.choice won't work

datboygamer
Автор

Just a tip:

you can use

hot = subreddit.hot(limit=50)

instead of

top = subreddit.top(limit=50)

So that it chooses the most trending posts from that subreddit. The problem with using subreddit.top is that it automatically chooses the top posts of all time (includes old and outdated posts and etc), so the submissions might reappear over and over again and become redundant. I'm not sure if you can set a specific date though, like "today" or "this week".

TheRealth
Автор

For people that gets the message to use asynchronous message, do this: reddit = praw.Reddit(client_id = "", client_secret = "", username = "", password = "", user_agent = "", check_for_async=False)

elcampanas
Автор

do u have a git hub post with the details and code?

xdshadow_
Автор

Thank you!
But is there faster way to do this? It takes a little bit of time before it posts the meme. Maybe a way to grab the newest post on r/memes every time you run the command if that's even possible

RafaelBYT
Автор

Hey any idea on how I can only get files with jpg, jpeg or PNG format?

Ricky-hcdk
Автор

Eh, praw isn't suited for discord.py. Always use an async wrapper for any module for discord.py else this would do something called "blocking" where all the tasks except the fetching of the content runs.

rdius
Автор

Thanks a lot for this video it worked for me i finally managed to do it its damn good can u make a video on how to show upvotes as well

hussainhaidary
Автор

KeyError: 'timeout'
can anyone help me out on this I have entered everything correctly still I am not able to fetch the details

mjgamer
Автор

Are you able to get data from 2 different subreddits at the same time?

byeJohnn
Автор

hi! i don't know if you ca help me, but I keep getting the error File "main.py", line 22
subreddit = reddit.subreddit('memes')
^
IndentationError: expected an indented block


(line 22 says subreddit = reddit.subreddit('memes'))

jaymassa
Автор

im getting this error pls help

'Client' object has no attribute 'command'

shasvat
Автор

when i run the command the image only shows for posts that have one image, if its a hot post with a few images, eg a comic or something it doesnt work. only the title is show in the embed, how can i fix this? (make it skip multiple image posts preferably but anything would be helpful)

christopherobin
Автор

just wondering will this also be able to get and send videos from reddit? not those videos from other links but videos posted from local files

SMILE__
Автор

very cool but help pls im using repl.it to code my bot and it says 'it appears that you are using PRAW in an asynchronous invironment' what can i do, and it doesnt send me a meme : (

hihey
Автор

how do i fix this error
File line 394, in <module>
all_subs.append(submission)
NameError: name 'all_subs' is not defined

BladeStreama
Автор

How do you do this in cogs? Great video btw!

stxkz
Автор

how would i make it only upload memes so if someone typed a different subreddit they would get posts with the tag "meme"

robylplays
Автор

It works just about flawlessly, but I can only execute the command once, anyone else having this problem? It throws this error: Command raised an exception: IndexError: Cannot choose from an empty sequence

NatteLatteMusic
welcome to shbcf.ru