2017-05-19 12 views
0

curl을 사용하여 위키 피 디아와 위키 인용과 같은 위키 미디어 사이트의 컨텐츠를 다운로드 할 수 없습니다. 내가하려고하면WikiMedia 사이트에서 '컬 (curl)'문제

내가 얻을 :

~$ /usr/bin/curl -v "http://en.wikipedia.org/wiki/Celsius" 
* Trying 2620:0:863:ed1a::1... 
* TCP_NODELAY set 
* Connected to en.wikipedia.org (2620:0:863:ed1a::1) port 80 (#0) 
> GET /wiki/Celsius HTTP/1.1 
> Host: en.wikipedia.org 
> User-Agent: curl/7.52.1 
> Accept: */* 
> 
< HTTP/1.1 301 Moved Permanently 
< Date: Fri, 19 May 2017 22:09:49 GMT 
< Server: Varnish 
< X-Varnish: 350654144 
< X-Cache: cp4017 int 
< X-Cache-Status: int 
< Set-Cookie: WMF-Last-Access=19-May-2017;Path=/;HttpOnly;secure;Expires=Tue, 20 Jun 2017 12:00:00 GMT 
< Set-Cookie: WMF-Last-Access-Global=19-May-2017;Path=/;Domain=.wikipedia.org;HttpOnly;secure;Expires=Tue, 20 Jun 2017 12:00:00 GMT 
< X-Client-IP: 2605:a601:1127:7d00:35a2:5040:e002:9949 
< Location: https://en.wikipedia.org/wiki/Celsius 
< Content-Length: 0 
< Connection: keep-alive 
< 
* Curl_http_done: called premature == 0 
* Connection #0 to host en.wikipedia.org left intact 

없이 실제 내용. 같은 URL은 wget으로 잘 다운로드됩니다. curl으로 다른 웹 사이트를 다운로드 할 수도 있습니다. curl과 WikiMedia 사이트 (위키 백과, 위키 인용, ...)의 조합이 그 원인입니다.

나는 Ununtu-MATE 17.04를 사용하고 있습니다. 내 컬 버전은 다음과 같습니다.

/usr/bin/curl --version 
curl 7.52.1 (x86_64-pc-linux-gnu) libcurl/7.52.1 OpenSSL/1.0.2g zlib/1.2.11 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) librtmp/2.3 
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy PSL 

어떤 아이디어가 문제 일 수 있습니까?

+0

위키 피 디아는 [거의 2 년 전] (https : //blog.wikimedia.o rg/2015/06/12/securing-wikimedia-sites-with-https /)를 참조하십시오. – Tgr

답변

1

크롬에서는 다른 브라우저에서 요청을 컬링 할 수 있습니다.

개발자 도구를 시작하고 페이지를 새로 고침하고 네트워크 탭의 첫 번째 링크를 마우스 오른쪽 버튼으로 클릭하십시오. 마우스 오른쪽 버튼을 클릭하고 "복사"를 클릭 한 다음 "컬링으로 복사"를 클릭하십시오. 작동

예 :

curl 'https://en.wikipedia.org/wiki/Celsius' -H 'pragma: no-cache' -H 'dnt: 1' -H 'accept-encoding: gzip, deflate, sdch, br' -H 'accept-language: en-US,en;q=0.8,ro;q=0.6,la;q=0.4' -H 'upgrade-insecure-requests: 1' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/531.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/511.36' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'cache-control: no-cache' -H 'authority: en.wikipedia.org' -H 'WMF-Last-Access=19-May-2017; WMF-Last-Access-Global=19-May-2017' --compressed 

컬 버전 : 작동하지 않는 명령 (당신은 또한을 알 수 있습니다 컬이 리디렉션을 따르도록 지시 할 필요가 있다는 이유

curl 7.51.0 

이유 302에서 제공 한 샘플) :

curl -L http://en.wikipedia.org/wiki/Celsius 
+0

고마워요! 그건 나에게도 효과가있다. 나는 왜 그것이 작동하는지 & 간단한 컬 호출이 잘 모르겠다. 간단한 컬 호출이 효과가 있습니까? –

+0

예를 들어, 옵션으로 -v를 추가하는 동안 해당 컬 요청을 내릴 것으로 생각하지 않는다고 생각합니다. – adelineu

+0

@DanielMahler 작은 통찰력을 제공하는 내 대답에 하나의 작은 조정을했습니다. – adelineu