I try to scrape first name + last name of people on this web page (https://www.meleenumerique.com/scientist_comite) using the code below but it doesn't work. How can I determine what's wrong with it?
This is the code I wrote
from lxml import html
import csv,os,json
import requests
url="https://www.meleenumerique.com/scientist_comite"
r=requests.get(url)
t=html.fromstring(r.content)
title=t.xpath('/html/head/title/text()')
#Create the list of speaker
speaker=t.xpath('//span[contains(@class,"speaker-name")]//text()')
print(title)
print("Speakers:",speaker)
You can try with this Requests-HTML library which should let you scrape the content from that page. This library supports xpath and has the ability to take care of dynamic content.
import requests_html
session = requests_html.HTMLSession()
r = session.get('https://www.meleenumerique.com/scientist_comite')
r.html.render(sleep=5, timeout=8)
for item in r.html.xpath("//*[contains(@class,'speaker-name')]"):
print(item.text)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With