Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8619819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:25:56+00:00 2026-06-12T06:25:56+00:00

I’m trying to return results from the youtube api. My code is as follows:

  • 0

I’m trying to return results from the youtube api. My code is as follows:

function Vget(strt){

$.get("https://gdata.youtube.com/feeds/api/videos", { q: "soccer, 'start-index':strt,     'max-results':"5", v:"2",alt:"jsonc" },
 function(dta){
 var dt= $.parseJSON(dta);
var res= dt.data.items;
var tr=  dt.data.totalItems;

if ( (dt.data) && tr>0){
  for (i=0;i<5;i++){
 //do something with results
  }


}
})
}

But the line “var res= dt.data.items;” is giving me an error in Chrome: “Uncaught TypeError: Cannot read property ‘data’ of null”.

Firebug doesnt show any errors…

EDIT:

I tried commenting out the “var dt= $.parseJSON(dta);” and replacing the “dt.data” with “dta.data. and using the dta object straight. Which works great on Chrome, but then Firefox gives an error: “dta.data in undefined”!

EDIT 2 : here’s what the returned json looks like:

{"apiVersion":"2.1","data":{"updated":"2012-09-20T16:45:14.080Z","totalItems":153820,"startIndex":1,"itemsPerPage":2,"items":[{"id":"PO2b3cggqs0","uploaded":"2009-05-04T05:50:37.000Z","updated":"2012-09-20T03:28:49.000Z","uploader":"jbtdotcom","category":"Music","title":"Zebra - Official Video","description":"Official video clip for the JBT song, 'Zebra' from the album 'Sunrise Over Sea'. www.johnbutlertrio.com","thumbnail":{"sqDefault":"http://i.ytimg.com/vi/PO2b3cggqs0/default.jpg","hqDefault":"http://i.ytimg.com/vi/PO2b3cggqs0/hqdefault.jpg"},"player":{"default":"https://www.youtube.com/watch?v=PO2b3cggqs0&feature=youtube_gdata_player","mobile":"https://m.youtube.com/details?v=PO2b3cggqs0"},"content":{"5":"https://www.youtube.com/v/PO2b3cggqs0?version=3&f=videos&app=youtube_gdata","1":"rtsp://v8.cache2.c.youtube.com/CiILENy73wIaGQnNqiDI3ZvtPBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp","6":"rtsp://v3.cache1.c.youtube.com/CiILENy73wIaGQnNqiDI3ZvtPBMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp"},"duration":240,"rating":4.9585986,"likeCount":"4351","ratingCount":4396,"viewCount":1114536,"favoriteCount":5266,"commentCount":638,"accessControl":{"comment":"allowed","commentVote":"allowed","videoRespond":"moderated","rate":"allowed","embed":"allowed","list":"allowed","autoPlay":"allowed","syndicate":"allowed"}},{"id":"fljKx9nvrL4","uploaded":"2012-01-19T14:00:00.000Z","updated":"2012-09-20T06:03:17.000Z","uploader":"rhettandlink","category":"Entertainment","title":"Dope Zebra - Rhett & Link (Official Original Video) LMFAO","description":"This zebra is dope. Extended song on iTunes: dft.ba ** Official T-SHIRT: dft.ba Featured in LMFAO's Sorry For Party Rockin' music video and in their American Idol live performance on 4/19/12 and Billboard Music Awards on 5/20/12. You might have also spotted him on America's Got Talent...","thumbnail":{"sqDefault":"http://i.ytimg.com/vi/fljKx9nvrL4/default.jpg","hqDefault":"http://i.ytimg.com/vi/fljKx9nvrL4/hqdefault.jpg"},"player":{"default":"https://www.youtube.com/watch?v=fljKx9nvrL4&feature=youtube_gdata_player","mobile":"https://m.youtube.com/details?v=fljKx9nvrL4"},"content":{"5":"https://www.youtube.com/v/fljKx9nvrL4?version=3&f=videos&app=youtube_gdata","1":"rtsp://v1.cache7.c.youtube.com/CiILENy73wIaGQm-rO_Zx8pYfhMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp","6":"rtsp://v1.cache6.c.youtube.com/CiILENy73wIaGQm-rO_Zx8pYfhMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp"},"duration":109,"aspectRatio":"widescreen","rating":4.958495,"likeCount":"55842","ratingCount":56427,"viewCount":4658199,"favoriteCount":32961,"commentCount":12834,"accessControl":{"comment":"allowed","commentVote":"allowed","videoRespond":"denied","rate":"allowed","embed":"allowed","list":"allowed","autoPlay":"allowed","syndicate":"allowed"}}]}}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:25:57+00:00Added an answer on June 12, 2026 at 6:25 am

    Try writing the json to console and check the format of the data..

    function(dta){
     console.log(dta); // Before Parsing
     var dt= $.parseJSON(dta);
     console.log(dt);  //After Parsing
    

    Looks like you are not accessing the data properly

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.