【发布时间】:2020-06-26 12:01:01
【问题描述】:
我需要站点地图中的提取链接 https://wunder.com.tr/sitemap.xml
我写了一些代码
import requests
from bs4 import BeautifulSoup
wunder = requests.get("https://wunder.com.tr/sitemap.xml")
parcala = BeautifulSoup(wunder.content,"lxml")
links = parcala.find_all("html-tag")
print(links)
但无法提取。
【问题讨论】:
-
试试这个,
[x.text for x in parcala.find_all("loc")] -
那只是因为没有名为
html-tag的元素。尝试简单的html,您将获得整个 html。你能具体告诉我你想从这个网站上提取什么吗?
标签: python python-3.x beautifulsoup request