- You must first retrieve the top 100 scoring posts from https://old.reddit.com/top/?sort=top&t=all. You will need to walk through multiple pages, using the
nextbutton. - Save the links in a list of
Postobjects. ThePostobject must contain:- The id of the post.
- The title of the post.
- The exact score of the post.
- The subreddit the post was submitted to.
What are the most popular subreddits in the top 100 posts?
- Find the frequency of all the subreddits in the 100 top posts. Store them in a dictionary where
subreddit=>frequency. - Sort the dictionary by descending value.
- Plot the frequencies on a bar chart, where the
y-axis is the frequency, and thex-axis is the subreddit name.
Search reddit using selenium.
Create a function that can retrieve the top n search results (posts) given a search_term.
def search_reddit(search_term, n):
passremember to use old.reddit.com to aviod SPA.
If you get stuck, you can check out our solution here.