15 Home
teddit edited this page 2023-08-23 19:38:57 +00:00

teddit wiki

DMCA templates

Look examples from Invidious and nitter:

Teddit API

You can get JSON or RSS feed for different endpoints by adding a query parameter api to the URL. Add type parameter with value rss and it will return RSS instead of JSON. See below for examples.

Examples

Subreddits

Return JSON for the teddit frontpage:

https://teddit.net/?api

Return RSS for teddit frontpage:

https://teddit.net/?api&type=rss

Return JSON for the /r/privacy

https://teddit.net/r/privacy?api

Return RSS for the /r/privacy

https://teddit.net/r/privacy?api&type=rss

Users

Return JSON for the user dEBRUYNE_1.

https://teddit.net/u/dEBRUYNE_1?api

Return JSON for the user fluffyponyza, sorted as top feed from past year. https://teddit.net/u/fluffyponyza?sort=top&t=year&api

Posts

Return JSON for a post.

https://teddit.net/r/Monero/comments/ue2wt2/at_a_bitcoin_conference_most_people_preferred_a/?api

Search inside a subreddit

Return JSON for a search result inside a subreddit.

https://teddit.net/r/privacy/search?q=monero&restrict_sr=on&nsfw=on&api

API flags

Teddit API has some URL query parameter flags which you can use:

full_thumbs

Get full size post images in the subreddit a query parameter full_thumbs. For example: https://teddit.net/r/NatureIsFuckingLit/?api&type=rss&full_thumbs

target=reddit

Get the same JSON response what you get from the official Reddit API. For example:

https://teddit.net/?api&target=reddit

raw_json=1

Get the raw JSON response (disables the encoding of <, >, and &). For example: https://teddit.net/r/LifeProTips?api&raw_json=1

mode=light

Empties the selftext_html key, making the JSON/RSS significantly smaller.

Self-hosting

Redis

After successfully setuping your instance, it's a good idea to add maxmemory and maxmemory-policy configs to your redis.conf. For example:

Edit redis.conf file and set maxmemory value suitable for your server (e.g. 75% of your total RAM):

# nano /etc/redis/redis.conf

Add this to the end of the file:

maxmemory 2gb

Also add maxmemory-policy:

maxmemory-policy allkeys-lru

Save and exit.

Restart redis:

# systemctl restart redis

OAuth vs non-OAuth

In the config file config.js you can set the use_reddit_oauth key to true or false. If the key is set to true, teddit will use Reddit's API with OAuth (Reddit APP id reddit_app_id is needed in the config file). If it's set to false, teddit will use Reddit's API without OAuth (no Reddit APP id needed). Note: If you don't use Reddit OAuth, you might experience unexpected errors (rate limiting). The key is set to false by default.