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 910721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:05:16+00:00 2026-05-15T17:05:16+00:00

Basically, dealing with an XML feed that’s not written in the nicest way (Youtube

  • 0

Basically, dealing with an XML feed that’s not written in the nicest way (Youtube API data), and follows on from a previous question on the topic.

Currently, there are four nodes in the file named media:thumbnail. Each media.thumbnail node has various attributes, one of which is url. I am only wanting to retrieve value of the first occurrence of the url attribute (the result being http://i.ytimg.com/vi/CQP_AuT4zXQ/2.jpg).

Example;

<item>
...
<media:group>
...
    <media:thumbnail url='http://i.ytimg.com/vi/CQP_AuT4zXQ/2.jpg' height='90' width='120' time='00:04:53.500'/>
    <media:thumbnail url='http://i.ytimg.com/vi/CQP_AuT4zXQ/1.jpg' height='90' width='120' time='00:02:26.750'/>
    <media:thumbnail url='http://i.ytimg.com/vi/CQP_AuT4zXQ/3.jpg' height='90' width='120' time='00:07:20.250'/>
    <media:thumbnail url='http://i.ytimg.com/vi/CQP_AuT4zXQ/0.jpg' height='240' width='320' time='00:04:53.500'/>
...
</media:group>
...
</item>

My knowledge of jQuery is still developing, and I’ve been able to retrieve the values of the url attribute for all occurrences of media:thumbnail using the following code:

$(this).find("[nodeName=media:thumbnail]").each(function()
      {
        $("#output").append("<img src=\"" + $(this).attr("url") + "\">\n");
      });

How do I now limit this so I only grab the value of url for the first occurrence of media:thumbnail?

  • 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-15T17:05:16+00:00Added an answer on May 15, 2026 at 5:05 pm
    var elt = $(this).find("[nodeName=media:thumbnail]").first()
    

    See also:

    http://api.jquery.com/first/

    EDIT

    Here’s an example that does exactly what you need (but with HTML instead of XML)

    http://jsbin.com/ecuku4/2/edit

    Cheers!

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

Sidebar

Related Questions

I am dealing with large amounts of scientific data that are stored in tab
Basically the issue I'm dealing with right now is where propertyID that starts at
I am dealing with some HTML text that I basically have read access to.
I'm dealing with some legacy code that stores its data in a proprietary string
Basically, I'm dealing with a horribly set up table that I'd love to rebuild,
Basically, I'm creating a log in system. When I am dealing with the data
Basically I have some variables that I don't want to preinitialize: originalTime = None
basically i have (state, state code) pairs, that are subsets of country [USA] ->
Basically what I need to do is write a function that takes in a
Ok, so basically I have a jspf template file with a backing FragmentBean that

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.