Monday, April 30, 2012

[YouTube-API] Re: strange search result

I've got to the bottom of the technical issue although I think it's important for us to get to the bottom of why some crucial data was undefined - there was a single search result in the array of results that for some reason had no yt$statistics object in the returned JSON data. Perhaps I've been lucky in testing up to that point not to have encountered this situation in previous searches. Its within this object that we can read the viewCount property and something that we should be able to present to the person performing the search.

The specific video that caused the problem was http://www.youtube.com/watch?v=lh2MdEfGgI4. I can view it at youtube.com and also in our app (once I stop trying to read the yt$statistics object). One thing I've noticed at youtube.com is that it has a viewCount of 0 in the search results but 30+ views are displayed when playing the video. I can of course conditionally use the yt$statistics object if it exists? However - is there a reason somebody could give for there being no yt$statistics object? Here's the trace from firebug that shows where to look for the yt$statistics object. Object 48 has it but Object 49 not..

  1. 48Object
    1. authorArray[1]
    2. categoryArray[22]
    3. contentObject
    4. gd$commentsObject
    5. gd$ratingObject
    6. idObject
    7. linkArray[5]
    8. media$groupObject
    9. publishedObject
    10. titleObject
    11. updatedObject
    12. yt$statisticsObject
    13. __proto__Object
  2. 49Object
    1. authorArray[1]
    2. categoryArray[16]
    3. contentObject
    4. gd$commentsObject
    5. idObject
    6. linkArray[5]
    7. media$groupObject
    8. publishedObject
    9. titleObject
    10. updatedObject
    11. __proto__Object

Cheers

Will

On Thursday, April 26, 2012 9:10:16 PM UTC+1, Jeffrey Posnick wrote:
Hello,

 I can't reproduce what you're seeing. I also don't know what you mean
when you're talking about the viewCount property, as that's an
attribute associated with an individual video, not a search results
feed.

 Could you provide an example of the specific response values that are
causing problems?

Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev


On Apr 26, 12:34 pm, wg <reachw...@gmail.com> wrote:
> Looking deeper, there are results but the web app bombs out because it
> tries to read the viewCount property which is suddenly undefined when the
> search term is as described below. So to summarise what we found so far..
> Search 'david camero rupert' returns a viewCount property but 'david
> cameron rupert' returns viewCount of undefined. Would best practice to be
> to surround all references to properties in conditional 'if !undefined' ?
> surely not!?
>
>
>
>
>
>
>
> On Thursday, April 26, 2012 5:12:14 PM UTC+1, wg wrote:
>
> > This could be something to be ready for when our clients ask why some
> > search terms don't work. We've been looking at this again - it really is
> > making us very curious. The search term 'david cameron ruper' with no 't'
> > on rupert returns results of yes guess what - the recent news - but when
> > the result has a 't' added on the end no results are returned. Likewise,
> > when the search term is 'david camero rupert' with no 'n' on cameron we get
> > a couple of results but as soon as the name is completed no results. If
> > anybody else can be bothered to try let us know if you have the same
> > strange results in any other 3rd party youtube search situation. Perhaps
> > there are other terms that for some reason will return no results for
> > whatever reason. It would be good to know the reason as we might get
> > questions from our clients!
>
> > On Thursday, April 26, 2012 1:55:38 PM UTC+1, wg wrote:
>
> >> This is a weird observation I just stumbled across.. if I search for
> >> 'David Cameron' using the youtube search API I get results. If I
> >> search for 'Rupert Murdoch' I also get results. However, if I do a
> >> search for 'David Cameron Rupert Murdoch' it doesn't work. If I do a
> >> search for 'David Cameron Nick Clegg' or David Cameron and anybody
> >> else it does work. Why would a search associating Cameron and Murdoch
> >> not work in the youtube API? It works on youtube.com... weird! Can
> >> anybody think of a non conspiracy related technical reason?

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/yfbZtfODzA8J.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment