如何从App Store中选择应用程序的所有链接并提取其HREF?
from bs4 import BeautifulSoup
import requests
from urllib.request import urlopen
url = f'https://www.apple.com/kr/search/youtube?src=globalnav'
response = requests.get(url)
html = response.text
soup = BeautifulSoup(html, 'html.parser')
links = soup.select(".rf-serp-productname-list")
print(links)
我想爬行所显示的应用程序的所有链接。当我搜索关键字时,我以为links = sop.Select(“。rf-serp-productname-list”)
可以使用,但是链接列表为空。
我应该怎么办?
from bs4 import BeautifulSoup
import requests
from urllib.request import urlopen
url = f'https://www.apple.com/kr/search/youtube?src=globalnav'
response = requests.get(url)
html = response.text
soup = BeautifulSoup(html, 'html.parser')
links = soup.select(".rf-serp-productname-list")
print(links)
I want to crawl through all links of shown apps. When I searched for a keyword, I thought links = soup.select(".rf-serp-productname-list")
would work, but links list is empty.
What should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需检查此代码,我认为是您想要的:
来源:
htttts> a>
部分:
您可以更改 我认为检查关键字
Just check this code, I think is what you want:
Source:
https://gist.github.com/AO8/f721b6736c8a4805e99e377e72d3edbf
You can change the part:
To check for a keyword I think
您正在烹饪
汤
,因此首先要品尝一下,然后检查您期望的一切是否包含在其中。作为响应,您的预期工具的预期有点有所不同。
要获取链接列表,请选择更具体的选择:
输出:
You are cooking a
soup
so first at all taste it and check if everything you expect contains in it.ResultSet
of your selection is empty cause structure in response differs a bit from your expected one from the developer tools.To get the list of links select more specific:
Output: