pocket-tagger
Auto-tag articles in your Pocket account based on a list of rules
Last updated 3 years ago by mheap .
Original npm · Tarball · package.json
$ cnpm install pocket-tagger 
SYNC missed versions from official npm registry.

pocket-tagger

A small node.js library for automatically tagging Pocket articles based on regular expressions

Build Status

pocket-tagger requires a minimum NodeJS version of 7.6

Usage

Make sure that you have a ~/.pocket/credentials file that looks something like this:

[default]
consumer_key = "12345-abc123fniewof2023f"
access_token = "fwefi20r-232d-f2o2-2kd3"

You can use pocket-auth-cli to fetch your credentials if needed. Then, create a file with the following contents and run it (feel free to change the regex/rules used):

const PocketTagger = require("pocket-tagger");

(async function main(){
    const tagger = await PocketTagger(
        "default",
        {
            // Length related
            'length-too-short': '^[\\s\\S]{0,5}$',
            'length-short': '^[\\s\\S]{6,1500}$',
            'length-medium': '^[\\s\\S]{1501,5000}$',
            'length-long': '^[\\s\\S]{5001,15000}$',
            'length-essay': '^[\\s\\S]{15001,100000}$',
            'length-too-long': '^[\\s\\S]{100001,}$',

            // Code related
            'code-php': 'php',
            'code-javascript': 'javascript',
            'code-node': '(node\\.js|nodejs)',
            'code-golang': 'golang',

            // Talk related
            'slideshare-url': '^https://www.slideshare.net',
            'speakerdeck-url': '^https://www.speakerdeck.com',
            'slideshare-embed': 'https://www.slideshare.net/slideshow/embed_code',
            'speakerdeck-embed': 'speakerdeck-embed',

            // Urls
            'hacker-news': 'ycombinator',
        },
        {
            url: {
                "hacker-news": ["hacker-news"],
                "has-slides": ["slideshare-url", "speakerdeck-url"],
            },
            content: {
                "length-error": ["length-too-short","length-too-long"],
                "length-short": ["length-short"],
                "length-medium": ["length-medium"],
                "length-long": ["length-long"],
                "length-essay": ["length-essay"],
            },
            html: {
                "code-php": ["code-php"],
                "code-javascript": ["code-javascript"],
                "code-node": ["code-node"],
                "code-golang": ["code-golang"],
            }
        }
    );

    try {
        await tagger.run();
    } catch(e){
        console.log(e);
    }
})();

Current Tags

  • 0.0.3                                ...           latest (3 years ago)

3 Versions

  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 1
Last Month 1
Dependencies (3)
Dev Dependencies (9)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |