我正在尝试抓取这里的网站:。使用如下代码:
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.
请帮帮忙,我真的很沮丧。我怀疑是标签导致了问题。站点的超
我一直在尝试从雅虎财经中抓取数据,但每次尝试都会得到以下错误:
Traceback (most recent call last):
File "C:\Users\nnarn\PycharmProjects\papaproject\main.py", line 15, in <module>
print(str(parsePrice()))
File "C:\Users\nnarn\PycharmProjects\papaproject\main.py", line 8, in parsePrice
soup=bs
我有一个来自供应商的插件,我只能将它包含在我的网站中,如下所示:
<p>my content</p>
<script type="text/javascript" src="http://widgeturl"></script>
<script type='text/javascript'>
showWidget();
</script>
<!--widget inserts lots of HTML here -->
<p>more of
我在Python语言中使用BeautifulSoup,在替换一些标签时遇到了问题。我正在查找<div>标签并检查孩子。如果这些子节点没有子节点(是NODE_TYPE =3的文本节点),我会将它们复制为<p>。
from BeautifulSoup import Tag, BeautifulSoup
class bar:
self.soup = BeautifulSoup(self.input)
foo()
def foo(self):
elements = soup.findAll(True)
for node in elements:
我正在制作我的第一个网络爬虫,它应该从bloomberg.com返回标准普尔500指数,但是当我试图运行它时,我得到了这个错误消息: AttributeError:'NoneType‘对象没有属性'text’。 我用作参考的代码(来自https://www.freecodecamp.org/news/how-to-scrape-websites-with-python-and-beautifulsoup-5946935d93fe/)使用了urllib2,我了解到它已经被拆分到多个库中。所以我不确定这是否是问题所在? from urllib.request import u
我试图从另一个站点上抓取一些内容,但我不确定为什么BeautifulSoup会产生这样的输出。它只在匹配中找到一个空格,但真正的HTML包含大量标记。如果这是我的愚蠢之处,我道歉。我是python的新手。
下面是我的代码:
import sys
import os
import mechanize
import re
from BeautifulSoup import BeautifulSoup
def scrape_trails(BASE_URL, data):
#Get the trail names
soup = BeautifulSoup(data)
site
我试图抓取一堆位于只能通过局域网访问的URL中的SQL脚本,然后用Python执行这些SQL脚本,但我意识到在同样的抓取SQL的请求中,我也抓取了一些SQLite,这阻碍了我的Python SQLite命令的执行。因此,我无法创建数据库。
下面是执行该请求的源代码片段:
import requests
builds_range = range(1300, 1351)
print 'Getting data from the following URLs:'
for build in builds_range:
database_url = r'''