简体   繁体   English

urlfetch.fetch在应用程序引擎中的html脚本标记中缺少内容

[英]urlfetch.fetch got missed content within script tag of html in app engine

in my app, when I use urlfetch.fetch function to fetch a specified url, I found the content I got is empty for some special html codes. 在我的应用程序中,当我使用urlfetch.fetch函数提取指定的url时,我发现对于某些特殊的html代码,我得到的内容为空。

for example, the url: http://www.club.cn.sodexo.com/node/5071 in real html source, the codes including: 例如,实际html源中的URL: http ://www.club.cn.sodexo.com/node/5071,其代码包括:

<div class="content">
<div style="width: 219px; height: 262px;" id="gmap-auto3map-gmap0" class="gmap-control gmap-gmap gmap gmap-map gmap-auto3map-gmap">Javascript is required to view this map.</div>
<script type="text/javascript">
/* <![CDATA[ */
jQuery.extend(true, Drupal, { settings: { "gmap": { "auto3map":{ "width": "219px", "height": "262px", "zoom": 16, "maxzoom": "17","controltype": "Large", "align": "None", "maptype": "Map", "mtc":"none", "baselayers": { "Map": 1, "Satellite": 1, "Hybrid": 1 },"styles": { "line_default": [ "0000ff", "5", "45", "", "" ],"poly_default": [ "000000", "3", "25", "ff0000", "45" ] },"line_colors": [ "#00cc00", "#ff0000", "#0000ff" ], "behavior":{ "autozoom": true }, "markermode": "0", "id": "auto3map", "latitude":"31.239132", "longitude": "121.483506", "markers": [ { "latitude":"31.239132", "longitude": "121.483506", "markername": "small red","offset": 0, "opts": { "title": "克莉丝汀食品(宁波路店)" }, "text": "\x3cdiv class=\"gmap-popup\"\x3e\x3c/div\x3e" } ] } } } });
/* ]]> */
</script>
</div> 

but from what I got through url fetch: the result would be: 但是从我通过url fetch获得的结果是:

<div class="content">
<div style="width: 219px; height: 262px;" id="gmap-auto3map-gmap0" class="gmap-control gmap-gmap gmap gmap-map gmap-auto3map-gmap">Javascript is required view this map.</div>
<script type="text/javascript">
/* <![CDATA[ */
/* ]]> */
</script>

All the javascript codes between /* <![CDATA[ */ and /* ]]> */ is missed, which is so wired. /* <![CDATA[ *//* ]]> */之间的所有JavaScript代码都被遗漏了,因此已进行了连线。 Anyone knows the problem? 有人知道这个问题吗? Is it possible to fix this issue? 是否可以解决此问题?

也许服务器根据用户代理插入了不同的javascript(即Firefox和Internet Explorer的代码不同),对于urlfetch的用户代理,服务器感到困惑,根本不插入任何javascript。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM