When I tried to scrape using python in-house, [Errno 11001] came out.
Resolved by specifying a proxy.
import requests
from bs4 import BeautifulSoup
proxies = {
'http': 'http://123.45.678.000:0000',
'https': 'http://123.45.678.000:0000',
}
url = 'https://ja.wikipedia.org/wiki/Python'
res = requests.get(url, verify=False, proxies=proxies)
soup = BeautifulSoup(res.text)
soup
<!DOCTYPE html>
<html class="client-nojs" dir="ltr" lang="ja">
<head>
<meta charset="utf-8"/>
<title>Python - Wikipedia</title>
<script>document.documentElement.className="client-js";RLCONF={"wgBreakFrames":!1,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"ja","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","1January","1February"],"wgMonthNamesShort":["","January","February","March","April","May","June","July","August","September","October","1January","1February"],"wgRequestId":"XhwEyQpAICIAABeLnhMAAADL","wgCSPNonce":!1,"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":!1,"wgNamespaceNumber":0,"wgPageName":"Python","wgTitle":"Python","wgCurRevisionId":75653560,"wgRevisionId":75653560,"wgArticleId":993,"wgIsArticle":!0,"wgIsRedirect":!1,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Articles containing invalid sources/2018","Object-oriented language","Scripting language","Open source software","Python","Basic Information Technology Engineer Examination"],"wgPageContentLanguage":"ja","wgPageContentModel":
・ ・ ・
Recommended Posts