python - 为什么通过 url 循环获取页面源只能获取 url 页面源的一半?Python
问题描述
我正在尝试为某些公司名称抓取一些公共 LinkedIn 数据。linkedin_list_of_urls 是我从 google 上抓取的 LinkedIn URL 列表(其中有 96 个)。当我尝试将页面源放入列表 source_code_lists 时,它只返回 46 个页面源。这是正常的吗?此外,我对编码非常陌生,因此非常感谢任何改进代码的提示。
source_code_lists = []
for linkedin_list_of_url in linkedin_list_of_urls:
driver.get(linkedin_list_of_url)
sleep(2.5)
about_in_button = driver.find_element_by_link_text("About")
about_in_button.click()
sleep(1.0)
sel = Selector(text=driver.page_source)
sleep(1.0)
source_code_lists.append(sel)
driver.quit()
len(linkedin_list_of_urls)
len(source_code_lists)
len(linkedin_list_of_urls) = 92
len(source_code_lists) = 46
我怎么得到len(source_code_lists) = 92
?
解决方案
推荐阅读
- javascript - innerHTML img Memory Leak
- python - Pivoting of dataframe by year and month
- html - How to add colors on the corner of card CSS?
- jquery - Change or Delete text inside data-reactid child
- proxy - 使用 socat 将流量转储到 pcap
- javascript - Node.JS 异步:检查变量是否已更改
- arrays - Googlefinance - 返回高价和日期
- kotlin - 是否可以抑制特定目录中的警告?
- angular - 如何在 Angular 子类中注入依赖项?
- r - 在 RStudio 中显示演示幻灯片