Medium from your command line!
$ npm install -g medium-cli
There are four commands:
medium publish, and
$ medium create buzzfeedmedium · Successfully created your blog!
This command creates a new sub directory in your current directory, with two example articles. The directory looks like this:
.├── articles| ├── 12-classic-love-scenes-improved-by-a-chipotle-burrito| | └── index.md| └── 51-corgi-gifs-that-will-change-your-life| └── index.md└── .gitignore
index.md files are the blog posts. More on this later.
$ medium loginmedium · Please open in your browser.· At the bottom of the page, under `Integration Tokens`, copy· this description:· "Medium-CLI basic publishing access."· Then generate the new token and copy it.Paste your Integration Token here: XXXX· Authenticating into Medium..· Saved!
This command asks you for your Integration Token (which can be retrieved at the bottom of this page). It also auths into Medium to get your user information. Lastly, it saves the token, your
userId, and your URL to your ~/.netrc file.
$ medium publish
This command iterates through your
index.md files in
./articles and publishes the ones that don't have
published: true in the front matter to your Medium account.
Here is an example of an
---title: 12 Classic Love Scenes Improved By A Chipotle Burritotags: burrito, gifs, lovecanonicalUrl: www.buzzfeed.com/kincairm/12-classic-love-scenes-improved-by-a-chipotle-burr-a4wp#.iab3N1w76publishStatus: draftlicense: all-rights-reserved---# 1. Titanic (1997)# 2. The Notebook (2004)# 3. Dirty Dancing (1987)
title is the only field that is required in the front matter, with all the other ones optional. For a list of the accepted possible parameters, see Medium's API documentation here.
content are not required in the front matter, as they are both added later by the
medium publish command.
For each successful post, the
medium publish command also adds
published: true to the front matter.
$ medium open
This directs your browser to your Medium page. You need to have
medium login first to set your Medium URL.
WWWWWW||WWWWWWW W W||W W W||( OO )__________/ | \/o o| MIT \\___/||_||__||_|| *|| || || ||_||_|| _||_||(__|__|(__|__|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.