Python中文
首页
教程
问答
标签
搜索
登录
注册
漂亮的汤找到()并没有找到所有的结果的类
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我有一些代码试图在tracklist容器中提取所有html内容,它应该有88首歌曲。信息肯定在那里(我打印了汤来检查),所以我不确定为什么前30<code>react-contextmenu-wrapper</code>之后的所有东西都丢失了。你知道吗</p> <pre><code>from bs4 import BeautifulSoup from urllib.request import urlopen import re spotify = 'https://open.spotify.com/playlist/3vSFv2hZICtgyBYYK6zqrP' html = urlopen(spotify) soup = BeautifulSoup(html, "html5lib") main = soup.find(class_ = 'tracklist-container') print(main) </code></pre> <p>谢谢你的帮助。 打印输出电流如下:</p> <pre><code> 1. </div></div><div class="tracklist-col name"><div class="top-align track-name-wrapper"><span class="track-name" dir="auto">Move On - Teen Daze Remix</span><span class="artists-albums"><a href="/artist/3HrczLBDJXJu6dJWEMbKHa" tabindex="-1"><span dir="auto">Garden City Movement</span></a> • <a href="/album/4p8FxnuYzykCcN7xbjA9jq" tabindex="-1"><span dir="auto">Entertainment</span></a></span></div></div><div class="tracklist-col explicit"></div><div class="tracklist-col duration"><div class="top-align"><span class="total-duration">5:11</span><span class="preview-duration">0:30</span></div></div><div class="progress-bar-outer"><div class="progress-bar"></div></div></li><li class="tracklist-row js-track-row tracklist-row--track track-has-preview" data-position="2" role="button" tabindex="0"><div class="tracklist-col position-outer"><div class="play-pause top-align"><svg aria-label="Play" class="svg-play" role="button"><use xlink:href="#icon-play" xmlns:xlink="http://www.w3.org/1999/xlink"></use></svg><svg aria-label="Pause" class="svg-pause" role="button"><use xlink:href="#icon-pause" xmlns:xlink="http://www.w3.org/1999/xlink"></use></svg></div><div class="tracklist-col__track-number position top-align"> 2. </div></div><div class="tracklist-col name"><div class="top-align track-name-wrapper"><span class="track-name" dir="auto">Flicker</span><span class="artists-albums"><a href="/artist/4qpWUfUAeI34HzvCORn1ze" tabindex="-1"><span dir="auto">Forhill</span></a> • <a href="/album/0gfz1Tbst40swwL357cRqG" tabindex="-1"><span dir="auto">Flicker</span></a></span></div></div><div class="tracklist-col explicit"></div><div class="tracklist-col duration"><div class="top-align"><span class="total-duration">3:45</span><span class="preview-duration">0:30</span></div></div><div class="progress-bar-outer"><div class="progress-bar"></div></div></li><li class="tracklist-row js-track-row tracklist-row--track track-has-preview" data-position="3" role="button" tabindex="0"><div class="tracklist-col position-outer"><div class="play-pause top-align"><svg aria-label="Play" class="svg-play" role="button"><use xlink:href="#icon-play" xmlns:xlink="http://www.w3.org/1999/xlink"></use></svg><svg aria-label="Pause" class="svg-pause" role="button"><use xlink:href="#icon-pause" xmlns:xlink="http://www.w3.org/1999/xlink"></use></svg></div><div class="tracklist-col__track-number position top-align"> </code></pre> <p>。。。你知道吗</p> <pre><code> 30. </div></div><div class="tracklist-col name"><div class="top-align track-name-wrapper"><span class="track-name" dir="auto">Trapdoor</span><span class="artists-albums"><a href="/artist/3nqTFzjmi1LLM6pn0TRMv8" tabindex="-1"><span dir="auto">Eagle Eyed Tiger</span></a> • <a href="/album/48Q8Jgk1x4wiHWecV4nlz6" tabindex="-1"><span dir="auto">Future or Past</span></a></span></div></div><div class="tracklist-col explicit"></div><div class="tracklist-col duration"><div class="top-align"><span class="total-duration">4:14</span><span class="preview-duration">0:30</span></div></div><div class="progress-bar-outer"><div class="progress-bar"></div></div></li></ol><button class="link js-action-button" data-track-type="view-all-button">View all on Spotify</button></div> </code></pre> <p>最后一项应该是第88项。感觉我的搜索结果被截短了。你知道吗</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>因为你在做</p> <pre><code>main = soup.find(class_ = 'tracklist-container') </code></pre> <p>类“tracklist container”只包含这30项, 我不知道你想做什么,但如果你想的话 什么是事后尝试事后解析类。你知道吗</p> <p>换句话说,该类包含30首歌曲,我访问了该网站,发现了30首歌曲,所以它可能只适用于登录用户。你知道吗</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
jupyter运行一个旧的pytorch版本
10 回答
Jupyter运行不同版本的卸载库?
10 回答
Jupyter运行指定的键盘快捷键
10 回答
Jupyter通过.local文件“逃逸”virtualenv。我该如何缓解这种情况?
9 回答
Jupyter重新加载自定义样式
9 回答
Jupyter错误:“没有名为Jupyter_core.paths的模块”
7 回答
jupyter错误:无法在随机林中将决策树视为png
4 回答
Jupyter错误'内核似乎已经死亡,它将自动重新启动'为一个给定的代码块
4 回答
Jupyter错误地用阿拉伯语和字母数字元素显示Python列表
4 回答
Jupyter隐藏数据帧索引,但保留原始样式
9 回答
Jupyter集线器:启动器中出现致命错误。。。系统找不到指定的文件
5 回答
Jupyther中相同值的相同哈希,但导出到Bigquery时不相同
5 回答
Jupy上Python的读/写访问问题
4 回答
jupy上没有模块cv
8 回答
Jupy上的排序错误
5 回答
Jupy中bqplot图形的紧凑布局
3 回答
Jupy中matplotlib plot的连续更新
1 回答
Jupy中Numpy函数的文档
9 回答
Jupy中Pandas的自动完成问题
5 回答
jupy中Qt后端的Matplotlib动画
7 回答