29

Moving Medium's bookmarks to Trello using JavaScript

 5 years ago
source link: https://www.tuicool.com/articles/hit/yQfeIzN
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Moving your Medium's Bookmarks to Trello

I firmly believe that our time should be spent on important things.

The time you spent searching for an article could be time spent on reading that article.

Quick Demo

realDemo.gif

Getting started

  • cp .env.example .env

  • npm i

You might have to update the .env file from time to time, because cookies have limited lifetime.

Features

conventions : field = list name; keyword = filter key

  • fetch saved posts from Medium and transfer them to Trello and also remove them from bookmark list
  • the keywords for a field can also include regular expressions
    add-regex-key.gif
  • add keyword to a field

    Syntax: $field_name $filter_key1 | $filter_key2

    Example: react react hooks | \bstyled components\b

    add-key.gif
  • create field and add keywords to it

    Syntax: create!$field_name $filter_key1 | $filter_key2

    Example: create!posts development posts

    create-and-add-key.gif
  • You can see where each card will be placed by having a look at info.log file after getting the message All good? (y/n)
  • the show_list command will print the existing lists to the info.log file
  • create a Trello list if the list name exists in config.json , but not in Trello
  • add link to a list(which doesn't have to exist) without applying any filters. Read More

    Syntax: temp!$list_name

    Example: temp!react

    add-temp.gif

Setting up Trello

Getting the idBoard & token & cookie
  • Create a new card
  • Open the dev tools and open the Network tab
  • Clear the Network tab.
  • Create a new list(doesn't matter the name)
  • Click on the lists request
  • Click on the Headers tab
  • Head over to Request Payload
  • Select the idBoard and paste it in the .env file
  • Select the token and paste it in the .env file next to tokenTrello
  • Select the cookie (located in the Request Headers) and paste it in the .env file next to cookieTrello

Companion Gif

trello.gif

Getting the trello-specific url (needed when adding a new list to a board)
  • Copy the short link from the url ( https://trello.com/b/COPY_THIS_ONE/board_name )
  • Head over the urlTrello property
  • in the .env file replace the YOUR_BOARD_ID with the short link
  • You may now delete the list you have created earlier

Companion Gif

trelloURL.gif

Setting up Medium

Getting the cookie & token

  • Go to your bookmarks
  • Open the dev tools and go to the Network tab
  • Refresh the page and scroll down until a new request is made (bookmarks?limit=20...)
  • Select the Headers tab
  • Copy the cookie located in the Request Headers and paste it in the .env file
  • Coy the x-xsrf-token located in the Request Headers and paste it in the .env file

Companion Gif

medium.gif

Usage

In your current directory: node main.js

Contributing

There are always improvements that could be made. All I ask is that you open an issue and we discuss your proposed changes before you create a pull request.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK