How can i get the normal Url from reddit using python praw

Question:

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)


Asked By: Baiatul Corcoada

||

Answers:

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)
Answered By: pigrammer
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.