Google-sheets – How toMPORTXML YouTube video count to Google Sheets

google sheetsimportxmlyoutube

I'm doing a Google Sheets training video on using XPATH and IMPORTXML on YouTube but YouTube seems to have updated their site and now the import option won't work for extracting total video views.

Does anyone how to do this?

The closest I got is:

=IMPORTXML("https://www.youtube.com/channel/UC8p19gUXJYTsUPEpusHgteQ/videos","//div[@class='style-scope.ytd-grid-video-renderer']/span/text")'

Best Answer

Maybe:

=+importxml("https://www.youtube.com/channel/UC8p19gUXJYTsUPEpusHgteQ","//*[contains (@class, 'view-count')]")

If you want the number only (say for further processing):

=--REGEXEXTRACT(+importxml("https://www.youtube.com/channel/UC8p19gUXJYTsUPEpusHgteQ","//*[@class='view-count']"),"[\d|,]+") 
Related Topic