from lxml import html 
import requests
site=requests.get('https://e...content-available-to-author-only...a.org/wiki/Hamiltonian_mechanics')
tree=html.fromstring(site.content)
contents=tree.xpath('//*[@id="toc"]/div/h2')
print(contents)

