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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:05:44+00:00 2026-05-29T18:05:44+00:00

I am a beginner in PHP and am working on a script that can

  • 0

I am a beginner in PHP and am working on a script that can extract Title / Description/ Tags (or keywords) from a Youtube webpage. For example, take any youtube page like http://www.youtube.com/watch?v=yADOdeZTD9c .. it’s HTML code contains

<meta name="keywords" content="nirvana, unplugged, performing, tocando, cantando, come, as, you, are, Come, As, You, Are, nevermind, live, en, vivo, 1992, 1993, acoustic, acustica, complet...">

My code is able to extract keywords from the above line. Relevant part of the code is given below:

            $meta_elements = $pageDOM->getElementsByTagName('meta');
            foreach ($meta_elements as $meta_element) {
                if (strtolower($meta_element->getAttribute('name')) == 'description')
                {
                    $aValues['description'] = $meta_element->getAttribute('content');

                    echo $meta_element->getAttribute('content'); 

                }
            }

I was trying to modify it to extract the Category information but I’m unable to do so since the Category name can not be extracted in way same as Keywords or Description.

I think the part within HTML code of website, from where I can extract the category is this:

Category:
</h4>
    <p id="eow-category"><a href="/music">Music</a></p>

Any suggestions regarding how to extract “Music” (case doesn’t matter) are very much appreciated..

Thank you 🙂

  • 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-29T18:05:49+00:00Added an answer on May 29, 2026 at 6:05 pm

    Why in the world would you scrape pages from YouTube.com when the information you need is available through YouTube Data API. You can get the category information and just about anything in less than one minute. You don’t even need PHP. Just run this example code in console:

    function youtubeDataCallback(json){
        console.log(json);
        alert(json.data.category);
    }
    var s = document.createElement("script");
    s.type = "text/javascript";
    s.src = "http://gdata.youtube.com/feeds/api/videos/yADOdeZTD9c?v=2&alt=jsonc&callback=youtubeDataCallback";
    document.getElementsByTagName("head")[0].appendChild(s);
    

    PHP code is much simpler. You just need 2-3 lines of code.

    Having said that, what does this give you?

    $pageDOM->getElementById("eow-category")->getElementsByTagName("a")->item(0)->nodeValue
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a beginner working on a login script in PHP. This is the form
This is a topic that, as a beginner to PHP and programming, sort of
Beginner help needed :) I am doign an example form a php book which
Over the last year I have moved from a beginner PHP developer to a
I am a beginner in PHP and XML. Can somebody tell me how to
I am a PHP beginner. When going through a PHP script I found: if(preg_match('/(?i)ID=(\d+)/',$input))
Please forgive the extreme-beginner style of coding. I'm working with PHP and JSON strings
Here is the code that I'm working on: login.php: <?php $con = mysql_connect(localhost,root,); mysql_select_db(koro,$con);
I'm working on an assignment in my beginner Javascript class that involves an element
I have executed a php script through GET request ex: http://localhost/example.php?id=9&name=exammple Now the example.php

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.