seanmturley / natureddit

A simple Reddit client, featuring a landing page dedicated to nature with posts pulled from a curated list of subreddits.
0 stars 1 forks source link

Implement sorting of posts from multiple sources #160

Open seanmturley opened 6 months ago

seanmturley commented 6 months ago

Description

As of the completion of #159, the homepage is pulling 25 posts from 3 subreddits, and presenting the cards without any additional sorting i.e. each subreddit's posts are grouped together.

Subreddit candidates

See also: r/sfwpornnetwork, which includes a directory of nature related subreddits.

Approach

This may take a little experimentation to get an ideal mix and arrangement of posts from different subreddits. The following should be taken into consideration and executed as appropriate:

Edit: The above features are all enabled, though further modifications to the exact setup may need to be made to tweak which posts are shown and in what order.

Issues

seanmturley commented 6 months ago

I've expanded each query for the homepage to an object accepting the subreddit and a new limit option, allowing the number of posts pulled from each subreddit to be set independently.

In doing this, I noticed a few issues:

Both of the above will be added to the main tasks as issue to fix.

seanmturley commented 6 months ago

Did some work on media (or lack thereof), and on using "hotness" as a way to filter and sort results. This has been incorporated into the task above.

seanmturley commented 6 months ago

Added a utility function to calculate a post's "hotness". This will be used for sorting results.

seanmturley commented 6 months ago

Implemented a new utility function to sort posts by "hotness", then select the "hottest" n posts, with n being specified in the query.

This appears to be working well, but the actual number of posts and individual subreddit limits may need tweaking.

It's worth noting that:

seanmturley commented 6 months ago

I've made a first pass at normalizing hotness based on subreddit size, and deemphasizing the importance of the recency of posting. This may need some tweaking, but I think it will at least allow some posts through from smaller subreddits.

seanmturley commented 6 months ago

Noting that I need to keep an eye on weather new posts from r/beautifultrees ever make it onto the homepage. If they don't, I may want to tweak the "hotness normalization" algorithm.

seanmturley commented 5 months ago

Following up from the previous comment - a post from r/beautifultrees has made it onto the homepage - it's 1 day old and has a score of 11. This took a while because that subreddit has quite low activity.

seanmturley commented 4 months ago

Noting again that occasional posts from r/beautifultrees are making it to the home page.

Overall, the filtering of posts is working pretty well. I think the quality of posts from different subreddits is a bit variable. I could consider increasing the number of posts pulled from e.g. r/EarthPorn (which are consistently good and all always make the home page), while decreasing the amount pulled from subreddits with lower quality (e.g. r/natureporn). This doesn't eliminate the issue, since hotness doesn't correspond directly with image quality, but would increase the prominence of better quality images on average.

seanmturley commented 4 months ago

I've added a few more subreddits from r/sfwpornnetwork to the homepage. Their quality is a bit variable, reinforcing the need for what I discussed earlier - increasing the posts pulled from subreddits with more consistent quality, and limiting the posts pulled from those subreddits where the quality is often poor. This will also have performance benefits, as the total number of posts requested from the API can be reduced - it's currently requesting 10 posts from 10 subreddits = 100 posts total, while only displaying the "hottest" 40.

seanmturley commented 4 months ago

I've adjusted the API call post limits for the homepage such that there are now three different tiers of subreddits:

This provides an additional level of granularity for controlling the quality of posts that get through to the homepage.

The total number of posts requests is slightly reduced from the previous commit to 85, with the "hottest" 45 being displayed. The performance of this is not great - that's probably unavoidable to some extent due to making 10 separate API calls, but could perhaps be alleviated by: