私は、http://www.momondo.com.cn/が魔法の技術を利用していることに気付きました。 curl
は動作しません。 URLはウェブブラウザでうまく表示されますが、curl
はウェブブラウザのようにすべてのヘッダを追加しても常にタイムアウトを返します。実際のブラウザのヘッダーでもカールをブロックするウェブサイト
私もPythonリクエストとurllib2
を試しましたが、どちらもうまくいきませんでした。
C:\Users\Administrator>curl -v -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36" -H "Connection: Keep-Alive" -H "Accept-Encoding:gzip, deflate, sdch" -H "Cache-Control:no-cache" -H "Upgrade-Insecure-Requests:1" -H "Accept-Language:zh-CN,zh;q=0.8" -H "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
http://www.momondo.com.cn/
* About to connect() to www.momondo.com.cn port 80 (#0)
* Trying 184.50.91.106...
* connected
* Connected to www.momondo.com.cn (184.50.91.106) port 80 (#0)
> GET/HTTP/1.1
> Host: www.momondo.com.cn
> User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36
> Connection: Keep-Alive
> Accept-Encoding:gzip, deflate, sdch
> Cache-Control:no-cache
> Upgrade-Insecure-Requests:1
> Accept-Language:zh-CN,zh;q=0.8
> Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
>
なぜこれが起こりますか?モモンドはどのようにしてcurl
を逃れることができますか?
これは広すぎます。ブラウザ以外のトラフィックを指紋処理する方法はたくさんあります。物をクロールする最善の方法は、ヘッドレスブラウザを使用することです。 –
はい、私はこれを知っています、いくつかのウェブサイトはJavascriptで検出できます。しかし、私はmomondoが実際のブラウザとまったく同じ最初のクエストで検出できることに驚いています。 – redice