Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
hmv-scraper
Advanced tools
Scraper that searches products on the Canadian HMV online store https://www.hmv.ca.
Scraper that searches products on the Canadian HMV store hmv.ca.
Using npm.
npm install hmv-scraper
new HmvScraper(onProductError)
Optional param onProductError is a function that will be called when a product unexpectedly fail the validation. It takes respectively, the product, an array of AJV Error, and a string that represents the errors.
var HmvScraper = require('hmv-scraper');
var onProductError = function (product, errors, errorsText) {
console.log('Product failed validation: ' + errorsText);
console.log(product);
};
var hmv = new HmvScraper(onProductError);
// or
var HmvScraper = require('hmv-scraper');
var hmv = new HmvScraper();
searchByKeyword(query, callback(error, results))
Search products by keyword.
hmv.searchByKeyword({
query: 'James Bond'
}, function(error, results) {
if (error) {
console.log(error);
} else {
console.log(results);
}
});
searchByArtist(query, callback(error, results))
Search products by artist.
hmv.searchByArtist({
query: 'Céline Dion',
sort: 'Bestselling',
filter: 'All',
page: 3
}, function(error, results) {
if (error) {
console.log(error);
} else {
console.log(results);
}
});
Name | Description | Accepted values | Default value | Required |
---|---|---|---|---|
query | The keyword or the artist you search. | String | Yes | |
page | The page of result that you want. | Integer | 1 | No |
filter | The group in which you want to search. | 'All', 'CD', 'Vinyl', 'DVD', 'Bluray', '3dBluray', 'Headphones', 'GiftsCollect', 'Apparel' | 'All' | No |
sort | The order in which the products should sort. | 'Bestselling', 'Date of release', 'Price: Low to High', 'Price: High to Low', 'Alphabetical: A to Z', 'Alphabetical: Z to A' | 'Bestselling' | No |
Function that is called when the request is done or when there is an error.
The structure of a product is described below, for more details check the product JSON schema.
Name | Type | Description | Always present |
---|---|---|---|
id | Integer | Id | Yes |
sku | Integer | SKU | Yes |
name | String | Name of the product | Yes |
priceInCents | Integer | Price in cents in Canadian dollar | Yes |
category | String | The category ('Music', 'Film', 'Apparel', 'Headphones', 'Gift') | Yes |
kind | String | The kind of product or its format if the category is 'Music' or 'Film' | Yes |
available | Boolean | If the product is available online | Yes |
url | String | Url of the product in the store | Yes |
reservationUrl | String | The reservation URL to find a store and reserve the product | Yes |
catalogue | String | Catalogue number or serial number | No |
promotion | String | The promotions | No |
supplier | String | The supplier name | No |
smallImageUrl | String | Small image URL | No |
mediumImageUrl | String | Medium image URL | No |
largeImageUrl | String | Large image URL | No |
releaseDate | String | The released date in ISO 8601 date format | Only if category is 'Music' or 'Film' |
artist | String | The artist of the product | Only if category is 'Music' |
Example:
{
id: 72201,
sku: 246337,
name: 'NEW DAY HAS COME',
priceInCents: 1500,
category: 'Music',
kind: 'CD',
available: true,
url: 'https://www.hmv.ca/en/Search/Details?sku=246337',
reservationUrl: 'https://www.hmv.ca/en/Stores?reserve=true&id=72201',
catalogue: 'CK86400',
supplier: 'COLUMBIA',
smallImageUrl: 'https://www.hmv.ca/images/Music/75/44/4443/444344.jpg',
mediumImageUrl: 'https://www.hmv.ca/images/Music/170/44/4443/444344.jpg',
largeImageUrl: 'https://www.hmv.ca/images/Music/450/44/4443/444344.jpg',
artist: 'CELINE DION',
releaseDate: '2002-03-26'
}
Contribution is welcome! Open an issue first.
npm test
MIT
FAQs
Scraper that searches products on the Canadian HMV online store https://www.hmv.ca.
The npm package hmv-scraper receives a total of 0 weekly downloads. As such, hmv-scraper popularity was classified as not popular.
We found that hmv-scraper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.