不理解此“ Webscraping错误65无法路由到主机”消息

时间:2018-10-15 14:15:26

标签: python web-scraping routes host

使用此代码,我收到此错误“ 65没有通往主机的路由”:

import requests
from bs4 import BeautifulSoup as soup
def get_emails(_links:list):

for i in range(len(_links)):
 new_d = soup(requests.get(_links[i]).text, 'html.parser').find_all('a', {'class':'my_modal_open'})
 if new_d:
   yield new_d[-1]['title']

start = 0
count=0
while True:
d = soup(requests.get('http://www.schulliste.eu/type/gymnasien/?bundesland=&start={page_id}'.format(page_id=start)).text, 'html.parser')
results = [i['href'] for i in d.find_all('a')][52:-9]
results = [link for link in results if link.startswith('http://')]

items = list(set(get_emails(results)))
for item in items:
    count=+1
    print(item, end = ",")

#print(list(get_emails(results)))


next_page=d.find('div', {'class': 'paging'},'weiter')

if next_page:

    start+=20
    if start == 2440:
        print ("Fertig")
else:
    break
    print("Break")
print(count)

有人知道我为什么会收到此错误的线索吗?我想从网站上删除电子邮件地址。

0 个答案:

没有答案