Comrite Unix Man page/Perldoc/Info page, English-Chinese Dictionary, Chinese-English Dictionary

Yahoo::Search::Result--3pm

Command: man perldoc info search(apropos)  


 
Yahoo::Search::Result(User Contributed Perl DocumentYahoo::Search::Result(3pm)



NAME
       Yahoo::Search::Result -- class representing a single result (single web
       page, image, video file, etc) from a Yahoo! search-engine query.  (This
       package is included in, and automatically loaded by, the Yahoo::Search
       package.)

Package Use
       You never need to "use" this package directly -- it is loaded automati-
       cally by Yahoo::Search.

Object Creation
       "Result" objects are created automatically when a "Response" object is
       created (when a "Request" object's "Fetch" method is called, either
       directly, or indirectly via a shortcut such as
       "Yahoo::Search->Query()".

Methods Overview
       This table shows the methods available on a per-search-space basis:

                                                            Terms
                                                     Related  |
                                                  Spell  |    |
                                             Local  |    |    |
                                         News  |    |    |    |
                                   Video  |    |    |    |    |
                              Image  |    |    |    |    |    |
                          Doc   |    |    |    |    |    |    |
                           |    |    |    |    |    |    |    |
          Next            [X]  [X]  [X]  [X]  [X]  [X]  [X]  [X]
          Prev            [X]  [X]  [X]  [X]  [X]  [X]  [X]  [X]
          Response        [X]  [X]  [X]  [X]  [X]  [X]  [X]  [X]
          Request         [X]  [X]  [X]  [X]  [X]  [X]  [X]  [X]
          SearchSpace     [X]  [X]  [X]  [X]  [X]  [X]  [X]  [X]

        * I               [X]  [X]  [X]  [X]  [X]  [X]  [X]   .
        * i               [X]  [X]  [X]  [X]  [X]  [X]  [X]   .
          as_html         [X]  [X]  [X]  [X]  [X]  [X]  [X]   .
          as_string       [X]  [X]  [X]  [X]  [X]  [X]  [X]   .
          Data            [X]  [X]  [X]  [X]  [X]  [X]  [X]   .

        * Url             [X]  [X]  [X]  [X]  [X]   .    .    .
        * ClickUrl        [X]  [X]  [X]  [X]  [X]   .    .    .
        * Title           [X]  [X]  [X]  [X]  [X]   .    .    .
          TitleAsHtml     [X]  [X]  [X]  [X]  [X]   .    .    .
          Link            [X]  [X]  [X]  [X]  [X]   .    .    .
        * Summary         [X]  [X]  [X]  [X]   .    .    .    .
          SummaryAsHtml   [X]  [X]  [X]  [X]   .    .    .    .

        * CacheUrl        [X]   .    .    .    .    .    .    .
        * CacheSize       [X]   .    .    .    .    .    .    .
        * ModTimestamp    [X]   .    .   [X]   .    .    .    .

        * Width            .   [X]  [X]   .    .    .    .    .
        * Height           .   [X]  [X]   .    .    .    .    .

        * ThumbUrl         .   [X]  [X]  [X]   .    .    .    .
        * ThumbWidth       .   [X]  [X]  [X]   .    .    .    .
        * ThumbHeight      .   [X]  [X]  [X]   .    .    .    .
          ThumbImg         .   [X]  [X]  [X]   .    .    .    .
          ThumbLink        .   [X]  [X]  [X]   .    .    .    .

        * HostUrl          .   [X]  [X]   .    .    .    .    .
        * Copyright        .   [X]  [X]   .    .    .    .    .
        * Publisher        .   [X]  [X]   .    .    .    .    .
        * Restrictions     .   [X]  [X]   .    .    .    .    .

        * Type            [X]  [X]  [X]   .    .    .    .    .
        * Bytes            .   [X]  [X]   .    .    .    .    .
        * Channels         .    .   [X]   .    .    .    .    .
        * Seconds          .    .   [X]   .    .    .    .    .
        * Duration         .    .   [X]   .    .    .    .    .
        * Streaming        .    .   [X]   .    .    .    .    .

        * SourceName       .    .    .   [X]   .    .    .    .
          SourceNameAsHtml .    .    .   [X]   .    .    .    .
        * SourceUrl        .    .    .   [X]   .    .    .    .
        * Language         .    .    .   [X]   .    .    .    .
        * PublishTime      .    .    .   [X]   .    .    .    .
        * PublishWhen      .    .    .   [X]   .    .    .    .

        * Address          .    .    .    .   [X]   .    .    .
        * City             .    .    .    .   [X]   .    .    .
        * State            .    .    .    .   [X]   .    .    .
        * Phone            .    .    .    .   [X]   .    .    .
        * Miles            .    .    .    .   [X]   .    .    .
        * Kilometers       .    .    .    .   [X]   .    .    .
        * Rating           .    .    .    .   [X]   .    .    .
        * MapUrl           .    .    .    .   [X]   .    .    .
        * BusinessUrl      .    .    .    .   [X]   .    .    .
        * BusinessClickUrl .    .    .    .   [X]   .    .    .
        * AllMapUrl        .    .    .    .   [X]   .    .    .

        * Term             .    .    .    .    .   [X]  [X]  [X]
          TermAsHtml       .    .    .    .    .   [X]  [X]  [X]

                           |    |    |    |    |    |    |    |
                          Doc   |    |    |    |    |    |    |
                              Image  |    |    |    |    |    |
                                   Video  |    |    |    |    |
                                         News  |    |    |    |
                                             Local  |    |    |
                                                  Spell  |    |
                                                     Related  |
                                                            Terms

       Those items marked with a '*' are also available via the "Data" method

METHODS
       $Result->Next([boolean])
           Returns the next "Result" object from among the list of result
           objects that are part of one "Response" object.

           Returns nothing when called on the last result in a response,
           unless auto-continuation is turned on, in which case the next set
           is automatically fetched and the first "Result" from that set's
           "Response" is returned.

           An optional defined boolean argument turns auto-continuation on
           (true) or off (false). If the argument is not defined, or not pro-
           vided, the value for the original request's "AutoContinue" option
           (default off) is used.

           Note that using auto-continuation can be dangerous. See the docs
           for "NextResult" in Yahoo::Search::Response.

       $Result->Prev
           The opposite of "Next". No auto-continuation feature.

       $Result->Response
           Returns the "Response" object of which this "Result" object is a
           part.

       $Result->Request
           Returns the original "Request" object from which this "Result"
           object's "Response" was derived.

       $Result->SearchSpace
           Returns a string which indicates the search space of the original
           query that this result was part of. (That is, it returns "Doc",
           "Image", "News", "Local", or "Video".)

           It's the same as

              $Result->Request->SearchSpace;

       $Result->i[ separator ]
       $Result->I[ separator ]
           The first (lower-case letter "i") returns the zero-based ordinal of
           the result from among those in the current "Response".

           The latter (upper-case letter "I") returns the zero-based ordinal
           of the result from among all search results that might be returned
           by Yahoo! for the given query.

           For example, after

             my @Results = Yahoo::Search->Results(Image => "Briteny",
                                                  AppId => "my app id",
                                                  Start => 45,
                                                  Count => 15);

           the $Results[0] result object has an "I" of 45 (the 45th result of
           all "Briteny" image results) and an "i" of 0 (the 0th result among
           those returned this time.)

           In either case, if an optional argument is given and is true, it is
           used as a separator every three digits. In the US, one would use

               $Result->I(',')

           to return "1,234" where

               $Result->I()

           would return "1234".

       $Result->as_html
           Returns a string of HTML that represents the result, as appropriate
           to the result's query search space.

           There are many ways one may wish to display query results -- this
           method returns one display that the author finds useful. It may
           come in useful for quick prototyping of web applications, e.g.

             sub ShowRelated
             {
               print join "<hr>", map { $_->as_html } Yahoo::Search->Results(@_);
             }

           (Also see "Yahoo::Search->HtmlResults")

           The HTML returned by "as_html" contains class references, thereby
           allowing the look-and-feel to be easily adjusted. Here's a style
           sheet that makes Image search results look palatable.

             <style>
               .yResult { display: block; border: #CCF 3px solid ; padding:10px }
               .yLink   { }
               .yTitle  { display:none }
               .yImg    { border: solid 1px }
               .yUrl    { display:none }
               .yMeta   { font-size: 80% }
               .ySrcUrl { }
               .ySum    { font-family: arial; font-size: 90% }
             </style>

           Bugs: English-centric

       $Result->as_string
           Returns a textual representation of the "Result", which may be use-
           ful for quick prototyping or debugging.

       $Result->Data
           Returns a list of key/value pairs containing the fundamental data
           for the result (those items marked with '*' in the table at the
           start of this document).

             my %Data = $Result->Data;

       $Result->Url
       $Result->ClickUrl
           "Url" returns the raw url of the item (web page, image, etc.),
           appropriate for display to the user.

           "ClickUrl" returns a url appropriate for the href attribute of a
           link.

           In some cases, the two return the same url.

           As with all Result-object methods which return a url of some sort,
           you can provide a single argument such as "href" and receive a
           string such as
              href="..."  appropriate to be used directly in html. For exam-
           ple,

              my $HREF = $Result->ClickUrl('href');
              print "<a $HREF>click</a>";

           is preferable to

              my $url = $Result->ClickUrl;
              print "<a href='$url'>click</a>";

           since the latter would break if $url contains a singlequote.

       $Result->Title([ as_html ])
       $Result->TitleAsHtml
           "Title" returns the raw title text associated with the result. If
           an optional argument is provided and is true, the title text is
           returned as html.

           "TitleAsHtml" is the same as

             $Result->Title(1)

       $Result->Link
           Returns a link made from the "ClickUrl" and the "Title", with class
           "yLink", e.g.

              <a class=yLink href='$URL'>$TITLE</a>

       $Result->Summary([ as_html ])
       $Result->SummaryAsHtml
           Like "Title" and "TitleAsHtml", but for the summary associated with
           the result.

       $Result->CacheUrl
       $Result->CacheSize
           (Appropriate for Doc search results)

           "CacheUrl" returns the url of the document in the Yahoo! cache.
           See the documentation for the "Url" method for information on the
           one-argument version of this method.

           "CacheSize" returns the size (as a string like "22k").

       $Result->ModTimestamp
           (Appropriate for Doc and News search results)

           The Unix timestamp of the Last-Modified time associated with the
           the url when it was last checked by Yahoo!'s backend crawlers.

       $Result->Width
       $Result->Height
           (Appropriate for Image and Video search results)

           The width and height (in pixels) of the image or video.

       $Result->ThumbUrl
       $Result->ThumbWidth
       $Result->ThumbHeight
           (Appropriate for Image, Video, and News search results)

           The url of a thumbnail image, and its width and height.

           (Note: few News results have a thumbnail, but some do.)

           See the documentation for the "Url" method for information on the
           one-argument version of "ThumbUrl".

       $Result->ThumbImg
           (Appropriate for Image, Video, and News search results)

           Returns a "<img>" tag representing the thumbnail image, e.g.

             <img class=yImg src='$IMGURL' width=$WIDTH height=$HEIGHT>

       $Result->ThumbLink
           (Appropriate for Image, Video, and News search results)

           Returns a link from the thumbnail to the "ClickUrl" of the result,
           e.g.

             <a class=yLink href='$CLICKURL'>
               <img class=yImg src='$IMGURL' width=$WIDTH height=$HEIGHT>
             </a>

       $Result->HostUrl
           (Appropriate for Image and Video search results)

           Returns the url of the web page containing a link to the
           image/video item that the "Result" represents.

           See the documentation for the "Url" method for information on the
           one-argument version of this method.

       $Result->Type
           (<Appropriate for Doc, Image, and Video search results>)

           Returns a string representing the file type of the item to which
           "$Result->Url" points. For Doc searches, the MIME type (e.g.
           "text/html") is returned.

           For other search spaces, here are the possible return values:

             Video:  avi  flash  mpeg  msmedia  quicktime  realmedia
             Image:  bmp  gif  jpg  png.

           Yahoo! Search derives these Video/Image "Type" value by actually
           inspecting the file contents, and as such it is more reliable than
           looking at the file extension.

       $Result->Copyright([ as_html ])
           (<Appropriate for Image and Video search results>)

           Returns any copyright notice associated with the result. If an
           optional argument is provided and is true, the copyright text is
           returned as html.

       $Result->Publisher([ as_html ])
           (<Appropriate for Image, and Video search results>)

           Returns any publisher information (as a string) associated with the
           result.  If an optional argument is provided and is true, the pub-
           lisher information is returned as html.

       $Result->Restrictions
           (<Appropriate for Image, and Video search results>)

           A (possibly zero-length) string containing zero or more of the fol-
           lowing space-separated words:

             noframe
             noinline

           See Yahoo!'s web site (http://developer.yahoo.net/) for information
           on them.

       $Result->Bytes
           (Appropriate for Image, and Video search results)

           The size of the image/video item, in bytes.

       $Result->Channels
           (Appropriate for Video search results)

           Returns the number of channels in the audio, if known.  Examples
           are "1", "2", "4.1", "5.1", etc....

       $Result->Seconds
           (Appropriate for Video search results)

           Returns the duration of the video clip, if known, in (possibly
           fractional) seconds.

       $Result->Duration
           (Appropriate for Video search results)

           Returns a string representing the duration of the video clip, if
           known, in the form of "37 sec", "1:23", or "4:56:23", as appropri-
           ate.

           Bugs: English-centric

       $Result->Streaming
           (Appropriate for Video search results)

           Returns "1" if the multimedia is streaming, "0" if not.  If not
           known, an empty list is returned.

       $Result->SourceUrl
           (Appropriate for News search results)

           The main url of the news provider hosting the article that the
           "Result" refers to.

           See the documentation for the "Url" method for information on the
           one-argument version of this method.

       $Result->SourceName([ as_html ])
       $Result->SourceNameAsHtml
           (Appropriate for News search results)

           Similar to "Title" and "TitleAsHtml", but the name of the organiza-
           tion associated with the news article (and, by extension, with
           "SourceUrl").

       $Result->Language
           (Appropriate for News search results)

           A code representing the language in which the article is written
           (e.g. "en" for English, "ja" for Japanese, etc.). See the list of
           language codes at "perldoc" Yahoo::Search.

       $Result->PublishTime
       $Result->PublishWhen
           (Appropriate for News search results)

           "PublishTime" is the Unix time associated with the article, e.g.

             print "Published ", scalar(localtime $Result->PublishTime), "\n";

           "PublishWhen" gives a string along the lines of

             3h 25m ago              (if less than 12 hours ago)
             Tue 9:47am              (if less than 5 days ago)
             Sat, Dec 25             (if less than 100 days ago)
             Sat, Dec 25, 2004       (if >= 100 days ago)

           Bug: "PublishWhen" is English-centric.

       $Result->Address
       $Result->City
       $Result->State
       $Result->Phone
           (Appropriate for Local search results)

           Location and Phone number for the business that the "Result" refers
           to.

       $Result->Miles
       $Result->Kilometers
           (Appropriate for Local search results)

           The distance (in miles and kilometers) from the location used to
           make the query to the location of this result.

       $Result->Rating
           (Appropriate for Local search results)

           Returns the rating associated with the result, if there is one. If
           there is a rating, it is from 1 (lowest) to 5 (highest) in
           0.5-sized steps. If not, nothing is returned.

       $Result->MapUrl
       $Result->AllMapUrl
           (Appropriate for Local search results)

           "MapUrl" is a url to a Yahoo! Maps map showing the business' loca-
           tion.

           "AllMapUrl" is a url to a Yahoo! Maps map showing all the busi-
           nesses found in the same result-set that the current "Result" was
           part of.

           See the documentation for the "Url" method for information on the
           one-argument versions of these methods.

       $Result->BusinessUrl
       $Result->BusinessClickUrl
           (Appropriate for Local search results)

           The business' home page, if available. "BusinessUrl" is appropriate
           for display, while "BusinessClickUrl" is appropriate for the href
           of a link.

           See the documentation for the "Url" method for information on the
           one-argument versions of these methods.

       $Result->Term([ as_html ])
       $Result->TermAsHtml
           (Appropriate for Spell, Related, and Terms search results)

           "Term" returns the term associated with the result. If an optional
           argument is provided and is true, the term text is returned as
           html.

           "TermAsHtml" is the same as

             $Result->Term(1)

Copyright
       Copyright (C) 2005 Yahoo! Inc.

Author
       Jeffrey Friedl (jfriedl AT yahoo.com)

       $Id: Result.pm 3 2005-01-28 04:29:54Z jfriedl $



perl v5.8.7                       2005-03-31        Yahoo::Search::Result(3pm)
 

©2005 Comrite