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

  • SEARCH
  • Home
  • 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 6528233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:30:56+00:00 2026-05-25T09:30:56+00:00

I’d like to extract the last video (only video), with title, description, etc. I

  • 0

I’d like to extract the last video (only video), with title, description, etc.

I am using JSON Data API from YouTube Data API and using the Video Upload By User Feed in order to get the data.

I got from youtube a JSON (object?) about my Youtube’s space and tried to read the JSON text, but its a suicide.

My code is :

<div id="ytContent"></div>        

<script type="text/javascript">
    function showMyVideos(data) {
        var feed = data.feed;
        var entries = feed.entry || [];
        for (var i = 0; i < entries.length; i++) {
            var entry = entries[i];
            var title = entry.title.$t;
            $('#ytContent').append(title + "<br />");
        }
    }
</script>             

<script type="text/javascript" src="http://gdata.youtube.com/feeds/users/MYUSERNAME/uploads?alt=json-in-script&format=5&callback=showMyVideos"></script>

but if I try to do :

var p = eval("(" + data + ")");
alert(p);

I can’t get a right parser. Why? How can I parse my JSON? I just need to understand which field I can use in order for me to get the last video from the feed. Also, hints/tips on getting the last video will also be helpful.

Thanks

  • 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-05-25T09:30:57+00:00Added an answer on May 25, 2026 at 9:30 am

    You don’t need to parse the data, it is already parsed.

    The url inside your script tags gets rendered into a function call, passing the data object as a parameter: showMyVideos({ /* data object */ });.

    Your problem is that you are trying to access the entry field in the data you are receiving (var entries = feed.entry || []), but there is no such field in data.feed:

    var data = {
        "version": "1.0",
        "encoding": "UTF-8",
        "feed": {
            "xmlns": "http://www.w3.org/2005/Atom",
            "xmlns$openSearch": "http://a9.com/-/spec/opensearchrss/1.0/",
            "id": {
                "$t": "http://gdata.youtube.com/feeds/users/MYUSERNAME/uploads"
            },
            "updated": {
                "$t": "2011-09-06T08:05:27.303Z"
            },
            "category": [
                {
                    "scheme": "http://schemas.google.com/g/2005#kind",
                    "term": "http://gdata.youtube.com/schemas/2007#video"
                }
            ],
            "title": {
                "$t": "Uploads by MYUSERNAME",
                "type": "text"
            },
            "logo": {
                "$t": "http://www.youtube.com/img/pic_youtubelogo_123x63.gif"
            },
            "link": [
                {
                    "rel": "related",
                    "type": "application/atom+xml",
                    "href": "http://gdata.youtube.com/feeds/users/myusername"
                },
                {
                    "rel": "alternate",
                    "type": "text/html",
                    "href": "http://www.youtube.com/profile_videos?user=MYUSERNAME"
                },
                {
                    "rel": "http://schemas.google.com/g/2005#feed",
                    "type": "application/atom+xml",
                    "href": "http://gdata.youtube.com/feeds/users/MYUSERNAME/uploads"
                },
                {
                    "rel": "http://schemas.google.com/g/2005#batch",
                    "type": "application/atom+xml",
                    "href": "http://gdata.youtube.com/feeds/users/MYUSERNAME/uploads/batch"
                },
                {
                    "rel": "self",
                    "type": "application/atom+xml",
                    "href": "http://gdata.youtube.com/feeds/users/MYUSERNAME/uploads?alt=json-in-script&start-index=1&max-results=25&format=5"
                }
            ],
            "author": [
                {
                    "name": {
                        "$t": "MYUSERNAME"
                    },
                    "uri": {
                        "$t": "http://gdata.youtube.com/feeds/users/myusername"
                    }
                }
            ],
            "generator": {
                "$t": "YouTube data API",
                "version": "2.1",
                "uri": "http://gdata.youtube.com/"
            },
            "openSearch$totalResults": {
                "$t": 0
            },
            "openSearch$startIndex": {
                "$t": 1
            },
            "openSearch$itemsPerPage": {
                "$t": 25
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm making a simple page using Google Maps API 3. My first. One marker
I would like to count the length of a string with PHP. The string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to render a haml file in a javascript response like so:

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.