Scrape website HTML - VBA (music industry)

viktor4e

New Member
Joined
Jun 30, 2014
Messages
16
Hi everyone,

I am working on a project that requires extracting music industry data from YouTube.
Specifically, I need to extract number of subscribers and number of views data from channels such as this one:
https://www.youtube.com/user/VEVO/about

I tried doing this with the "Get Data-From Web" option in excel, but it does not work as there is no table to be selected.

Ideally, I would like to list a lot of channels in excel, and a macro to loop through each and extract the data
for each channel in the same excel file. I have started on a code, but as I am a beginner, I have not gone very far:

Sub Macro1()
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Top = 0
objIE.Left = 0
objIE.Width = 800
objIE.Height = 600
objIE.Visible = True
objIE.Navigate ("https://www.youtube.com.com")
Do
DoEvents
Loop Until objIE.readystate = 4
End Sub

Any assistance in resolving this matter would be greatly appreciated.
Many thanks in advance.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
It looks like you can extract the data using getElementsByClassName, so try something like:
Code:
MsgBox objIE.document.getElementsByClassName("about-stats")(0)

Please use CODE tags.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top