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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:52:24+00:00 2026-06-12T07:52:24+00:00

I need to extract the video names from youtube’s index.html. I have been able

  • 0

I need to extract the video names from youtube’s index.html. I have been able to break apart the file into small chunks, each containing one video listing, however I cannot seem to extract the video title. My professor has provided the following command, however I cannot seem to get it to work in this situation.

number=`expr "$s" : ".*\/\([0-9,]*\)\/"`; echo $number # will print 250,4211

Although I’m not completely sure, I think I’m having trouble getting this method to work because there aren’t spaces between the video title and surrounding text. Here is a sample of what I would need to extract the title from:

<li class="video-list-item "><a href="/watch?v=9BbgvlgDQMg&amp;feature=g-sptl&amp;cid=inp-hs-edt" class="video-list-item-link yt-uix-sessionlink" data-sessionlink="ei=CMzmroaB5bICFRiXIQoda3kX5g%3D%3D&amp;feature=g-sptl%26cid%3Dinp-hs-edt" ><span class="ux-thumb-wrap contains-addto "><span class="video-thumb ux-thumb yt-thumb-default-120 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="http://s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Lil&#39; Buck &quot;Golden Gateway&quot; Venice Beach California YAK FILMS Super Bowl 2012 Madonna Memphis Jookin" data-thumb="//i2.ytimg.com/vi/9BbgvlgDQMg/default.jpg" width="120" ><span class="vertical-align"></span></span></span></span><span class="video-time">3:51</span>

Out of this chunk of text, I would need to extract “Lil' Buck "Golden Gateway" Venice Beach California YAK FILMS Super Bowl 2012 Madonna Memphis Jookin“, without the quotes.

  • 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-12T07:52:25+00:00Added an answer on June 12, 2026 at 7:52 am

    You can use the bash regex \<img.*alt=\"([^\"]*)\" to extract the alt text from the img element.

    Example:

    $ cat file
    <li class="video-list-item "><a href="/watch?v=9BbgvlgDQMg&amp;feature=g-sptl&amp;cid=inp-hs-edt" class="video-list-item-link yt-uix-sessionlink" data-sessionlink="ei=CMzmroaB5bICFRiXIQoda3kX5g%3D%3D&amp;feature=g-sptl%26cid%3Dinp-hs-edt" ><span class="ux-thumb-wrap contains-addto "><span class="video-thumb ux-thumb yt-thumb-default-120 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="http://s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Lil&#39; Buck &quot;Golden Gateway&quot; Venice Beach California YAK FILMS Super Bowl 2012 Madonna Memphis Jookin" data-thumb="//i2.ytimg.com/vi/9BbgvlgDQMg/default.jpg" width="120" ><span class="vertical-align"></span></span></span></span><span class="video-time">3:51</span>
    
    $ line="$(cat file)"
    
    $ if [[ "$line" =~ \<img.*alt=\"([^\"]*)\" ]]
    then
      echo "${BASH_REMATCH[1]}"
    fi
    Lil&#39; Buck &quot;Golden Gateway&quot; Venice Beach California YAK FILMS Super Bowl 2012 Madonna Memphis Jookin
    

    Update:

    Using expr:

    $ expr "$line" : '.*<img.*alt=\"\([^\"]*\)\".*'
    Lil&#39; Buck &quot;Golden Gateway&quot; Venice Beach California YAK FILMS Super Bowl 2012 Madonna Memphis Jookin
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to extract a value from a hidden HTML field, have somewhat figured
I need to extract the metadata information from a video file as well as
I need to extract the text from the nodes in an html file and
Need to extract .co.uk urls from a file with lots of entries, some .com
I need to extract images from a FB fan page. I'm able to read
I need to extract an image/thumbnail from a video hosted on some website. For
I need to extract some information from not very complicated HTML pages in web.
I need to extract a single keyframe from a video of a particular human
I need to extract the audio from a FLV file recorded using FMS. I
I need to extract the name of the video from the below xml. Can

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.