vvksh / reddit_product_search

0 stars 0 forks source link

reddit api details #2

Open vvksh opened 3 years ago

vvksh commented 3 years ago

here are the object models: https://praw.readthedocs.io/en/latest/code_overview/praw_models.html

vvksh commented 3 years ago

parsing comments

from here: this is the correct way to parse comments:

https://praw.readthedocs.io/en/latest/tutorials/comments.html

submission.comments.replace_more(limit=None)
for comment in submission.comments.list():
    print(comment.body)
vvksh commented 3 years ago

getting subreddit

subreddit = reddit.subreddit("redditdev")

print(subreddit.display_name)  # output: redditdev
print(subreddit.title)         # output: reddit development
print(subreddit.description) 
vvksh commented 3 years ago

submission

for submission in subreddit.hot(limit=10):
    print(submission.title)  # Output: the submission's title
    print(submission.score)  # Output: the submission's score
    print(submission.id)     # Output: the submission's ID
    print(submission.url)