Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

product_spy

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

product_spy

  • 0.0.6
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status

ProductSpy

ProductSpy is made for parsing product URLs, i.e. Amazon-URLs, to get the product keys and creating product URLs based on these keys. This can be used to identify products based on the url or just to clean up product URLs.

Installation

Add this line to your application's Gemfile:

gem 'product_spy'

And then execute:

$ bundle

Or install it yourself as:

$ gem install product_spy

Usage

# Parsing URLs
ProductSpy.parse('https://www.amazon.de/dp/B004O9DF6O') => ['www.amazon.de', ['B004O9DF6O']]

# Building URLs
ProductSpy.build('amazon.de', ['B004O9DF6O']) # => https://www.amazon.de/dp/B004O9DF6O

# defining patterns
ProductSpy.setup do |config|
  config.host 'www.amazon.de', :aliases => ['amazon.de'] do |host|
    # ** Mobile
    # http://www.amazon.de/gp/aw/d/B004O9DF7I/ref=aw_d_var_2nd_sports_img?vs=1
    # http://www.amazon.de/gp/aw/B000K7BELW/ref=aw_imgblk_0?h=356&ie=UTF8&selIdx=0&tag=viddleit-21&w=320
    host.parse /^http[s]{0,1}:\/\/(www\.|)amazon.de\/gp\/aw(\/d|)\/([A-Z0-9]{10})(\/.*|)$/, [3]

    # ** Desktop
    # http://www.amazon.de/Hauck-662984-Hochstuhl-Alpha-natur/dp/B000K7BELW/ref=sr_1_2?s=baby&ie=UTF8&qid=1360979509&sr=1-2
    # http://www.amazon.de/dp/B000K7BELW/
    host.parse /^http[s]{0,1}:\/\/(www\.|)amazon.de(\/.*?|)\/dp\/([A-Z0-9]{10})(\/.*|)$/, [3]

    host.build :default, 'https://www.amazon.de/dp/:1'
    host.build :mobile, 'https://www.amazon.de/gp/aw/d/:1'
  end
end

Supported shops

The following shops are already set up in the gem, but you are able each shop you want to in the configuration of your abblication or you can contribute new shops.

Contributing

  1. Fork it
  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 new Pull Request

FAQs

Package last updated on 10 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc