url-tagger
Provide a URL and have it tagged based on a set of regular expressions
Last updated 3 years ago by mheap .
Original npm · Tarball · package.json
$ cnpm install url-tagger 
SYNC missed versions from official npm registry.

url-tagger

Provide a list of URLs, regexes and tags and have the URL returned with associated tags

Build Status

Usage

const tagger = new UrlTagger(
  {
    "is-https": "^https://",
    "is-michael-domain": "michaelheap.com",
    "is-michael-content": "I like to learn and I like to teach"
  },
  {
    url: {
      "michael-url": ["is-michael-domain"],
      "michael-secure-url": [["is-michael-domain", "is-https"]]
    },
    content: {
      "michael-content": ["is-michael-content"]
    }
  }
);

await tagger.run("http://michaelheap.com");
# ["michael-content", "michael-url"];

await tagger.run("https://michaelheap.com");
# ["michael-content", "michael-url", "michael-secure-url"];

HTML Caching

To save you hitting the URLs you're testing too hard, URL Tagger allows you to cache the returned HTML using cacheman.

To use a cache, provide a third parameter when creating a URLTagger instance. The options provided are passed directly through to cacheman.

Here is how to use a file based cache:

const tagger = new UrlTagger(
  regexes,
  rules,
  {
    engine: 'file',
    tmpDir: '/tmp/url-tagger'
  }
);

Current Tags

  • 0.1.1                                ...           latest (3 years ago)

4 Versions

  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           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 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (6)
Dev Dependencies (10)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |