html
html copied to clipboard
getElementsByTagName doesn't work on some sites
I'm scraping a website to get the title and description and other meta data, but it's not working on all sites.
for example: https://www.youtube.com/watch?v=3AIZAGwMRg8
final List<Element> elements = document.head.getElementsByTagName('title');
elements returns []
But other sites work just fine, like https://apple.com
I'm also using:
final List<Element> metas = document.head.getElementsByTagName('meta');
And on that site, I'm not seeing all the meta tags