I want to get the author and text of a YT video’s “highlighted comment” into a Google Sheet.
I did some research and found plenty of help for other metrics, but not this specific feature, and I’m still stuck.
The input is a comment-specific url, example: https://www.youtube.com/watch?v=0EytSWiKrFg&lc=Ugwy-pFoAiA7I02tBnF4AaABAg
The [example] outputs I’m looking for would be:
“aleattorium”
and
“- Why do you have this weird glass? – Ah, survival of the fittest”
In a Google Sheet I tried with IMPORTXML using what I think was the correct XPath like this:
=IMPORTXML($A1,"//*[@id=""content-text""]/span")
But I get the Error “Imported content is empty”.
I’ve also experimented with REGEXEXTRACT, but I’m having trouble identifying the correct query. My process leads me to expect something similar to:
=REGEXEXTRACT(QUERY(FLATTEN(IMPORTDATA($A1)),"where Col1 contains 'content:""'", 0), """(.*)""")
Any solutions are much appreciated.
Harold the Magnificent is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2