C# Класс AmazonScrape.Parser

Contains static methods to process Amazon html and return product information
Показать файл Открыть проект

Открытые методы

Метод Описание
GetFuzzyPrimeEligibility ( string itemHtml ) : bool

Using an item's html, determines Prime eligibility with passable accuracy.

GetImageThumbnail ( string itemHtml ) : BitmapImage

Parses out the URL to the product's image thumbnail (if one exists) and then calls DownloadWebImage to return a BitmapImage

GetPageResultCount ( string pageHtml ) : int

Given the html of an Amazon search page result, returns the number of product results.

GetPageResultItemHtml ( string pageHtml, int resultCount ) : List

Returns a list of individual html product results from an html page

GetPriceRange ( string itemHtml ) : DoubleRange

Parses a DoubleRange object representing the "high" and "low" prices from the item's html.

GetProductName ( string itemHtml ) : string

Extracts the product's name from a single product's html

GetRating ( string reviewHistogramHtml ) : double

Returns a product's average review rating (double)

GetReviewCount ( string reviewHistogramHtml ) : int

Returns the number of reviews for the product, given the review histogram html (not the product html)

GetReviewHistogramHtml ( string itemHtml ) : string

Given a specific product result html, provides the review histogram html. Used for obtaining review count and review distribution.

GetScoreDistribution ( string reviewHistogramHtml ) : ScoreDistribution

Returns a product's review distribution (percentage of reviews in each category)

GetStrictPrimeEligibility ( Uri productURL ) : bool

Uses an additional page load to determine Prime eligibility with accuracy

GetURL ( string itemHtml ) : Uri

Extracts a product's Amazon URL.

ParseDoubleValues ( string text, int parseCount = -1 ) : List

Finds and returns a list of signed/unsigned integers/doubles parsed from the supplied string. Comma-formatted numbers are recognized.

Приватные методы

Метод Описание
GetMultipleRegExMatches ( string inputString, string regExPattern ) : List

Attempts to match the supplied pattern to the input string. Obtains multiple matches and returns a list of string matches if successful and an empty list of strings if no matches found.

GetSingleRegExMatch ( string inputString, string regExPattern ) : string

Attempts to match the supplied pattern to the input string. Only obtains a single match and returns the matching string if successful and an empty string if not.

Описание методов

GetFuzzyPrimeEligibility() публичный статический Метод

Using an item's html, determines Prime eligibility with passable accuracy.
public static GetFuzzyPrimeEligibility ( string itemHtml ) : bool
itemHtml string
Результат bool

GetImageThumbnail() публичный статический Метод

Parses out the URL to the product's image thumbnail (if one exists) and then calls DownloadWebImage to return a BitmapImage
public static GetImageThumbnail ( string itemHtml ) : BitmapImage
itemHtml string
Результат System.Windows.Media.Imaging.BitmapImage

GetPageResultCount() публичный статический Метод

Given the html of an Amazon search page result, returns the number of product results.
public static GetPageResultCount ( string pageHtml ) : int
pageHtml string html of entire search page
Результат int

GetPageResultItemHtml() публичный статический Метод

Returns a list of individual html product results from an html page
public static GetPageResultItemHtml ( string pageHtml, int resultCount ) : List
pageHtml string The string containing a single page of Amazon search results
resultCount int
Результат List

GetPriceRange() публичный статический Метод

Parses a DoubleRange object representing the "high" and "low" prices from the item's html.
public static GetPriceRange ( string itemHtml ) : DoubleRange
itemHtml string
Результат DoubleRange

GetProductName() публичный статический Метод

Extracts the product's name from a single product's html
public static GetProductName ( string itemHtml ) : string
itemHtml string Single product result html
Результат string

GetRating() публичный статический Метод

Returns a product's average review rating (double)
public static GetRating ( string reviewHistogramHtml ) : double
reviewHistogramHtml string html of the review histogram
Результат double

GetReviewCount() публичный статический Метод

Returns the number of reviews for the product, given the review histogram html (not the product html)
public static GetReviewCount ( string reviewHistogramHtml ) : int
reviewHistogramHtml string html for the review histogram
Результат int

GetReviewHistogramHtml() публичный статический Метод

Given a specific product result html, provides the review histogram html. Used for obtaining review count and review distribution.
public static GetReviewHistogramHtml ( string itemHtml ) : string
itemHtml string
Результат string

GetScoreDistribution() публичный статический Метод

Returns a product's review distribution (percentage of reviews in each category)
public static GetScoreDistribution ( string reviewHistogramHtml ) : ScoreDistribution
reviewHistogramHtml string Review histogram html
Результат ScoreDistribution

GetStrictPrimeEligibility() публичный статический Метод

Uses an additional page load to determine Prime eligibility with accuracy
public static GetStrictPrimeEligibility ( Uri productURL ) : bool
productURL System.Uri
Результат bool

GetURL() публичный статический Метод

Extracts a product's Amazon URL.
public static GetURL ( string itemHtml ) : Uri
itemHtml string
Результат System.Uri

ParseDoubleValues() публичный статический Метод

Finds and returns a list of signed/unsigned integers/doubles parsed from the supplied string. Comma-formatted numbers are recognized.
public static ParseDoubleValues ( string text, int parseCount = -1 ) : List
text string The string to parse
parseCount int The number of double values /// it will attempt to parse
Результат List