All Projects → kbravh → tweet-to-markdown

kbravh / tweet-to-markdown

Licence: MIT license
A command line tool to convert Tweets to Markdown.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to tweet-to-markdown

JustTweet
Simple tweet button for Google Chrome
Stars: ✭ 20 (-81.98%)
Mutual labels:  tweet
PKMigrator
Tools to migrate between various Personal Knowledge Management Utilities
Stars: ✭ 36 (-67.57%)
Mutual labels:  roamresearch
almanacs
A recipe for everything 🗒️
Stars: ✭ 47 (-57.66%)
Mutual labels:  zettelkasten
open-evolution
Open evolution proposals for the Twitter API
Stars: ✭ 41 (-63.06%)
Mutual labels:  twitter-api-v2
notoire
A vim plugin to take notes using the Zettelkasten method
Stars: ✭ 53 (-52.25%)
Mutual labels:  zettelkasten
harika
Offline-, mobile-first graph note-taking app focused on performance with the knowledgebase of any scale
Stars: ✭ 111 (+0%)
Mutual labels:  roamresearch
stweet
Advanced python library to scrap Twitter (tweets, users) from unofficial API
Stars: ✭ 287 (+158.56%)
Mutual labels:  tweet
zk.nvim
Neovim plugin as a lightweight wrapper around https://github.com/mickael-menu/zk
Stars: ✭ 24 (-78.38%)
Mutual labels:  zettelkasten
osmosnote
The knowledge IDE
Stars: ✭ 69 (-37.84%)
Mutual labels:  zettelkasten
awesome-zettelkasten
A list of awesome Zettelkasten resources.
Stars: ✭ 57 (-48.65%)
Mutual labels:  zettelkasten
obsidian-publish-mkdocs
A Template to Publish Obsidian/Foam Notes on Github Pages (uses MkDocs)
Stars: ✭ 219 (+97.3%)
Mutual labels:  foam
screenshot-tweet
Screenshot a tweet.
Stars: ✭ 66 (-40.54%)
Mutual labels:  tweet
loseyourself
Lose yourself, programmer edition. Based on a tweet by @kvlly!
Stars: ✭ 34 (-69.37%)
Mutual labels:  tweet
react-fake-tweet
React renderer for tweets.
Stars: ✭ 33 (-70.27%)
Mutual labels:  tweet
org-roam-ui
A graphical frontend for exploring your org-roam Zettelkasten
Stars: ✭ 1,393 (+1154.95%)
Mutual labels:  zettelkasten
hugo-documentation-theme
📖 Project Docs / Knowledge Base template for Hugo Website Builder. 创建项目文档
Stars: ✭ 101 (-9.01%)
Mutual labels:  zettelkasten
The-Archive-Themes
The Archive userland for app themes
Stars: ✭ 40 (-63.96%)
Mutual labels:  zettelkasten
dual-obsidian-client
A skilled virtual assistant for Obsidian.
Stars: ✭ 217 (+95.5%)
Mutual labels:  zettelkasten
hyperdraft
Turn your notes into a website.
Stars: ✭ 59 (-46.85%)
Mutual labels:  zettelkasten
foamy-nextjs
Basic Foam + NextJS with MDX starter for building a digital garden
Stars: ✭ 58 (-47.75%)
Mutual labels:  foam

Stargazers Issues MIT License


Logo

Tweet to Markdown

A command line tool to quickly save tweets as Markdown.

Report a Bug · Request a Feature

About The Project

This command line tool allows you to quickly save a tweet in Markdown format. This is great for Zettelkasten note-taking or any other commonplace notebook, vade mecum, Obsidian, Roam, Foam, &c. It is built on the new Twitter v2 API.

Demo of ttm in the command line

Installing

You'll need to have Node.js of at least v10.x to use this tool.

You can install this CLI tool by running

yarn global add tweet-to-markdown

or

npm install --global tweet-to-markdown

You can also run it without installing:

npx tweet-to-markdown

Setup

To use this tool, you have two options:

  • Sign up for a free API key from https://ttm.kbravh.dev (new in v2.0.0)
  • Sign up for a bearer token through the Twitter Developer dashboard

Getting a free API key from https://ttm.kbravh.dev is the easiest method of using this plugin, as you won't have to go through Twitter's developer application process. Their application is tedious, and they don't always approve requests. However, you are more than welcome to follow the guide below to retrieve your own bearer token from Twitter. This will give you the most control, freedom, and security over your usage.

Free TTM API key

You can sign up for a free API key at https://ttm.kbravh.dev by signing in with either your GitHub or Twitter account and heading to your account page. Once you sign in and retrieve your API key from your account page, either store it in the environment variable TTM_API_KEY or pass it to the command line tool with the -b (--bearer) flag with each call.

Twitter Developer bearer token

To get a bearer token from Twitter, you'll need to set up an application on the Twitter developer dashboard. For a guide on doing so, see Getting a bearer token. Once you have the bearer token, either store it in the environment variable TWITTER_BEARER_TOKEN or pass it to the command line tool with the -b (--bearer) flag with each call.

Usage

Grabbing a tweet is as easy as calling the ttm command and passing in the tweet URL.

ttm -b "<bearer token>" https://twitter.com/JoshWComeau/status/1213870628895428611
# Tweet saved as JoshWComeau - 1213870628895428611.md

Nota bene: If passing your bearer token as an argument instead of an environment variable, wrap your bearer token or API key in quotes to prevent any special symbols from being misinterpreted by the command line. Also, if using a TTM API key, be sure to include the entire key, from the TTM at the beginning all the way to the end with the alphanumeric characters (e.g. "TTM>asdf1123" or "TTM_ghjk4567").

The tweet will be saved to a Markdown file in the current directory. Here's how the tweet will look:

Screenshot of the rendered Markdown file

Any attached images, polls, and links will also be linked and displayed in the file.

Options

There are many options to customize how this tool works. It is highly recommended to find the options you need and set up an alias in your terminal.

For example on Mac or Linux, you can define an alias with your options like so:

alias ttm="ttm -p $HOME/notes --assets --quoted"

For Windows, have a look at DOSKEY.

Copy to Clipboard

What if you want to just copy the Markdown to the clipboard instead of saving to a file? Just pass the -c (--clipboard) flag.

ttm -c https://twitter.com/JoshWComeau/status/1213870628895428611
#Tweet copied to the clipboard.

Quoted tweets

If you would like to include quoted tweets, pass the -q (--quoted) flag. This is disabled by default because a separate request has to be made to fetch the quoted tweet.

ttm <tweet url> -q

Tweet threads

To capture an entire tweet thread, use the -t (--thread) flag and pass the URL of the last tweet in the thread.

Nota bene: this will make a separate network request for each tweet.

ttm <last tweet url> -t

Condensed threads

Instead of showing complete, individual tweets with profile picture, date, etc. when downloading a thread, this option will show the header once and then only show the tweet bodies, representing tweet threads as a cohesive body of text. A header will be shown if a different author appears in the thread, for example if you're downloading a conversation between various authors.

ttm <last tweet url> -T

Custom File Name

In order to save the tweet with a custom filename, pass the desired name to the --filename flag. You can use the variables [[name]], [[handle]], [[text]], and [[id]] in your filename, which will be replaced according to the following chart. The file extension .md will also be added automatically.

Variable Replacement
[[handle]] The user's handle (the part that follows the @ symbol)
[[name]] The user's name
[[id]] The unique ID assigned to the tweet
[[text]] The entire text of the tweet (truncated to fit OS filename length restrictions)
ttm <tweet url> --filename "[[handle]] - Favicon versioning".
# Tweet saved to JoshWComeau - Favicon versioning.md

If the file already exists, an error will be thrown unless you pass the -f (--force) flag to overwrite the file.

Custom File Path

To save the tweet to a place other than the current directory, pass the location to the -p (--path) flag. If this path doesn't exist, it will be recursively created.

ttm <tweet url> -p "./tweets/"
# Tweet saved to ./tweets/JoshWComeau - 1213870628895428611.md

Tweet Metrics

If you'd also like to record the number of likes, retweets, and replies the tweet has, pass the -m (--metrics) flag. This will save those numbers in the frontmatter of the file.

ttm <tweet url> -m
---
author: Josh ✨
handle: @JoshWComeau
likes: 993
retweets: 163
replies: 24
---

Save Images Locally

Want to really capture the entire tweet locally? You can pass the -a (--assets) flag to download all the tweet images as well, instead of just linking to the images on the web. If the tweet is ever deleted or Twitter is unavailable, you'll still have your note.

ttm <tweet url> -a

Tweet images will be automatically saved to ./tweet-assets. If you'd like to save the assets to a custom directory, use the --assets-path flag and pass in the directory.

ttm <tweet url> -a --assets-path "./images"

Nota bene: Unfortunately, there is currently not a way to save gifs or videos from tweets using the v2 API.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch ( git checkout -b feature )
  3. Commit your Changes ( git commit -m "Add a cool feature" )
  4. Push to the Branch ( git push origin feature )
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details

Contact

Karey Higuera - @kbravh - [email protected]

Project Link: https://github.com/kbravh/tweet-to-markdown

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].