34 lines
804 B
Markdown
34 lines
804 B
Markdown
# Reddit Source
|
|
|
|
Reddit is used as a social sentiment input for selected geopolitical and market subreddits.
|
|
|
|
## Configuration
|
|
|
|
Create a Reddit script app at:
|
|
|
|
```text
|
|
https://www.reddit.com/prefs/apps/
|
|
```
|
|
|
|
Then set:
|
|
|
|
```env
|
|
REDDIT_CLIENT_ID=
|
|
REDDIT_CLIENT_SECRET=
|
|
```
|
|
|
|
## Runtime Behavior
|
|
|
|
- The source uses the OAuth client credentials flow and then reads `https://oauth.reddit.com`.
|
|
- Unauthenticated `reddit.com/.../hot.json` scraping is intentionally disabled.
|
|
- Missing credentials return `status: no_credentials` and are surfaced as source degradation.
|
|
- OAuth failures return `status: auth_failed` without logging or returning the client secret.
|
|
- Subreddit fetch failures return `status: degraded` with per-subreddit errors.
|
|
|
|
## Test
|
|
|
|
```bash
|
|
node apis/sources/reddit.mjs
|
|
npm run test:unit
|
|
```
|