Giter Site home page Giter Site logo

referer-parser.cr's Introduction

referer-parser

An crystal implementation of referer-parser, an library for extracting search marketing data from referer (sic) URL.

This one is huge inspired and borrowed code from the ruby implementation: https://github.com/snowplow-referer-parser/ruby-referer-parser

This one only support YAML for now.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      referer-parser:
        github: confact/referer-parser.cr
  2. Run shards install

Usage

require "referer-parser"

Use parser

create an instance of the parser:

parser = RefererParser::Parser.new

And then you can start parsing the urls like this:

parser.parse("http://www.google.com/search?q=gateway+oracle+cards+denise+linn&hl=en&client=safari")
  # => {
    known: true,
    source: "Google",
    medium: "search",
    uri:
    "http://www.google.com/search?q=gateway+oracle+cards+denise+linn&hl=en&client=safari",
    term: "gateway oracle cards denise linn",
    domain: "google.com"
  }

What is left

We don't support the JSON of the data file snowplow is releasing right now.

Development

shards install

You can then add require on an test file or use the specs for test functionality.

You run the tests like this:

crystal spec

Contributing

  1. Fork it (https://github.com/confact/referer-parser/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

referer-parser.cr's People

Contributors

confact avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.