Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Thanks for reply, i will try to be more specific in my request.

I want to retrieve a particular data in structure type hash

To print all the hash, i use the code :

use strict; use warnings; use Data::Dumper; my $myquery="Robert Palmer"; use WebService::GData::YouTube; use WebService::GData::Error; my $yt = new WebService::GData::YouTube(); $yt->query()->q("$myquery")->limit(10,2); $yt->query($myquery)->maxresults(20); my $videos = $yt->search_video(); print Dumper($videos);

This will return:

$VAR1 = [ bless( { '_recorded' => bless( { '_children' => [], 'namespaces' => {} }, 'WebService::GData::YouTub +e::YT::Recorded' ), '_updated' => bless( { 'text' => '2012-12-10T13:35: +15.000Z', '_children' => [], 'namespaces' => {} }, 'WebService::GData::Node::A +tom::Updated' ), '_title' => bless( { 'text' => 'Robert Palmer - Add +icted To Love', '_children' => [], 'namespaces' => {} }, 'WebService::GData::Node::Ato +m::Title' ), '_id' => bless( { 'text' => 'tag:youtube.com,2008:v +ideo:XcATvu5f9vE', '_children' => [], 'namespaces' => {} }, 'WebService::GData::Node::Atom:: +Id' ), '_entity' => bless( { 'gd:etag' => 'W/"DEIFRH47eCp7 +I2A9WhNWEUk."', '_children' => [ bless( { 'te +xt' => '2009-12-25T07:54:08.000Z', '_c +hildren' => [], 'na +mespaces' => {} }, 'W +ebService::GData::Node::Atom::Published' ), bless( { '_c +hildren' => [], 'na +mespaces' => {} }, 'W +ebService::GData::Node::Atom::Summary' ), bless( { 'sr +c' => 'http://www.youtube.com/v/XcATvu5f9vE?version=3&f=videos&app=yo +utube_gdata', '_c +hildren' => [], 'ty +pe' => 'application/x-shockwave-flash', 'na +mespaces' => {} }, 'W +ebService::GData::Node::Atom::Content' ), bless( { 'ar +ray' => [ + bless( { + '_name' => bless( { + 'text' => 'RobertPalmerVEVO', + '_children' => [], + 'namespaces' => {} + }, 'WebService::GData::Node::Ato +m::Name' ), + '_uri' => bless( { + 'text' => 'http://gdata.youtube +.com/feeds/api/users/RobertPalmerVEVO', + '_children' => [], + 'namespaces' => {} + }, 'WebService::GData::Node::Atom +::Uri' ), + '_entity' => bless( { + '_children' => [ + $VAR1->[0]{ +'_entity'}{'_children'}[3]{'array'}[0]{'_name'}, + $VAR1->[0]{ +'_entity'}{'_children'}[3]{'array'}[0]{'_uri'} + ], + 'namespaces' => {} + }, 'WebService::GData::Node::A +tom::Author' ) + }, 'WebService::GData::Node::Atom::AuthorEntity' ) + ], 'ca +che' => {} }, 'W +ebService::GData::Collection' ), bless( { 'ar +ray' => [ + bless( { + '_children' => [], + 'scheme' => 'http://schemas.google.com/g/2005#kind +', + 'term' => 'http://gdata.youtube.com/schemas/2007#v +ideo', + 'namespaces' => {} + }, 'WebService::GData::Node::Atom::Category' ), + bless( { + '_children' => [], + 'label' => 'Music', + 'scheme' => 'http://gdata.youtube.com/schemas/2007 +/categories.cat', + 'term' => 'Music', + 'namespaces' => {} + }, 'WebService::GData::Node::Atom::Category' ) + ], 'ca +che' => {} }, 'W +ebService::GData::Collection' ), $VAR1->[0]{' +_id'}, bless( { 'ar +ray' => [ + bless( { + 'rel' => 'alternate', + 'href' => 'http://www.youtube.com/watch?v=XcATvu5f +9vE&feature=youtube_gdata', + '_children' => [], + 'type' => 'text/html', + 'namespaces' => {} + }, 'WebService::GData::Node::Atom::Link' ), + bless( { + 'rel' => 'http://gdata.youtube.com/schemas/2007#vi +deo.responses', + 'href' => 'http://gdata.youtube.com/feeds/api/vide +os/XcATvu5f9vE/responses', + '_children' => [], + 'type' => 'application/atom+xml', + 'namespaces' => {} + }, 'WebService::GData::Node::Atom::Link' ), + bless( { + 'rel' => 'http://gdata.youtube.com/schemas/2007#vi +deo.related', + 'href' => 'http://gdata.youtube.com/feeds/api/vide +os/XcATvu5f9vE/related', + '_children' => [], + 'type' => 'application/atom+xml', + 'namespaces' => {} + }, 'WebService::GData::Node::Atom::Link' ), + bless( { + 'rel' => 'http://gdata.youtube.com/schemas/2007#up +loader', + 'href' => 'http://gdata.youtube.com/feeds/api/user +s/2cgN9BQEA14z3ryXNmJjkA', + '_children' => [], + 'type' => 'application/atom+xml', + 'namespaces' => {} + }, 'WebService::GData::Node::Atom::Link' ), + bless( { + 'rel' => 'self', + 'href' => 'http://gdata.youtube.com/feeds/api/vide +os/XcATvu5f9vE', + '_children' => [], + 'type' => 'application/atom+xml', + 'namespaces' => {} + }, 'WebService::GData::Node::Atom::Link' ) + ], 'ca +che' => {} }, 'W +ebService::GData::Collection' ), $VAR1->[0]{' +_title'}, $VAR1->[0]{' +_updated'}, bless( { '_d +uration' => bless( { + 'seconds' => '236', + '_children' => [], + 'namespaces' => {} + }, 'WebService::GData::YouTube::YT::Duration' ), '_d +escription' => bless( { + 'text' => 'Music video by Robert Palmer perfo +rming Addicted To Love. (C) 1985 The Island Def Jam Music Group', + '_children' => [], + 'type' => 'plain', + 'namespaces' => {} + }, 'WebService::GData::Node::Media::Description +' ), '_t +itle' => bless( { + 'text' => 'Robert Palmer - Addicted To Love', + '_children' => [], + 'type' => 'plain', + 'namespaces' => {} + }, 'WebService::GData::Node::Media::Title' ), '_a +spect_ratio' => bless( { + '_children' => [], + 'namespaces' => {} + }, 'WebService::GData::YouTube::YT::AspectRati +o' ), '_t +humbnail' => bless( { + 'array' => [ + bless( { + 'yt:name' => 'default', + 'width' => 120, + 'time' => '00:01:58', + '_children' => [], + 'url' => 'http://i.ytimg. +com/vi/XcATvu5f9vE/default.jpg', + 'height' => 90, + 'namespaces' => {} + }, 'WebService::GData::Node +::Media::Thumbnail' ), + bless( { + 'yt:name' => 'mqdefault', + 'width' => 320, + '_children' => [], + 'url' => 'http://i.ytimg. +com/vi/XcATvu5f9vE/mqdefault.jpg', + 'height' => 180, + 'namespaces' => {} + }, 'WebService::GData::Node +::Media::Thumbnail' ), + bless( { + 'yt:name' => 'hqdefault', + 'width' => 480, + '_children' => [], + 'url' => 'http://i.ytimg. +com/vi/XcATvu5f9vE/hqdefault.jpg', + 'height' => 360, + 'namespaces' => {} + }, 'WebService::GData::Node +::Media::Thumbnail' ), + bless( { + 'yt:name' => 'start', + 'width' => 120, + 'time' => '00:00:59', + '_children' => [], + 'url' => 'http://i.ytimg. +com/vi/XcATvu5f9vE/1.jpg', + 'height' => 90, + 'namespaces' => {} + }, 'WebService::GData::Node +::Media::Thumbnail' ), + bless( { + 'yt:name' => 'middle', + 'width' => 120, + 'time' => '00:01:58', + '_children' => [], + 'url' => 'http://i.ytimg. +com/vi/XcATvu5f9vE/2.jpg', + 'height' => 90, + 'namespaces' => {} + }, 'WebService::GData::Node +::Media::Thumbnail' ), + bless( { + 'yt:name' => 'end', + 'width' => 120, + 'time' => '00:02:57', + '_children' => [], + 'url' => 'http://i.ytimg. +com/vi/XcATvu5f9vE/3.jpg', + 'height' => 90, + 'namespaces' => {} + }, 'WebService::GData::Node +::Media::Thumbnail' ) + ], + 'cache' => {} + }, 'WebService::GData::Collection' ), '_e +ntity' => bless( { + '_children' => [ + bless( { + 'array' => [ + bless( { + 't +ext' => 'Music', + '_ +children' => [], + 's +cheme' => 'http://gdata.youtube.com/schemas/2007/categories.cat', + 'l +abel' => 'Music', + 'n +amespaces' => {} + }, ' +WebService::GData::Node::Media::Category' ) + ], + 'cache' => {} + }, 'WebService::GData::Col +lection' ), + bless( { + 'array' => [ + bless( { + 't +ext' => 'DE', + 'r +elationship' => 'deny', + '_ +children' => [], + 't +ype' => 'country', + 'n +amespaces' => {} + }, ' +WebService::GData::Node::Media::Restriction' ) + ], + 'cache' => {} + }, 'WebService::GData::Col +lection' ), + $VAR1->[0]{'_entity'}{'_children' +}[9]{'_thumbnail'}, + bless( { + 'array' => [ + bless( { + 'y +t:type' => 'partner', + 't +ext' => 'robertpalmervevo', + '_ +children' => [], + 's +cheme' => 'urn:youtube', + 'r +ole' => 'uploader', + 'y +t:display' => 'RobertPalmerVEVO', + 'n +amespaces' => {} + }, ' +WebService::GData::Node::Media::Credit' ) + ], + 'cache' => {} + }, 'WebService::GData::Col +lection' ), + bless( { + 'array' => [ + bless( { + '_ +children' => [], + 'y +t:format' => 5, + 'd +uration' => 236, + 'i +sDefault' => 'true', + 'e +xpression' => 'full', + 'u +rl' => 'http://www.youtube.com/v/XcATvu5f9vE?version=3&f=videos&app=y +outube_gdata', + 'm +edium' => 'video', + 't +ype' => 'application/x-shockwave-flash', + 'n +amespaces' => {} + }, ' +WebService::GData::Node::Media::Content' ) + ], + 'cache' => {} + }, 'WebService::GData::Col +lection' ), + bless( { + '_children' => [], + 'url' => 'http://www.you +tube.com/watch?v=XcATvu5f9vE&feature=youtube_gdata_player', + 'namespaces' => {} + }, 'WebService::GData::Nod +e::Media::Player' ), + $VAR1->[0]{'_entity'}{'_children' +}[9]{'_title'}, + $VAR1->[0]{'_entity'}{'_children' +}[9]{'_description'}, + bless( { + '_children' => [], + 'namespaces' => {} + }, 'WebService::GData::Nod +e::Media::Keywords' ) + ], + 'namespaces' => {} + }, 'WebService::GData::Node::Media::Group' ), '_c +ategory' => $VAR1->[0]{'_entity'}{'_children'}[9]{'_entity'}{'_childr +en'}[0], '_p +layer' => $VAR1->[0]{'_entity'}{'_children'}[9]{'_entity'}{'_children +'}[5], '_c +ontent' => bless( { + 'array' => [ + bless( { + '_children' => [], + 'namespaces' => {} + }, 'WebService::GData::YouTub +e::YT::Media::Content' ) + ], + 'cache' => {} + }, 'WebService::GData::Collection' ), '_k +eywords' => $VAR1->[0]{'_entity'}{'_children'}[9]{'_entity'}{'_childr +en'}[8], '_u +ploaded' => bless( { + 'text' => '2009-12-25T07:54:08.000Z', + '_children' => [], + 'namespaces' => {} + }, 'WebService::GData::YouTube::YT::Uploaded' ), '_v +ideoid' => bless( { + 'text' => 'XcATvu5f9vE', + '_children' => [], + 'namespaces' => {} + }, 'WebService::GData::YouTube::YT::Videoid' ), '_r +estriction' => $VAR1->[0]{'_entity'}{'_children'}[9]{'_entity'}{'_chi +ldren'}[1], '_c +redit' => $VAR1->[0]{'_entity'}{'_children'}[9]{'_entity'}{'_children +'}[3] }, 'W +ebService::GData::YouTube::YT::GroupEntity' ), bless( { '_c +hildren' => [], 'nu +mLikes' => '22702', 'nu +mDislikes' => '294', 'na +mespaces' => {} }, 'W +ebService::GData::YouTube::YT::Rating' ), $VAR1->[0]{' +_recorded'} ], 'namespaces' => {} }, 'WebService::GData::Node::At +om::Entry' ), '_summary' => $VAR1->[0]{'_entity'}{'_children'}[1] +, '_category' => $VAR1->[0]{'_entity'}{'_children'}[4 +], '_content' => $VAR1->[0]{'_entity'}{'_children'}[2] +, '_serializer' => 'xml', '_link' => $VAR1->[0]{'_entity'}{'_children'}[6], '_feed' => { 'yt$statistics' => { 'viewCount' => '6 +569735', 'favoriteCount' = +> '0' }, 'link' => [ $VAR1->[0]{'_entity'}{'_ch +ildren'}[6]{'array'}[0], $VAR1->[0]{'_entity'}{'_ch +ildren'}[6]{'array'}[1], $VAR1->[0]{'_entity'}{'_ch +ildren'}[6]{'array'}[2], $VAR1->[0]{'_entity'}{'_ch +ildren'}[6]{'array'}[3], $VAR1->[0]{'_entity'}{'_ch +ildren'}[6]{'array'}[4] ], 'gd$comments' => { 'gd$feedLink' => { +'rel' => 'http://gdata.youtube.com/schemas/2007#comments', +'href' => 'http://gdata.youtube.com/feeds/api/videos/XcATvu5f9vE/comm +ents', +'countHint' => 4897 } }, 'yt$accessControl' => [ { 'permission' + => 'allowed', 'action' => +'comment' }, { 'permission' + => 'allowed', 'action' => +'commentVote' }, { 'permission' + => 'allowed', 'action' => +'videoRespond' }, { 'permission' + => 'allowed', 'action' => +'rate' }, { 'permission' + => 'allowed', 'action' => +'embed' }, { 'permission' + => 'allowed', 'action' => +'list' }, { 'permission' + => 'allowed', 'action' => +'autoPlay' }, { 'permission' + => 'allowed', 'action' => +'syndicate' } ], 'app$control' => { 'yt$state' => { '$t +' => 'Syndication of this video was restricted.', 'na +me' => 'restricted', 're +asonCode' => 'limitedSyndication' } }, 'gd$etag' => 'W/"DEIFRH47eCp7I2A9WhNWE +Uk."', 'content' => { 'src' => 'http://www.yo +utube.com/v/XcATvu5f9vE?version=3&f=videos&app=youtube_gdata', 'type' => 'application/ +x-shockwave-flash' }, 'gd$rating' => { 'rel' => 'http://sche +mas.google.com/g/2005#overall', 'numRaters' => 22996, 'average' => '4.94890 +4', 'min' => 1, 'max' => 5 }, 'author' => [ $VAR1->[0]{'_entity'}{'_ +children'}[3]{'array'}[0] ], 'published' => { 'text' => '2009-12-25 +T07:54:08.000Z' }, 'media$group' => { 'media$player' => { + 'url' => 'http://www.youtube.com/watch?v=XcATvu5f9vE&feature=youtube +_gdata_player' } +, 'media$description' + => { + 'text' => 'Music video by Robert Palmer performing Addicted To +Love. (C) 1985 The Island Def Jam Music Group', + 'type' => 'plain' + }, 'yt$videoid' => { ' +text' => 'XcATvu5f9vE' }, 'yt$duration' => { +'seconds' => '236' }, 'media$content' => +[ + $VAR1->[0]{'_entity'}{'_children'}[9]{'_content'}{'array'}[0] +], 'yt$uploaderId' => +{ + '$t' => 'UC2cgN9BQEA14z3ryXNmJjkA' +}, 'media$license' => +{ + 'href' => 'http://www.youtube.com/t/terms', + '$t' => 'youtube', + 'type' => 'text/html' +}, 'media$category' => + [ + $VAR1->[0]{'_entity'}{'_children'}[9]{'_entity'}{'_children'}[0]{' +array'}[0] + ], 'media$keywords' => + {}, 'media$title' => { +'text' => 'Robert Palmer - Addicted To Love', +'type' => 'plain' }, 'media$credit' => [ + $VAR1->[0]{'_entity'}{'_children'}[9]{'_entity'}{'_children'}[3]{'ar +ray'}[0] ] +, 'media$restriction' + => [ + $VAR1->[0]{'_entity'}{'_children'}[9]{'_entity'}{'_children'}[1 +]{'array'}[0] + ], 'media$thumbnail' = +> [ + $VAR1->[0]{'_entity'}{'_children'}[9]{'_thumbnail'}{'array'}[0], + $VAR1->[0]{'_entity'}{'_children'}[9]{'_thumbnail'}{'array'}[1], + $VAR1->[0]{'_entity'}{'_children'}[9]{'_thumbnail'}{'array'}[2], + $VAR1->[0]{'_entity'}{'_children'}[9]{'_thumbnail'}{'array'}[3], + $VAR1->[0]{'_entity'}{'_children'}[9]{'_thumbnail'}{'array'}[4], + $VAR1->[0]{'_entity'}{'_children'}[9]{'_thumbnail'}{'array'}[5] + ], 'yt$uploaded' => { +'text' => '2009-12-25T07:54:08.000Z' } }, 'id' => { 'text' => 'tag:youtube.com,2 +008:video:XcATvu5f9vE' }, 'updated' => { 'text' => '2012-12-10T1 +3:35:15.000Z' }, 'category' => [ $VAR1->[0]{'_entity'}{ +'_children'}[4]{'array'}[0], $VAR1->[0]{'_entity'}{ +'_children'}[4]{'array'}[1] ], 'title' => { 'text' => 'Robert Palmer +- Addicted To Love' }, 'yt$rating' => { 'numLikes' => '22702' +, 'numDislikes' => '294 +' } }, '_rating' => $VAR1->[0]{'_entity'}{'_children'}[10] +, '_author' => $VAR1->[0]{'_entity'}{'_children'}[3], '_published' => $VAR1->[0]{'_entity'}{'_children'}[ +0], '_media' => $VAR1->[0]{'_entity'}{'_children'}[9], '_request' => bless( { '_basequery' => bless( { 'ma +xresults' => 1, '_q +uery' => { + 'strict' => 'true', + 'alt' => 'json', + 'start-index' => 1, + 'q' => 'robert palmer', + 'prettyprint' => 'false', + 'v' => 2, + 'max-results' => 1 + } }, 'W +ebService::GData::YouTube::Query' ), '__AUTH__' => undef, '__COMPRESSION__' => 'false' +, '__UA_NAME__' => '', '__URI__' => 'http://gdata.y +outube.com/feeds/api/videos/', '__UA__' => bless( { 'max_re +direct' => 7, 'protoc +ols_forbidden' => undef, 'no_pro +xy' => [], 'protoc +ols_allowed' => undef, 'use_ev +al' => 1, 'reques +ts_redirectable' => [ + 'GET', + 'HEAD' + ], 'from' +=> undef, 'timeou +t' => 180, 'agent' + => 'WebService::GData::Base/0.0203', 'def_he +aders' => undef, 'parse_ +head' => 1, 'proxy' + => {}, 'max_si +ze' => undef }, 'LWP:: +UserAgent' ), '__OVERRIDE__' => 'false' }, 'WebService::GData::Base' ) }, 'WebService::GData::YouTube::Feed::Video' ) ];

And i don't known how to extract only: http://i.ytimg. com/vi/XcATvu5f9vE/2.jpg and 00:01:58 from this result (something like (${$hash}?????{'array'}{'url'} and ${$hash}?????{'array'}{'time'}

Regards, nono


In reply to Re^2: explore a complexe hash structure return by Webservices::GData::YouTube by roidlagratte
in thread explore a complexe hash structure return by Webservices::GData::YouTube by roidlagratte

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    Corion idly wonders about creating a series of HTTP requests. There seems to be no framework to generate a series of HTTP requests, like "try all these requests"
    [Corion]: This is vaguely inspired by that list of "nasty" strings, which I'd like to replace among HTTP parameters, just to see whether the application crashes, but also for easy downloading of a list of URLs etc
    [Corion]: Maybe I'll just conoct something using Algorithm::Permute to create an (OO) generator for such requests, or a simple function.
    [Corion]: For testing I imagine one would want to test a random sampling of such "bad"/"unexpected" requests, while for downloading, one would want to generate them all in order, but not necessarily as a huge list

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (8)
    As of 2017-01-16 15:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Do you watch meteor showers?




      Results (151 votes). Check out past polls.