Quand j'ai essayé de gratter en utilisant python en interne, j'ai eu [Errno 11001].
Résolu en spécifiant un 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":["","janvier","février","Mars","avril","Peut","juin","juillet","août","septembre","octobre","1janvier","1février"],"wgMonthNamesShort":["","janvier","février","Mars","avril","Peut","juin","juillet","août","septembre","octobre","1janvier","1février"],"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 contenant des sources non valides/2018","Langage orienté objet","Langage de script","Logiciels open source","Python","Examen d'ingénieur d'information de base"],"wgPageContentLanguage":"ja","wgPageContentModel":
・ ・ ・
Recommended Posts