0
这是我的示例html代码。如何使用xpath解析嵌套的html标记
使用HtmlXpathSelector我需要解析html文件。
DEF解析(个体,响应): edxData = HtmlXpathSelector(响应)
- 第一我需要得到所有包含 edxData.xpath标记('// H2 [@class =“标题课程标题“]')
- 里面的标签我需要检查一个标签值。
- 然后需要使用类名称字幕course-subtitle copy-detail解析div标签。 如何可以解析这个值好心给一些建议
样本HTML响应数据:
遍历内标签<html>
<body>
<h2 class="title course-title">
<a href="https://www.edx.org/course/mitx/mitx-14-73x-challenges-global-poverty-1350">The Challenges of Global Poverty
</a>
</h2>
<div class="subtitle course-subtitle copy-detail">A course for those who are interested in the challenge posed by massive and persistent world poverty.
</div>
</body>
</html>