我正在从JAMA上的文章中抓取元数据。我已经使用相同代码的细微变化在其他几种健康/医学期刊上完成了相同的任务,并且能够获得我需要的数据。然而,在使用JAMA时,我得到的却是这样的错误消息:"ConnectionResetError: WinError 10054 An existing connection I closed by the remote host“。
通过谷歌搜索错误消息,我怀疑这可能是JAMA试图防止拒绝服务攻击。我不认为这是速率限制,因为我一开始甚至还不能从JAMA检索数据。
作为参考,我在下面粘贴了我的代码。
import requests
import ur
我正试着用BeautifulSoup来抓取晨星财经。由于某些原因,我甚至找不到包含财务数据的表。 我尝试过使用div标签和table标签。两个都不走运。 from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
urls= [
'http://financials.morningstar.com/ratios/r.html?t=AAPL®ion=usa&culture=en-US'
]
for url in urls:
try:
有了下面的代码,我可以从两个网站抓取产品信息。我的目标是将被刮掉的数据写入CSV,其中A列用于类“标签”,B列用于类“值”
有人能帮我达到预期的结果吗?
from bs4 import BeautifulSoup
import requests
import pandas as pd
url_list = ["https://21shares.com/product/abtc", "https://21shares.com/product/aeth/"]
for link in url_list:
r = requests.get(link)
我正在寻找与Python的lxml库等效的Clojure/Java。
我过去曾大量使用它来解析各种html (作为BeautifulSoup的替代品),而且能够使用同样的elementtree api for xml也很棒--真的是一个值得信赖的朋友!有人能推荐一个类似的Java/Clojure库吗?
关于lxml
lxml是一个基于libxml2的xml和html处理库。它可以很好地处理损坏的html页面,因此非常适合屏幕抓取任务。它还实现了xpath,因此ElementTree /html结构被表示为一个树对象,完全支持xpath和CSS选择器等。
它也有一些非常方便的实用功能,比如
我正在尝试抓取这个页面https://ntrs.nasa.gov/search。我使用下面的代码,当有更多的标签时,Beautiful soup只找到了3个标签。我尝试过使用html5lib、lxml和HTML解析器,但它们都不起作用。 你能告诉我有什么问题吗? import requests
import urllib.request
import time
from bs4 import BeautifulSoup
# Set the URL
url = 'https://ntrs.nasa.gov/search'
# Connect to the URL
respo
我正在尝试抓取这里的网站:。使用如下代码:
from bs4 import BeautifulSoup
import urllib.request
html = urllib.request.urlopen("ftp://ftp.sec.gov/edgar/daily-index/")
soup = BeautifulSoup(line, "lxml")
soup.a # or soup.find_all('a') neither of them works
#return None.
请帮帮忙,我真的很沮丧。我怀疑是标签导致了问题。站点的超
我正在用python3.7中的漂亮汤做web抓取。下面的代码成功地抓取了日期、标题、标签,但没有抓取文章的内容。取而代之的是什么也不给。 import time
import requests
from bs4 import BeautifulSoup
from bs4.element import Tag
url = 'https://www.thehindu.com/search/?q=cybersecurity&order=DESC&sort=publishdate&ct=text&page={}'
pages = 32
for page