Giter Club home page Giter Club logo

ved_decoder's Introduction

VedDecoder

VedDecoder is a decoder for the Google ved parameter.

Links to ved's explanations:

Installation

Add this line to your application's Gemfile:

gem 'ved_decoder'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install ved_decoder

Usage

# Decode ved starts with '1'
v = VedDecoder.decode('1t:22,r:6,i:86,s:90')
# => <VedDecoder::Ved: index: 86, type: 22, result_position: 6, start_page: 90>

# Decode ved starts with '0' or '2'
v = VedDecoder.decode('2ahUKEwjZ5rDNt67pAhVDLKwKHS4wDD4QzLECKAEwSnoECBYQCg')
# => <VedDecoder::Ved: type: 39116, sub_result_position: 1, result_position: 74>

# Get values
v.to_h
# => {:type=>39116, :sub_result_position=>1, :result_position=>74}
v.type
# => 39116
v.result_position
# => 74

License

The gem is available as open source under the terms of the MIT License.

ved_decoder's People

Contributors

zyc9012 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ved_decoder's Issues

Add a mapping of `decoded ved type -> serp feature type`

Thank you for the ved_decoder!

It'd be nice to have a mapping of decoded ved -> serp feature type. Wdyt about VedDecode#decoded_serp_feature?

VED_TYPES_TO_SERP_FEATURES = {
  22: :organic_results,
  39116: :organic_result_questions,
  # ...
}

# lib/ved_decoder.rb
module VedDecode
  # ...

  def decoded_serp_feature
    VED_TYPES_TO_SERP_FEATURES[type]
  end
end

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.