I would like to know how to extract part of the content of a web page.
I have a workflow to get the Feed and summarize it in ChatGPT.
I am able to get the full text of the body with “Send HTTP reqest”, but I want to extract only the elements in which the div is main.
I did not quite understand the reference.
I consulted with AI and they output the code below, do I just paste this somewhere?
import requests
from lxml import html
response = requests.get("URL")
tree = html.fromstring(response.content)
main_div = tree.xpath('//div[@id="main"]')[0]
print(main_div.text_content())
Can someone tell me if anyone can figure this out?
Hello @Takeru
sorry for the late response, but could you please explain further what you mean by
but I want to extract only the elements in which the div is main
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.