it doesn't return complete result when use requests.get websites' titles. code:
import requests url="http://114.54.23.46" res=requests.get(url) print res.content
result:
'\n\n<!doctype html>\n<meta name="description" content="\xe5\xb0\x8f\xe7\xb1\xb3\xe5\xb8\x90\xe5\x8f\xb7\xe8\x83\xbd\xe4\xbd\xbf\xe7\x94\xa8\xe5\xb0\x8f\xe7\xb1\xb3\xe6\x89\x8b\xe6\x9c\xba\xef\xbc\x8cmiui\xef\xbc\x8c\xe5\xb0\x8f\xe7\xb1\xb3\xe4\xba\x91\xef\xbc\x8c\xe5\xa4\x9a\xe7\x9c\x8b\xe9\x98\x85\xe8\xaf\xbb\xef\xbc\x8c\xe7\xb1\xb3\xe8\x81\x8a\xef\xbc\x8c\xe5\xb0\x8f\xe7\xb1\xb3\xe7\xa4\xbe\xe5\x8c\xba\xe7\xad\x89\xe5\xb0\x8f\xe7\xb1\xb3\xe6\x9c\x8d\xe5\x8a\xa1\xe3\x80\x82" />\n<meta name="keywords" content="\xe5\xb0\x8f\xe7\xb1\xb3\xe5\xb8\x90\xe5\x8f\xb7\xef\xbc\x8c\xe5\xb0\x8f\xe7\xb1\xb3\xe8\xb4\xa6\xe5\x8f\xb7\xef\xbc\x8c\xe5\xb0\x8f\xe7\xb1\xb3\xe6\xb3\xa8\xe5\x86\x8c\xef\xbc\x8c\xe6\xb3\xa8\xe5\x86\x8c\xef\xbc\x8cmi account\xef\xbc\x8csign in\xef\xbc\x8c\xe5\xb0\x8f\xe7\xb1\xb3\xef\xbc\x8c\xe5\xb8\x90\xe5\x8f\xb7\xef\xbc\x8c\xe8\xb4\xa6\xe5\x8f\xb7\xef\xbc\x8c\xe5\xb0\x8f\xe7\xb1\xb3\xe5\xb8\x90\xe6\x88\xb7\xef\xbc\x8c\xe7\x99\xbb\xe5\xbd\x95\xef\xbc\x8c\xe7\x99\xbb\xe9\x99\x86\xef\xbc\x8c\xe5\xae\x89\xe5\x85\xa8\xe4\xbb\xa4\xe7\x89\x8c\xef\xbc\x8c\xe5\x8a\xa8\xe6\x80\x81\xe5\x8f\xa3\xe4\xbb\xa4\xef\xbc\x8c\xe5\xb0\x8f\xe7\xb1\xb3\xe6\xb3\xa8\xe5\x86\x8c\xef\xbc\x8c\xe6\x89\xbe\xe5\x9b\x9e\xe5\xaf\x86\xe7\xa0\x81" />\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n\n\n\n\n \n \n \n \n \n \n \n \n \n \n\n \n\n <script>\nvar lang=(function(){\n var locale=("zh_cn").tolowercase();\n if(locale){\n if(locale.indexof("en")>-1){\n return {data:"en",cls:"en"};\n }else if(locale.indexof("zh")>-1){\n if(locale.indexof("cn")===-1){\n return {data:"tw",cls:"zh_tw"};\n }else{\n return {data:"cn",cls:"zh_cn"};\n }\n }\n }\n return {data:"en",cls:"en"};\n})();\n</script>\n\n <script>\nvar _d_={};\nvar _t_={\n staturl:\'https://data.mistat.xiaomi.com/mistats\',\n appid:"2882303761517246742",\n appkey:"5621724658742",\n jspcomplete:(new date()).gettime(),\n supportlocalstorage:!!window.localstorage,\n samplingbase:100,\n samplingrate:5\n};\nif(window.performance){\n var timing=performance.timing;\n if(!timing.responseend){\n timing.responseend=timing.responsestart;\n }\n _d_.startts=timing.fetchstart\n _d_.endts=timing.responseend;\n}else{\n _d_.startts=_d_.endts=(new date()).gettime();\n}\nvar jsp_var={\n devicetype:\'pc\',\n datacenter:\'hh\',\n locale:"zh_cn",\n region:"cn",\n callback:"http://vip.miliao.com/sts?sign=ox%2brnfcklhtx9dnnvktkm%2f7leso%3d&followup=http%3a%2f%2f114.54.23.46%2f",\n sid:"vip.miliao.com",\n qs:"%3fcallback%3dhttp%253a%252f%252fvip.miliao.com%252fsts%253fsign%253dox%25252brnfcklhtx9dnnvktkm%25252f7leso%25253d%2526followup%253dhttp%25253a%25252f%25252f114.54.23.46%25252f%26sid%3dvip.miliao.com",\n hidden:"",\n "_sign":"2im3enazlcyblxzg7bueccx0ulu=",\n serviceparam :\'{"checksafephone":false}\',\n privacylink:\'http://www.miui.com/res/doc/privacy/cn.html\'\n};\nvar page_var={\n form_cache:false,\n cache_key:(jsp_var.devicetype!=="mobile" ? "/static/res/1a91f87/account-static/html/login/dist/v2/login-cn.html" : "/static/res/1a91f87/account-static/html/login/dist/v2/login-wap-cn.html")\n};\nif(location.search.indexof("_debugmode")>-1){\n window.localstorage && window.localstorage.removeitem(page_var.cache_key);\n}\n(function(){\n function getlocal(url){\n if(window.localstorage){\n var data=localstorage.getitem(url);\n return data;\n }\n return null;\n }\n function setlocal(url,data){\n if(window.localstorage && data){\n try{\n localstorage.setitem(url,data);\n }catch(e){}\n }\n }\n function getcontent(url){\n var xhr= new (window.xmlhttprequest || window.activexobject)("microsoft.xmlhttp");\n xhr.onreadystatechange = function() {\n if (xhr.readystate == 4 && xhr.status == 200) {\n setlocal(url,xhr.responsetext);\n _t_.htmlgetend=(new date()).gettime();\n document.write(xhr.responsetext);\n document.close();\n }\n };\n xhr.open("get",url,false);\n xhr.send();\n }\n var cache_key=page_var.cache_key;\n _t_.version=cache_key;\n var html=getlocal(cache_key);\n if(html){\n _t_.htmlcache=true;\n page_var.form_cache=true;\n document.write(html);\n document.close();\n }else{\n _t_.htmlcache=false;\n _t_.htmlgetstart=(new date()).gettime();\n getcontent(cache_key);\n }\n})();\n</script>\n'
but when use browser visit website, source code longer result. why , how can fix problem? thanks!
Comments
Post a Comment