用python3.5和靓汤刮网站。无法访问网站

2024-09-30 02:24:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我想抓取网站http://berlin.startups-list.com/startups/mobile。我需要一份在网站上的名单。我使用Python3.5和BeautifulSoup。在

我已经用这个代码抓取了这个网站https://www.kickstarter.com

Loading Libraries import urllib import urllib.request from bs4 import BeautifulSoup #define URL for scraping theurl1 = "http://berlin.startups-list.com/startups/mobile" thepage1 = urllib.request.urlopen(theurl1) #Cooking the Soup soup1 = BeautifulSoup(thepage1,"html.parser") #------------------------------------------------------------------------------------------------------------------- #Scraping #Scraping "Link" (href) href_Kunst = [i.a['href'] for i in soup1.find_all('div', attrs={'class' : 'project-thumbnail'})] print(href_Kunst)

这个密码有效!在

但是我不能访问http://berlin.startups-list.com/startups/mobile。 没有刮码。。。。我甚至不能打开有urllib和靓汤的网站。在

代码的第一部分显示了以下trackback:

我是否以错误的方式加载网站?有人有什么想法吗? 谢谢你的帮助


Tags: 代码importcomhttpfor网站requesturllib

热门问题