[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 962
  • Last Modified:

Extract Video ID from Youtube

Hi Experts

I need to extract the Video ID's from my youtube account, which has some 120+ videos. I want to write a small program which extracts the IDs of all the videos that are uploaded into my account. I should be able to extract the IDs even if the video count increases to few 100s.

I want to write this in Visual Basic / VB.Net. I will be interested in any other possible ways too.

Thanks in advance.

0
sktsmd
Asked:
sktsmd
  • 10
  • 5
1 Solution
 
sktsmdAuthor Commented:
Hey Experts

Are you people even listening???

I am sorry but i couldn't get any response to my questions for the second time now.

Hi EVERYBODY - Please advise me if my question is not well formed.

Mr. ADMINISTRATOR - Can you please let me know if my question is being confused with any illegal or immoral activity???

Anybody and Everybody is welcome to suggest me regarding this....

Thanks
0
 
jake072Commented:
I am not a member and don't use YouTube, but I can give you a basic example...

Dim req As WebRequest = WebRequest.Create("http://www.youtube.com/somewhere") ' <- Don't know your link...
Dim resp As WebResponse = req.GetResponse()

Dim s As Stream = resp.GetResponseStream()
Dim sr As StreamReader = New StreamReader(s, Encoding.ASCII)
Dim doc As String = sr.ReadToEnd()

You then parse doc with a recursive function using IndexOf and .SubString to rip your desired video id...

Jake
0
 
sktsmdAuthor Commented:
Hi jake072

Thanks for your efforts.

I have a question though, for instace - if there are 100 videos in my account, the first page will display only 25 videos. Then you will fill links to the rest of the pages with the videos.

So, i guess by implementing your procedure i will be getting the IDs for the first 25. Please help me with more suggestions like, if i need to get all the 100 IDs.

Thanks very much in advance.



0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
sktsmdAuthor Commented:
jake072

I am sorry, there is a typo in my comment -

I have a question though, for instace - if there are 100 videos in my account, the first page will display only 25 videos. Then you will FILL links to the rest of the pages with the videos.

I have a question though, for instance - if there are 100 videos in my account, the first page will display only 25 videos. Then you will FIND links to the rest of the pages with the videos.

0
 
jake072Commented:
sktsmd,

Using the same logic of parsing for the video Ids, you will need to do a final .indexof & .substring to remove a url for the next page, and then recurse your routine for that page...  So for the start of your function, you should accept a url to parse, then at the end of finding video ids, you try and find a link to page x, then call your function again with that url until you don't find a "next" url...

If you need more help let me know.

Jake
0
 
sktsmdAuthor Commented:
Hi Jake072

Firstly, my apologies for taking this much time to even respond. I had been out of town.

Just the other day i started working on this and i have made it till parsing the video id's as per your suggestion. But for the first set of 20 ids (first page). There are 4 more links to pages of videos.

The problem i am facing now is, i found that the navigation to the next page is a javascript function - see code attached.

Could you be kind enough to guide me in resolving this...

Is it possible to execute a javascript code through HTTPWebrequest (Sorry for this dumb question - am a noooob).

If so, how? If not, how else is it possible to go to the next page to parse the video ids.

You are the only person who has responded and obviously i will be accepting your solution. I don't know if i could converse with you if i accept it now. I mean will this question by live?

Expecting your guidance!!!

Thanks





<a href="#" onclick=" get_page('user_videos-11111111', 20, 20, 'True', 'p'); return false">2</a>
&nbsp;
<a href="#" onclick=" get_page('user_videos-11111111', 40, 20, 'True', 'p'); return false">3</a>
&nbsp;
<a href="#" onclick=" get_page('user_videos-11111111', 60, 20, 'True', 'p'); return false">4</a>
&nbsp;
<a href="#" onclick=" get_page('user_videos-11111111', 80, 20, 'True', 'p'); return false">5</a>
&nbsp;
&nbsp;<a href="#" onclick=" get_page('user_videos-11111111', 20, 20, 'True', 'p'); return false">Next</a>

Open in new window

0
 
sktsmdAuthor Commented:
HI jake072

I want to accept your solution, thinking that you will receive a mail from EE (not sure). And hope you to revert back with some suggestion with regard to my last query.

Waiting to hear from you Jake072.

Thanks a lot.
0
 
sktsmdAuthor Commented:
hi jake072... i have accepted your solution and hope to hear from you regarding a small clarification that is not working. Please do revert back, if possible. Check my last query...
0
 
jake072Commented:
sktsmd,

I have been trying to sort out the code...  Don't have much time today, so I can't dig too deep, however, there should be a javascript file referenced, something like:

http://s.ytimg.com/yt/js/channel_all-vfl66225.js

In that file, there is the get_page function.  Further examining for the functions called from that function might lead you...

If I have time tonight I will see if I can do some more work for you.

Jake
0
 
sktsmdAuthor Commented:
Bunches of thanks to you Jake...
0
 
jake072Commented:
sktsmd,

I have just had a set back at work and need to do a log of extra coding, so I don't have time at the moment to try and analyze that javascript for you.

Sorry,

Jake

P.S.  You might play around with downloading the code and modifying it slightly by changing the values in the get_part you can include the number of entries to fetch...  You might be able to download the page, modify it and then send the modified request...
0
 
sktsmdAuthor Commented:
Jake072

You don't have to feel sorry about that.

Here, I have just got this done 100% working and was about to post it here for you. I used the Google Data API and its working like charm. You can check the code snippet. This works for all the videos in the account irrespective of the count.

Thanks a lot for all the support till here. Let me know if the points have got assigned to you. I am not aware of the whole concepts here at EE. Just let me know if it has not reached you and what should i do to make it reach you.

Thanks again!!!!

Dim service As GBaseService = New GBaseService(AppName, DeveloperKey)
        Dim query As GBaseQuery = New GBaseQuery("http://gdata.youtube.com/feeds/api/users/THEUSERNAMEGOESHERE/uploads")
        Dim feed As GBaseFeed = service.Query(query)
        Dim goOn As Boolean
        goOn = True
 
 
        While goOn
            For Each entry As GBaseEntry In feed.Entries
                Debug.Print(entry.Id.Uri.ToString)
            Next
            Application.DoEvents()
 
            If feed.NextChunk() Is Nothing Then
                goOn = False
            Else
                query.Uri = New Uri(feed.NextChunk())
                feed = service.Query(query)
            End If
 
        End While
        MsgBox("Done")

Open in new window

0
 
sktsmdAuthor Commented:
Also, If you could help me with my next question here.... Adding Album Cover To MP3 - VB.NET
0
 
jake072Commented:
sktsmd,

It look good to me.  The question has not been closed yet, and you assign points there.  I didn't know there was an API, so good for you!

As for your next question, could you include a link to make it easy?

Thanks, and well done,

Jake
0
 
sktsmdAuthor Commented:
Hi Jake072

The status for this question is shown as PAQ. I have accepted your solution long back. I think i am missing out something here with regard to accepting and assigning points. All my 6 questions show the same status, should check HELP or let me know how should i do this.

As regards the next question, find it here -

http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q-23960567-ADDING-ALBUM-COVER-TO-MP3-ID3V2-VB-NET.html

Thanks for all your efforts, jake072




0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 10
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now