C# 클래스 AmazonScrape.Parser

Contains static methods to process Amazon html and return product information
파일 보기 프로젝트 열기: ThomasRush/AmazonScrape

공개 메소드들

메소드 설명
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