My problem is that reddit gives my a a coded url instead of the normal one. The problem I am trying to solve is that i need to get the normal url from the certain reddit post, not the one my code gives me.
import praw
reddit = praw.Reddit(
client_id="",
client_secret="",
password="",
user_agent="",
username="",
)
subreddit = reddit.subreddit("perfectlycutscreams")
for submission in subreddit.hot(limit=10):
print(submission.url)
CodePudding user response:
Use the permalink attribute, and add https://reddit.com
to the front:
import praw
REDDIT_URL = "https://reddit.com"
reddit = praw.Reddit(
client_id="",
client_secret="",
password="",
user_agent="",
username="",
)
subreddit = reddit.subreddit("perfectlycutscreams")
for submission in subreddit.hot(limit=10):
print(REDDIT_URL submission.permalink)