Py学习  »  Python

数据分析硬核技能:用 Python 爬取网页

优达学城Udacity • 6 年前 • 664 次点击  

我作为数据科学家的第一个任务,就是做网页爬取。那时候,我对使用代码从网站上获取数据这项技术完全一无所知,它偏偏又是最有逻辑性并且最容易获得的数据来源。在几次尝试之后,网页爬取对我来说就几乎是种本能行为了。如今,它更成为了我几乎每天都要用到的少数几个技术之一。

在今天的文章中,我将会用几个简单的例子,向大家展示如何爬取一个网站——比如从 Fast Track 上获取 2018 年 100 强企业的信息。用脚本将获取信息的过程自动化,不但能节省手动整理的时间,还能将所有企业数据整理在一个结构化的文件里,方便进一步分析查询。

太长不看版:如果你只是想要一个最基本的 Python 爬虫程序的示例代码,本文中所用到的全部代码都放在 GitHub (https://github.com/kaparker/tutorials/blob/master/pythonscraper/websitescrapefasttrack.py),欢迎自取。

准备工作

每一次打算用 Python 搞点什么的时候,你问的第一个问题应该是:“我需要用到什么库”。

网页爬取方面,有好几个不同的库可以用,包括:

  • Beautiful Soup

  • Requests

  • Scrapy

  • Selenium

今天我们打算用 Beautiful Soup 库。你只需要用 pip(Python包管理工具)就能很方便地将它装到电脑上:

安装完毕之后,我们就可以开始啦!

检查网页

为了明确要抓取网页中的什么元素,你需要先检查一下网页的结构。

以 Tech Track 100强企业(https://link.zhihu.com/?target=http%3A//www.fasttrack.co.uk/league-tables/tech-track-100/league-table/) 这个页面为例,你在表格上点右键,选择“检查”。在弹出的“开发者工具”中,我们就能看到页面中的每个元素,以及其中包含的内容。



右键点击你想要查看的网页元素,选择“检查”,就能看到具体的 HTML 元素内容

既然数据都保存在表格里,那么只需要简单的几行代码就能直接获取到完整信息。如果你希望自己练习爬网页内容,这就是一个挺不错的范例。但请记住,实际情况往往不会这么简单。

这个例子里,所有的100个结果都包含在同一个页面中,还被  标签分隔成行。但实际抓取过程中,许多数据往往分布在多个不同的页面上,你需要调整每页显示的结果总数,或者遍历所有的页面,才能抓取到完整的数据。

在表格页面上,你可以看到一个包含了所有100条数据的表格,右键点击它,选择“检查”,你就能很容易地看到这个 HTML 表格的结构。包含内容的表格本体是在这样的标签里:

每一行都是在一个  标签里,也就是我们不需要太复杂的代码,只需要一个循环,就能读取到所有的表格数据,并保存到文件里。

附注:你还可以通过检查当前页面是否发送了 HTTP GET 请求,并获取这个请求的返回值,来获取显示在页面上的信息。因为 HTTP GET 请求经常能返回已经结构化的数据,比如 JSON 或者 XML 格式的数据,方便后续处理。你可以在开发者工具里点击 Network 分类(有必要的话可以仅查看其中的 XHR 标签的内容)。这时你可以刷新一下页面,于是所有在页面上载入的请求和返回的内容都会在 Network 中列出。此外,你还可以用某种 REST 客户端(比如 Insomnia)来发起请求,并输出返回值。
刷新页面后,Network 标签页的内容更新了


用 Beautiful Soup 库处理网页的 HTML 内容

在熟悉了网页的结构,了解了需要抓取的内容之后,我们终于要拿起代码开工啦~

首先要做的是导入代码中需要用到的各种模块。上面我们已经提到过 BeautifulSoup,这个模块可以帮我们处理 HTML 结构。接下来要导入的模块还有 urllib,它负责连接到目标地址,并获取网页内容。最后,我们需要能把数据写入 CSV 文件,保存在本地硬盘上的功能,所以我们要导入 csv库。当然这不是唯一的选择,如果你想要把数据保存成 json 文件,那相应的就需要导入 json 库。

下一步我们需要准备好需要爬取的目标网址。正如上面讨论过的,这个网页上已经包含了所有我们需要的内容,所以我们只需要把完整的网址复制下来,赋值给变量就行了:

接下来,我们就可以用 urllib 连上这个URL,把内容保存在 page 变量里,然后用 BeautifulSoup 来处理页面,把处理结果存在 soup 变量里:

这时候,你可以试着把 soup 变量打印出来,看看里面已经处理过的 html 数据长什么样:

如果变量内容是空的,或者返回了什么错误信息,则说明可能没有正确获取到网页数据。你也许需要用一些错误捕获代码,配合  urllib.error (https://docs.python.org/3/library/urllib.error.html)模块,来发现可能存在的问题。

查找 HTML 元素

既然所有的内容都在表格里(

 标签),我们可以在 soup 对象里搜索需要的表格,然后再用 find_all 方法,遍历表格中的每一行数据。

如果你试着打印出所有的行,那应该会有 101 行 —— 100 行内容,加上一行表头。

看看打印出来的内容,如果没问题的话,我们就可以用一个循环来获取所有数据啦。

如果你打印出 soup 对象的前 2 行,你可以看到,每一行的结构是这样的:

可以看到,表格中总共有 8 列,分别是 Rank(排名)、Company(公司)、Location(地址)、Year End(财年结束)、Annual Sales Rise(年度销售增长)、Latest Sales(本年度销售额)、Staff(员工数)和 Comments(备注)。

这些都是我们所需要的数据。

这样的结构在整个网页中都保持一致(不过在其他网站上可能就没这么简单了!),所以我们可以再次使用 find_all 方法,通过搜索 

 元素,逐行提取出数据,存储在变量中,方便之后写入 csv 或 json 文件。

循环遍历所有的元素并存储在变量中

在 Python 里,如果要处理大量数据,还需要写入文件,那列表对象是很有用的。我们可以先声明一个空列表,填入最初的表头(方便以后CSV文件使用),而之后的数据只需要调用列表对象的 append 方法即可。

这样就将打印出我们刚刚加到列表对象 rows 中的第一行表头。

你可能会注意到,我输入的表头中比网页上的表格多写了几个列名,比如 Webpage(网页)和 Description(描述),请仔细看看上面打印出的 soup 变量数据——第二行第二列的数据里,可不只有公司名字,还有公司的网址和简单描述。所以我们需要这些额外的列来存储这些数据。

下一步,我们遍历所有100行数据,提取内容,并保存到列表中。

循环读取数据的方法:

因为数据的第一行是 html 表格的表头,所以我们可以跳过不用读取它。因为表头用的是 

 标签,没有用  标签,所以我们只要简单地查询 标签内的数据,并且抛弃空值即可。

接着,我们将 data 的内容读取出来,赋值到变量中:

如上面的代码所示,我们按顺序将 8 个列里的内容,存储到 8 个变量中。当然,有些数据的内容还需有额外的清理,去除多余的字符,导出所需的数据。

数据清理

如果我们打印出 company 变量的内容,就能发现,它不但包含了公司名称,还包括和描述。如果我们打印出 sales 变量的内容,就能发现它还包括一些备注符号等需要清除的字符。

我们希望把 company 变量的内容分割成公司名称和描述两部分。这用几行代码就能搞定。再看看对应的 html 代码,你会发现这个单元格里还有一个  元素,这个元素里只有公司名称。另外,还有一个  链接元素,包含一个指向该公司详情页面的链接。我们一会也会用到它!

为了区分公司名称和描述两个字段,我们再用 find 方法把  元素里的内容读取出来,然后删掉或替换 company 变量中的对应内容,这样变量里就只会留下描述了。

要删除 sales 变量中的多余字符,我们用一次 strip 方法即可。

最后我们要保存的是公司网站的链接。就像上面说的,第二列中有一个指向该公司详情页面的链接。每一个公司的详情页都有一个表格,大部分情况下,表格里都有一个公司网站的链接。

检查公司详情页里,表格中的链接

为了抓取每个表格中的网址,并保存到变量里,我们需要执行以下几个步骤:

  • 在最初的 fast track 网页上,找到需要访问的公司详情页的链接。

  • 发起一个对公司详情页链接的请求

  • 用 Beautifulsoup 处理一下获得的 html 数据

  • 找到需要的链接元素

正如上面的截图那样,看过几个公司详情页之后,你就会发现,公司的网址基本上就在表格的最后一行。所以我们可以在表格的最后一行里找  元素。

同样,有可能出现最后一行没有链接的情况。所以我们增加了 try... except 语句,如果没有发现网址,则将变量设置成 None。当我们把所有需要的数据都存在变量中的以后(还在循环体内部),我们可以把所有变量整合成一个列表,再把这个列表 append 到上面我们初始化的 rows 对象的末尾。

上面代码的最后,我们在结束循环体之后打印了一下 rows 的内容,这样你可以在把数据写入文件前,再检查一下。

写入外部文件

最后,我们把上面获取的数据写入外部文件,方便之后的分析处理。在 Python 里,我们只需要简单的几行代码,就可以把列表对象保存成文件。

最后我们来运行一下这个 python 代码,如果一切顺利,你就会发现一个包含了 100 行数据的 csv 文件出现在了目录中,你可以很容易地用 python 读取和处理它。

总结

这篇简单的 Python 教程中,我们一共采取了下面几个步骤,来爬取网页内容:

  • 连接并获取一个网页的内容

  • 用 BeautifulSoup 处理获得的 html 数据

  • 在 soup 对象里循环搜索需要的 html 元素

  • 进行简单的数据清理

  • 把数据写入 csv 文件中

如果有什么没说清楚的,欢迎大家在下面留言,我会尽可能给大家解答的!

附: 本文全部代码(https://github.com/kaparker/tutorials/blob/master/pythonscraper/websitescrapefasttrack.py)

祝你的爬虫之旅有一个美好的开始!

原作: Kerry Parker 编译:欧剃 转载请保留此信息)

编译来源:  towardsdatascience.com

如果你也想零基础学习 Python,并且完成你的第一个爬虫项目,那么优达新课《28天入门Python》很适合你,你将

  • 前 Google 工程师亲授课程

  • Python 入门要点讲解

  • 12 个随堂实战演练

  • 从 0 到 1 完成第一个爬虫


原价499元,尝鲜价仅需299元,席位不多,立即加入


想要学习和了解硅谷企业内部的数据分析资料?优达学城【数据分析师】纳米学位带你成功求职转行,成为优秀数据分析师,点击【阅读原文】,立即了解详情。

    阅读原文
    已同步到看一看

    发送中

    0) { var p = window.vConsolePlugins.shift(); window.vConsole.addPlugin(p); } } function _addVConsole(uri, cb) { totalCount++; var node = document.createElement('SCRIPT'); node.type = 'text/javascript'; node.src = uri; node.setAttribute('nonce', '329420544'); if (cb) { node.onload = cb; } document.getElementsByTagName('head')[0].appendChild(node); } if ( (document.cookie && document.cookie.indexOf('vconsole_open=1') > -1) || location.href.indexOf('vconsole=1') > -1 ) { window.vConsolePlugins = []; _addVConsole('//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/vconsole/3.2.2/vconsole.min440203.js', function() { _addVConsole('//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/vconsole/plugin/vconsole-mpopt/1.0.1/vconsole-mpopt42f400.js', _loadVConsolePlugin); }); } })(); parent_width ? parent_width : width, outerW = getOuterW(dom)||0, outerH = getOuterH(dom)||0, videoW = width - outerW, videoH = videoW/ratio_, height = videoH + outerH; return {w:Math.ceil(width),h:Math.ceil(height),vh:videoH,vw:videoW,ratio:ratio_}; }; (function(){ var iframe = document.getElementsByTagName('iframe'); for (var i=0,il=iframe.length;i=0 && child.getAttribute("data-vid")==vid){ child.style.cssText += "height: " + h + "px !important;"; child.style.display = ""; } } } } })(); })(); var new_appmsg = 1; var item_show_type = "0"; var can_see_complaint = "0"; var not_in_mm_css = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg_new/not_in_mm462fbb.css"; var windowwx_css = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg_new/winwx462fbb.css"; var article_improve_combo_css = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg_new/combo462fbb.css"; var tid = ""; var aid = ""; var clientversion = ""; var appuin = "MzI0NzE3NTAzOA=="||""; var source = "0"; var ascene = ""; var subscene = ""; var sessionid = ""||"svr_62c323515a4"; var abtest_cookie = ""; var scene = 75; var itemidx = ""; var appmsg_token = ""; var _copyright_stat = "0"; var _ori_article_type = ""; var is_follow = ""; var nickname = "优达学城Udacity"; var appmsg_type = "9"; var ct = "1559226451"; var user_name = "gh_9f95ad61603b"; var user_name_new = ""; var fakeid = ""; var version = ""; var is_limit_user = "0"; var round_head_img = "http://img2.jintiankansha.me/get?src=http://mmbiz.qpic.cn/mmbiz_png/ldSjzkNDxlnDNvNevwgaEagkvgmSTF3VnAtGbAt6w4c5BVAp4wFA3oicqQ4uTEtia8e921MXE9lhgsP0NKaujedg/0?wx_fmt=png"; var hd_head_img = "http://wx.qlogo.cn/mmhead/Q3auHgzwzM4VxFL2ib7A41YaoXxx0E3kzr2XhQOkuAKCibuiaLBicmFcgg/0"||""; var ori_head_img_url = "http://wx.qlogo.cn/mmhead/Q3auHgzwzM4VxFL2ib7A41YaoXxx0E3kzr2XhQOkuAKCibuiaLBicmFcgg/132"; var msg_title = "数据分析硬核技能:用 Python 爬取网页"; var msg_desc = "祝你的爬虫之旅有一个美好的开始!"; var msg_cdn_url = "http://img2.jintiankansha.me/get?src=http://mmbiz.qpic.cn/mmbiz_jpg/ldSjzkNDxln2OOzDJIMH4mFex7M4KladW8mhicicVtmIyYUibxlmTy0MMxhhvBqsa4iaycFGDr94E7xn1IC8uIXeCA/0?wx_fmt=jpeg"; var cdn_url_1_1 = "http://img2.jintiankansha.me/get?src=http://mmbiz.qpic.cn/mmbiz_jpg/ldSjzkNDxln2OOzDJIMH4mFex7M4Klady9aJhHUtqicQwlfgoAbicTgh5pfceP3pwrO7YdKT4iaS0QfuESX0icia1lQ/0?wx_fmt=jpeg"; var cdn_url_235_1 = "http://img2.jintiankansha.me/get?src=http://mmbiz.qpic.cn/mmbiz_jpg/ldSjzkNDxln2OOzDJIMH4mFex7M4KladW8mhicicVtmIyYUibxlmTy0MMxhhvBqsa4iaycFGDr94E7xn1IC8uIXeCA/0?wx_fmt=jpeg"; var msg_link = "http://mp.weixin.qq.com/s?__biz=MzI0NzE3NTAzOA==&mid=2652121446&idx=1&sn=bc4fed94cae8e5de4d26e07c62326cee&chksm=f2548b77c5230261d857dcb9f9de35022280a3419872073d4aa5e12d95d092f2b0bc2360a4df#rd"; var user_uin = "0"*1; var msg_source_url = 'https://cn.udacity.com/dand?utm_source=wechat-oa\x26amp;utm_medium=social\x26amp;utm_campaign=dand'; var img_format = 'jpeg'; var srcid = ''; var req_id = '01024bprkcUb0qYkRlC4StCA'; var networkType; var appmsgid = '' || '2652121446'|| ""; var comment_id = "832723365487099904" || "832723365487099904" * 1; var comment_enabled = "" * 1; var is_need_reward = "0" * 1; var is_https_res = ("" * 1) && (location.protocol == "https:"); var msg_daily_idx = "1" || ""; var profileReportInfo = "" || ""; var devicetype = ""; var source_encode_biz = ""; var source_username = ""; var reprint_ticket = ""; var source_mid = ""; var source_idx = ""; var source_biz = ""; var author_id = ""; var optimizing_flag = "0" * 1; var ad_abtest_padding = "0" * 1; var show_comment = "0"; var __appmsgCgiData = { wxa_product : ""*1, wxa_cps : ""*1, show_msg_voice: "0"*1, can_use_page : "0"*1, is_wxg_stuff_uin : "0"*1, card_pos : "", copyright_stat : "0", source_biz : "", hd_head_img : "http://wx.qlogo.cn/mmhead/Q3auHgzwzM4VxFL2ib7A41YaoXxx0E3kzr2XhQOkuAKCibuiaLBicmFcgg/0"||(window.location.protocol+"//"+window.location.host + "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/pic/appmsg/pic_rumor_link.2x42f400.jpg") }; var _empty_v = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/pic/pages/voice/empty42f400.mp3"; var copyright_stat = "0" * 1; var pay_fee = "" * 1; var pay_timestamp = ""; var need_pay = "" * 1; var need_report_cost = "0" * 1; var use_tx_video_player = "0" * 1; var appmsg_fe_filter = "contenteditable"; var friend_read_source = "" || ""; var friend_read_version = "" || ""; var friend_read_class_id = "" || ""; var is_only_read = "1" * 1; var read_num = "" * 1; var like_num = "" * 1; var liked = "" == 'true' ? true : false; var is_temp_url = "" ? 1 : 0; var send_time = ""; var icon_emotion_switch = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/emotion/icon_emotion_switch.2x42f400.png"; var icon_emotion_switch_active = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/emotion/icon_emotion_switch_active.2x42f400.png"; var icon_loading_white = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/common/icon_loading_white42f400.gif"; var icon_audio_unread = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/audio/icon_audio_unread42f400.png"; var icon_qqmusic_default = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/qqmusic/icon_qqmusic_default.2x42f400.png"; var icon_qqmusic_source = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/qqmusic/icon_qqmusic_source42f400.png"; var icon_kugou_source = "//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/kugou/icon_kugou_source42f400.png"; var topic_default_img = '//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg/topic/pic_book_thumb.2x42f400.png'; var comment_edit_icon = '//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/appmsg_new/icon_edit42f400.png'; var comment_loading_img = '//res.wx.qq.com/mmbizwap/zh_CN/htmledition/images/icon/common/icon_loading_white42f400.gif'; var voice_in_appmsg = { "1":"1" }; var reprint_style = ''*1; var wxa_img_alert = "" != 'false'; var more_read_type = '0'*1; var weapp_sn_arr_json = "" || ""; var ban_scene = "0" * 1; var svr_time = "1559328089" * 1; var is_transfer_msg = ""*1||0; var malicious_title_reason_id = "0" * 1; var malicious_content_type = "0" * 1; var modify_time = ""; var isprofileblock = "0"; var hotspotInfoList = [ ]; window.wxtoken = "777"; window.is_login = '0' * 1; window.__moon_initcallback = function(){ if(!!window.__initCatch){ window.__initCatch({ idkey : 27611+2, startKey : 0, limit : 128, badjsId: 43, reportOpt : { uin : uin, biz : biz, mid : mid, idx : idx, sn : sn }, extInfo : { network_rate : 0.01, badjs_rate: 0.1 } }); } } var title ="优达学城Udacity"; var is_new_msg=true; var is_wash = '' * 1; var show_top_bar = '0' * 1; var topbarEnable = false; var enterid=""*1||0; window.__moon_host = 'res.wx.qq.com';window.__moon_mainjs = 'appmsg/index.js';window.moon_map = {"pages/iframe_communicate.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/iframe_communicate42f400.js","new_video/player.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/new_video/player.html433882.js","biz_wap/jsapi/log.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/log45fdbf.js","biz_wap/zepto/touch.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/zepto/touch42f400.js","biz_wap/zepto/event.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/zepto/event42f400.js","biz_wap/zepto/zepto.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/zepto/zepto440203.js","page/pages/video.css":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/pages/video.css462fbb.js","a/tpl/smallbanner_msg_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/smallbanner_msg_tpl.html42f400.js","a/tpl/smallbanner_info_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/smallbanner_info_tpl.html44c2e3.js","a/tpl/banner_info_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/banner_info_tpl.html42f400.js","a/tpl/promote_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/promote_tpl.html42f400.js","a/tpl/smallcard_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/smallcard_tpl.html42f400.js","a/tpl/info_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/info_tpl.html42f400.js","a/tpl/cardticket_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/cardticket_tpl.html42f400.js","a/tpl/banner_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/banner_tpl.html44c2e3.js","a/tpl/sponsor_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/sponsor_tpl.html42f400.js","a/tpl/new_cpc_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/new_cpc_tpl.html45178d.js","appmsg/emotion/caret.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/caret42f400.js","pages/audition_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/audition_tpl.html44ccb4.js","biz_wap/utils/localstorage.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/localstorage42f400.js","appmsg/friend_comment_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/friend_comment_tpl.html42f400.js","appmsg/comment_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/comment_tpl.html45a3cd.js","biz_wap/utils/fakehash.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/fakehash42f400.js","appmsg/comment_report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/comment_report4576f8.js","a/appdialog_confirm.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/appdialog_confirm.html42f400.js","widget/wx_profile_dialog_primary.css":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/widget/wx_profile_dialog_primary.css42f400.js","new_video/player.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/new_video/player45f772.js","a/tpl/mpda_bottom_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/mpda_bottom_tpl.html450c68.js","a/tpl/crt_size_map.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/crt_size_map4602fc.js","biz_wap/jsapi/cardticket.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/cardticket42f400.js","biz_common/jquery.md5.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/jquery.md542f400.js","biz_common/utils/emoji_panel_data.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/emoji_panel_data42f400.js","appmsg/emotion/textarea.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/textarea42f400.js","appmsg/emotion/nav.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/nav42f400.js","appmsg/emotion/common.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/common42f400.js","appmsg/emotion/slide.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/slide42f400.js","appmsg/emotion/dom.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/dom42f400.js","pages/player_tips.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/player_tips44ccb4.js","pages/music_report_conf.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/music_report_conf42f400.js","pages/report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/report4629a1.js","pages/player_adaptor.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/player_adaptor42f400.js","pages/music_player.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/music_player42f400.js","biz_common/utils/emoji_data.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/emoji_data45112f.js","appmsg/more_read_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/more_read_tpl.html42f400.js","appmsg/i18n.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/i18n45e203.js","appmsg/retry_ajax.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/retry_ajax451cc4.js","complain/tips.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/complain/tips42f400.js","pages/loadscript.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/loadscript42f400.js","biz_wap/utils/ajax_load_js.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/ajax_load_js42f400.js","appmsg/comment.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/comment4576f8.js","appmsg/reward_entry.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/reward_entry4576f8.js","a/ios.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/ios42f400.js","a/android.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/android457bcb.js","a/profile.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/profile455ab4.js","a/app_card.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/app_card455a33.js","a/sponsor.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/sponsor4576f8.js","a/tpl/cpc_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/cpc_tpl.html450c68.js","a/appdialog_confirm.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/appdialog_confirm44c2e3.js","biz_common/dom/offset.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/offset452c49.js","a/video.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/video4576f8.js","a/tpl/crt_tpl_manager.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/tpl/crt_tpl_manager450d79.js","a/cpc_a_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/cpc_a_tpl.html450c68.js","a/sponsor_a_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/sponsor_a_tpl.html42f400.js","a/a_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/a_tpl.html450c68.js","a/mpshop.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/mpshop42f400.js","a/wxopen_card.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/wxopen_card42f400.js","a/card.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/card42f400.js","biz_wap/utils/position.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/position42f400.js","a/a_report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/a_report4402ec.js","biz_wap/utils/show_time.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/show_time4543c6.js","biz_common/utils/get_para_list.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/get_para_list42f400.js","biz_wap/utils/openUrl.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/openUrl4402ec.js","a/a_sign.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/a_sign452c49.js","appmsg/my_comment_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/my_comment_tpl.html42f400.js","appmsg/cmt_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/cmt_tpl.html42f400.js","sougou/a_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/sougou/a_tpl.html42f400.js","appmsg/emotion/emotion.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/emotion/emotion42f400.js","biz_common/base64.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/base6442f400.js","biz_common/utils/report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/report42f400.js","appmsg/articleReport.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/articleReport42f400.js","biz_wap/jsapi/leaveReport.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/leaveReport45a434.js","biz_wap/utils/hand_up_state.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/hand_up_state42f400.js","biz_wap/utils/storage.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/storage42f400.js","biz_common/utils/http.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/http42f400.js","biz_common/utils/cookie.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/cookie42f400.js","appmsg/topic_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/topic_tpl.html42f400.js","question_answer/appmsg_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/question_answer/appmsg_tpl.html45112f.js","pages/weapp_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/weapp_tpl.html42f400.js","biz_common/utils/monitor.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/monitor42f400.js","pages/voice_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/voice_tpl.html42f400.js","pages/kugoumusic_ctrl.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/kugoumusic_ctrl42f400.js","pages/qqmusic_ctrl.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/qqmusic_ctrl44df7a.js","pages/voice_component.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/voice_component44df7a.js","pages/qqmusic_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/qqmusic_tpl.html42f400.js","new_video/ctl.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/new_video/ctl4532b3.js","pages/utils.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/utils45112f.js","appmsg/open_url_with_webview.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/open_url_with_webview440203.js","appmsg/more_read.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/more_read4576f8.js","appmsg/like.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/like462fbb.js","appmsg/share_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/share_tpl.html42f400.js","appmsg/appmsgext.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/appmsgext430b95.js","appmsg/img_copyright_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/img_copyright_tpl.html42f400.js","pages/video_ctrl.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/video_ctrl42f400.js","pages/create_txv.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/create_txv42f400.js","appmsg/comment_utils.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/comment_utils42f400.js","appmsg/reward_utils.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/reward_utils462fbb.js","biz_common/ui/imgonepx.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/ui/imgonepx42f400.js","appmsg/malicious_wording.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/malicious_wording42f400.js","biz_common/utils/wxgspeedsdk.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/wxgspeedsdk42f400.js","pages/version4video.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/version4video42f400.js","a/a_config.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/a_config45a919.js","a/a_utils.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/a_utils462fbb.js","a/a.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/a45fd5f.js","rt/appmsg/getappmsgext.rt.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/rt/appmsg/getappmsgext.rt42f400.js","pages/video_communicate_adaptor.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/pages/video_communicate_adaptor433882.js","biz_wap/utils/ajax_wx.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/ajax_wx42f400.js","biz_common/utils/respTypes.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/respTypes42f400.js","biz_wap/utils/log.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/log42f400.js","sougou/index.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/sougou/index42f400.js","biz_wap/safe/mutation_observer_report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/safe/mutation_observer_report42f400.js","appmsg/fereport.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/fereport438bee.js","appmsg/fereport_without_localstorage.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/fereport_without_localstorage438bee.js","appmsg/report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/report4576f8.js","appmsg/report_and_source.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/report_and_source450c68.js","appmsg/page_pos.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/page_pos45a434.js","appmsg/cdn_speed_report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/cdn_speed_report42f400.js","appmsg/wxtopic.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/wxtopic42f400.js","question_answer/appmsg.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/question_answer/appmsg45112f.js","appmsg/weapp.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/weapp4576f8.js","appmsg/weproduct.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/weproduct4576f8.js","appmsg/voicemsg.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/voicemsg42f400.js","appmsg/autoread.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/autoread42f400.js","appmsg/voice.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/voice42f400.js","appmsg/qqmusic.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/qqmusic43440b.js","appmsg/iframe.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/iframe4576f8.js","question_answer/utils.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/question_answer/utils45112f.js","appmsg/product.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/product4576f8.js","appmsg/review_image.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/review_image4543bb.js","appmsg/outer_link.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/outer_link44c2e3.js","appmsg/copyright_report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/copyright_report4576f8.js","appmsg/async.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/async462fbb.js","biz_wap/ui/lazyload_img.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/ui/lazyload_img42f400.js","biz_common/log/jserr.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/log/jserr42f400.js","appmsg/share.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/share42f50a.js","appmsg/cdn_img_lib.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/cdn_img_lib42f400.js","appmsg/finance_communicate.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/finance_communicate453348.js","page/appmsg_new/not_in_mm.css":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg_new/not_in_mm.css462fbb.js","page/appmsg_new/combo.css":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/style/page/appmsg_new/combo.css462fbb.js","complain/localstorage.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/complain/localstorage42f400.js","common/utils.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/common/utils462fbb.js","biz_wap/utils/wapsdk.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/wapsdk44c130.js","a/mpAdAsync.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/a/mpAdAsync459ccd.js","biz_common/utils/url/parse.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/url/parse440451.js","appmsg/appmsg_report.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/appmsg_report435ac2.js","biz_common/moment.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/moment42f400.js","biz_wap/jsapi/core.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/jsapi/core45fdbf.js","biz_common/dom/event.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/event445789.js","appmsg/test.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/test42f400.js","biz_wap/utils/mmversion.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/mmversion45fc7f.js","appmsg/max_age.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/max_age42f400.js","biz_common/dom/attr.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/attr42f400.js","biz_wap/utils/ajax.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/ajax462fbb.js","appmsg/log.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/log42f400.js","biz_common/dom/class.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/dom/class42f400.js","biz_wap/utils/device.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_wap/utils/device42f400.js","appmsg/weapp_common.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/weapp_common42f400.js","biz_common/utils/string/html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/utils/string/html42f400.js","cps/tpl/list_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/cps/tpl/list_tpl.html42f400.js","cps/tpl/card_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/cps/tpl/card_tpl.html42f400.js","cps/tpl/banner_tpl.html.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/cps/tpl/banner_tpl.html42f400.js","biz_common/tmpl.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/biz_common/tmpl42f400.js","appmsg/index.js":"//res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/appmsg/index463028.js"}; =3&&window.moon&&window.moon.clear&&moon.clear(); } }; } window.seajs&&v&&(window.define=function(){ for(var o,t=[],n=arguments&&arguments[0],a=0,s=arguments.length;s>a;a++){ var c=o=arguments[a]; "function"==typeof o&&(o=function(){ try{ return c.apply(this,arguments); }catch(o){ throw"string"==typeof n&&console.error("[TryCatch][DefineeErr]id:"+n),o.stack&&console&&console.error&&console.error("[TryCatch]"+o.stack), _&&window.__moon_report&&(window.__moon_report([{ offset:y, log:"define_error;id:"+n+";", e:o }]),i(f)),e(" [define_error]"+JSON.stringify(r(o))),o; } },o.toString=function(e){ return function(){ return e.toString(); }; }(arguments[a])),t.push(o); } return v.apply(this,t); }); }(),function(o){ function t(e,o,t){ return window.__DEBUGINFO?(window.__DEBUGINFO.res_list||(window.__DEBUGINFO.res_list=[]), window.__DEBUGINFO.res_list[e]?(window.__DEBUGINFO.res_list[e][o]=t,!0):!1):!1; } function n(e){ var o=new TextEncoder("utf-8").encode(e),t=crypto.subtle||crypto.webkitSubtle; return t.digest("SHA-256",o).then(function(e){ return r(e); }); } function r(e){ for(var o=[],t=new DataView(e),n=0;nr;++r)if(o.call(t,e[r],r,e)===!1)return; }else{ if("Object"!==n&&a!=e)throw"unsupport type"; if(a==e){ for(var r=e.length-1;r>=0;r--){ var s=a.key(r),c=a.getItem(s); if(o.call(t,c,s,e)===!1)return; } return; } for(var r in e)if(e.hasOwnProperty(r)&&o.call(t,e[r],r,e)===!1)return; } } } var a=o.localStorage,s=document.head||document.getElementsByTagName("head")[0],c=1,d=11,_=12,m=13,l=window.__allowLoadResFromMp?1:2,w=window.__allowLoadResFromMp?1:0,u=l+w,p=window.testenv_reshost||window.__moon_host||"res.wx.qq.com",f=new RegExp("^(http(s)?:)?//"+p); window.__loadAllResFromMp&&(p="mp.weixin.qq.com",l=0,u=l+w); var h={ prefix:"__MOON__", loaded:[], unload:[], clearSample:!0, hit_num:0, mod_num:0, version:1003, cacheData:{ js_mod_num:0, js_hit_num:0, js_not_hit_num:0, js_expired_num:0, css_mod_num:0, css_hit_num:0, css_not_hit_num:0, css_expired_num:0 }, init:function(){ h.loaded=[],h.unload=[]; var e,t,r; if(window.no_moon_ls&&(h.clearSample=!0),a){ var s="_moon_ver_key_",c=a.getItem(s); c!=h.version&&(h.clear(),a.setItem(s,h.version)); } if((-1!=location.search.indexOf("no_moon1=1")||-1!=location.search.indexOf("no_lshttps=1"))&&h.clear(), a){ var d=1*a.getItem(h.prefix+"clean_time"),_=+new Date; if(_-d>=1296e6){ h.clear(); try{ !!a&&a.setItem(h.prefix+"clean_time",+new Date); }catch(m){} } } i(moon_map,function(i,s){ if(t=h.prefix+s,r=!!i&&i.replace(f,""),e=!!a&&a.getItem(t),version=!!a&&(a.getItem(t+"_ver")||"").replace(f,""), h.mod_num++,r&&-1!=r.indexOf(".css")?h.cacheData.css_mod_num++:r&&-1!=r.indexOf(".js")&&h.cacheData.js_mod_num++, h.clearSample||!e||r!=version)h.unload.push(r.replace(f,"")),r&&-1!=r.indexOf(".css")?e?r!=version&&h.cacheData.css_expired_num++:h.cacheData.css_not_hit_num++:r&&-1!=r.indexOf(".js")&&(e?r!=version&&h.cacheData.js_expired_num++:h.cacheData.js_not_hit_num++);else{ if("https:"==location.protocol&&window.moon_hash_map&&window.moon_hash_map[s]&&window.crypto)try{ n(e).then(function(e){ window.moon_hash_map[s]!=e&&console.log(s); }); }catch(c){} try{ var d="//# sourceURL="+s+"\n//@ sourceURL="+s; o.eval.call(o,'define("'+s+'",[],'+e+")"+d),h.hit_num++,r&&-1!=r.indexOf(".css")?h.cacheData.css_hit_num++:r&&-1!=r.indexOf(".js")&&h.cacheData.js_hit_num++; }catch(c){ h.unload.push(r.replace(f,"")); } } }),h.load(h.genUrl()); }, genUrl:function(){ var e=h.unload; if(!e||e.length<=0)return[]; var o,t,n="",r=[],i={},a=-1!=location.search.indexOf("no_moon2=1"),s="//"+p; -1!=location.href.indexOf("moon_debug2=1")&&(s="//mp.weixin.qq.com"); for(var c=0,d=e.length;d>c;++c){ /^\/(.*?)\//.test(e[c]); var _=/^\/(.*?)\//.exec(e[c]); _.length<2||!_[1]||(t=_[1],n=i[t],n?(o=n+","+e[c],o.length>1e3||a?(r.push(n+"?v="+h.version), n=location.protocol+s+e[c],i[t]=n):(n=o,i[t]=n)):(n=location.protocol+s+e[c],i[t]=n)); } for(var m in i)i.hasOwnProperty(m)&&r.push(i[m]); return r; }, load:function(e){ if(window.__wxgspeeds&&(window.__wxgspeeds.mod_num=h.mod_num,window.__wxgspeeds.hit_num=h.hit_num), !e||e.length<=0)return seajs.combo_status=seajs.COMBO_LOADED,seajs.run(),console.debug&&console.debug("[moon] load js complete, all in cache, cost time : 0ms, total count : "+h.mod_num+", hit num: "+h.hit_num), void window.__moonclientlog.push("[moon] load js complete, all in cache, cost time : 0ms, total count : "+h.mod_num+", hit num: "+h.hit_num); seajs.combo_status=seajs.COMBO_LOADING; var o=0,t=+new Date; window.__wxgspeeds&&(window.__wxgspeeds.combo_times=[],window.__wxgspeeds.combo_times.push(t)), i(e,function(n){ h.request(n,u,function(){ if(window.__wxgspeeds&&window.__wxgspeeds.combo_times.push(+new Date),o++,o==e.length){ var n=+new Date-t; window.__wxgspeeds&&(window.__wxgspeeds.mod_downloadtime=n),seajs.combo_status=seajs.COMBO_LOADED, seajs.run(),console.debug&&console.debug("[moon] load js complete, url num : "+e.length+", total mod count : "+h.mod_num+", hit num: "+h.hit_num+", use time : "+n+"ms"), window.__moonclientlog.push("[moon] load js complete, url num : "+e.length+", total mod count : "+h.mod_num+", hit num: "+h.hit_num+", use time : "+n+"ms"); } }); }); }, request:function(o,n,r){ if(o){ n=n||0,o.indexOf("mp.weixin.qq.com")>-1&&((new Image).src=location.protocol+"//mp.weixin.qq.com/mp/jsmonitor?idkey=27613_32_1&r="+Math.random(), window.__moon_report([{ offset:_, log:"load_script_from_mp: "+o }],1)); var i=-1; window.__DEBUGINFO&&(__DEBUGINFO.res_list||(__DEBUGINFO.res_list=[]),__DEBUGINFO.res_list.push({ type:"js", status:"pendding", start:+new Date, end:0, url:o }),i=__DEBUGINFO.res_list.length-1),-1!=location.search.indexOf("no_lshttps=1")&&(o=o.replace("http://","https://")); var a=document.createElement("script"); a.src=o,a.type="text/javascript",a.async=!0,a.down_time=+new Date,a.onerror=function(s){ t(i,"status","error"),t(i,"end",+new Date); var _=new Error(s); if(n>=0)if(w>n){ var l=o.replace("res.wx.qq.com","mp.weixin.qq.com"); h.request(l,n,r); }else h.request(o,n,r);else window.__moon_report&&window.__moon_report([{ offset:c, log:"load_script_error: "+o, e:_ }],1); if(n==w-1&&window.__moon_report([{ offset:d, log:"load_script_error: "+o, e:_ }],1),-1==n){ var u="ua: "+window.navigator.userAgent+", time="+(+new Date-a.down_time)+", load_script_error -1 : "+o; window.__moon_report([{ offset:m, log:u }],1); } window.__moonclientlog.push("moon load js error : "+o+", error -> "+_.toString()), e("moon_request_error url:"+o); },"undefined"!=typeof moon_crossorigin&&moon_crossorigin&&a.setAttribute("crossorigin",!0), a.onload=a.onreadystatechange=function(){ t(i,"status","loaded"),t(i,"end",+new Date),!a||a.readyState&&!/loaded|complete/.test(a.readyState)||(t(i,"status","200"), a.onload=a.onreadystatechange=null,"function"==typeof r&&r()); },n--,s.appendChild(a),e("moon_request url:"+o+" retry:"+n); } }, setItem:function(e,o){ !!a&&a.setItem(e,o); }, clear:function(){ a&&(i(a,function(e,o){ ~o.indexOf(h.prefix)&&a.removeItem(o); }),console.debug&&console.debug("[moon] clear")); }, idkeyReport:function(e,o,t){ t=t||1; var n=e+"_"+o+"_"+t; (new Image).src="/mp/jsmonitor?idkey="+n+"&r="+Math.random(); } }; seajs&&seajs.use&&"string"==typeof window.__moon_mainjs&&seajs.use(window.__moon_mainjs), window.moon=h; }(window),function(){ try{ Math.random()<1; }catch(e){} }(),window.moon.init(); }; e(),!!window.__moon_initcallback&&window.__moon_initcallback(),window.__wxgspeeds&&(window.__wxgspeeds.moonendtime=+new Date); } } __moonf__(); }, 25);

    Python社区是高质量的Python/Django开发社区
    本文地址:http://www.python88.com/topic/33871
     
    664 次点击