I would like to grab data on this news site. http://www.inquirer.net/
I want to grab news titles on the tiles.
Here's the screen shot of the inspected code
As you can see, one of the title of the tile that I want to grab is already there. When I copy the xpath from the browser it returns //*[@id="tgs3_info"]/h2
I tried to run my python code.
import lxml.html
import lxml.etree
import requests
link = 'http://www.inquirer.net/'
res = requests.get(link)
r = res.content
html_content = lxml.html.fromstring(r)
root = html_content.xpath('//*[@id="tgs3_info"]/h2')
print(root)
but it returns an empty list.
I tried to search for an answer here on stackoverflow and in the internet. I don't really get it. When you view the page source of the site. The data that I want is not in the javascript function. It is in the div so I don't understand why I can't grab the data. I hope I could find answer here.