问题描述
我是HTML的新手,正在尝试使用beautifulsoup抓取一些Web数据。
我正在从网站上抓取它,并试图提取标题和链接。
value = <a class="AnchorLink News__Item external flex flex-row" href="https://abcnews.go.com/Politics/biden-harris-make-appearance-historic-democratic-ticket/story?id=72327968" name="&lpos=toolkit" tabindex="0" target="_self"><div class="News__Content__Container"><div class="News__Item__Headline">Biden and Harris make 1st joint appearance </div></div></a>
我能够得到这样的标题
value.find('div').get_text()
我想从值中获取链接(href),但不确定在beautifulsoup文档中的具体位置。我知道我可以用正则表达式来做到这一点,但想知道Beautifulsoup是否有一种更简单的方法。
value.find('a')
不返回任何内容!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)