Skip to content

Automatically Download Saved Reddit Posts & Comments as Markdown Notes (into Obsidian)

License

Notifications You must be signed in to change notification settings

erohtar/redditSaver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redditSaver

Automatically Download Saved Reddit Posts & Comments as Markdown Notes (into Obsidian)

Sample output: image

Features

  • YAML Frontmatter is downloaded along with the markdown formatted note - supports using it with Dataview plugin (see below)
  • Notes are saved in reddit\<subreddit>\<note_title> hierarchy
  • Clickable link to the post/comment is added at the top of the note (besides being saved in Frontmatter)

Setup

  1. Go to this url and copy this link: image

  2. Copy settings.sample.json to settings.json and udpate these values:

    • jsonUrl : Put above copied link
    • rootPath : Your notes target path (use double forward slashes)
    • overWrite : If you wish to overwrite your existing note files with latest downloads, set this to 1
{
	"jsonUrl": "https://www.reddit.com/user/erohtar/saved.json?feed=xxxxxxxxx&user=erohtar",
	"rootPath": "C:\\ObsidianVault\\Reddit",
	"overWrite": 0
}
  1. Download (optionally portable) node.js and run redditSaver.js with it: <path>\node\node.exe redditSaver.js

  2. Done. Your notes should be created at the set path: <vault>\Reddit\<subreddit>\<title>__<id>.md

Dataview Example

image

Create a new note named redditSaver at the root of your Obsidian vault, and put this code there to get a nice table view of all your saved posts/comments:

```dataview
TABLE WITHOUT ID "[" + title + "](" + file.path + ")" AS "Title", type AS "Type", sub AS "r/"
FROM "Reddit"
SORT file.ctime DESC
```

Additional Notes

  • Reddit limits last 25 saved posts/comments in that feed
  • Scheduled running of this script once daily (or so) will keep your latest saves updated automatically
  • This is NOT an Obsidian plugin, and if someone wants to create one based on this idea or my code, they're more than welcome to
  • To save a reddit crosspost, go to the target post and save that instead of the link post (a habit I'll have to get into myself as well)