| |
- yahoo.search.dom.DOMResultParser(yahoo.search.parser.ResultParser)
-
- LocalSearch
class LocalSearch(yahoo.search.dom.DOMResultParser) |
|
LocalSearch - DOM parser for Local Search
This subclass of the SearchParser extends the parser with support for
the Result Set Map Url. This adds an extra attribute
results.result_set_map_url
This attribute holds a URL pointing to a Yahoo Locals map with all the
results shown on the map.
Each result is a dictionary populated with the extracted data from the
XML results. The following keys are always available:
Title - Name of the result.
Address - Street address of the result.
City - City in which the result is located.
State - State in which the result is located.
Phone - Phone number of the business, if known.
Latitude - The latitude of the location.
Longitude - The longitude of the location.
Distance - The distance to the business or service.
Url - The URL for the local file or stream.
ClickUrl - The URL for linking to the detailed page.
MapUrl - The URL of a map for the address.
Categories - Contains all the categories in which this
listing is classified.
The following attributes are optional, and might not be set:
Rating - Rating information (see below)
BusinessUrl - The URL fo the business website, if known.
BusinessClickUrl - The URL for linking to the business website,
if known.
The Rating dictionary contains the following keys:
AverageRating - Average score of end-user ratings for the
business or service.
TotalRatings - The total number of ratings submitted for
the business or service.
TotalReviews - The total number of reviews submitted for
the business or service. Reviews can be viewed
at the location pointed to by the ClickUrl tag.
LastReviewDate - The date of the last review submitted for the
business or service unix timestamp format.
LastReviewIntro - The first few words of the last review
submitted for the business or service.
Categories is a list of tuples with
Name - Textual "name" value
Id - Unique identifier (internal yahoo ID).
Example:
results = ws.parse_results()
for res in results:
print "%s is %s %s away" % (res.Title, res.Distance[0],
res.Distance[1]) |
|
- Method resolution order:
- LocalSearch
- yahoo.search.dom.DOMResultParser
- yahoo.search.parser.ResultParser
- __builtin__.object
Methods defined here:
- __init__(self, service, res_dict=<class 'yahoo.search.parser.ResultDict'>)
- parse_results(self, dom_object)
- Specialized DOM parser for LocalSearch, to allow for the Map
URL in the result.
Data descriptors defined here:
- ResultSetMapUrl
- The Yahoo Locals map with all the results
- result_set_map_url
- The Yahoo Locals map with all the results
Methods inherited from yahoo.search.parser.ResultParser:
- __iter__(self)
Data descriptors inherited from yahoo.search.parser.ResultParser:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- firstResultPosition
- The first result position
- first_result_position
- The first result position
- results
- The list of all results
- service
- The Search Web Service object for this results parser
- totalResultsAvailable
- Total number of results for the query
- totalResultsReturned
- The number of results returned
- total_results_available
- Total number of results for the query
- total_results_returned
- The number of results returned
| |