重温4399,感慨良多!想下载一个喜欢的游戏到本地,却有少许波折~

一按f12,咦?怎么没反应?

哦!禁用了呀,那就在更多工具->开发人员工具打开

没曾想,找不到swf文件!

放进js里了?那这swf文件下载地址咋找...

又不想找别人的工具下载,一气之下,把源码爬下来分析-

import requests
resp = requests.get(url='http://www.4399.com/flash/44333_1.htm')
with open('1.txt','w',encoding='utf-8') as f:
    f.write(resp.text)

发现这样一个路径:

upload_swf/ftp2/hanbao/20101213/3.swf
从下面找到的.
'''<div id="gamebox" style="position:relative;">
		            <div id="loadingdiv" style="display:block"></div>
          <div style="top:0;left:0;z-index:122;" id="addiv">
            <script language="javascript" type="text/javascript">show_gameload_Func("/loadimg/loading.htm")</script>          </div>
          <div id="swfdiv"><div id="pusher"></div>
		  <center id="game"><SCRIPT LANGUAGE='javascript'>
var str1 = '/upload_swf/ftp2/hanbao/20101213/3.swf';document.write ("<OBJECT ID='flashgame' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='' width='750' height='563'>");document.write ("<PARAM NAME='allowScriptAccess' VALUE='never'>");document.write ("<PARAM NAME='allowNetworking' VALUE='internal'>");document.write ("<PARAM NAME='movie' VALUE='" + webServer + str1 + "'>");document.write("<embed id='flashgame1' name='flashgame' src='" + webServer + str1 + "' quality='high' pluginspage='//www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='750' height='563' allowScriptAccess='nerver' allowNetworking='internal'></embed>");document.write ("<PARAM NAME='quality' VALUE='high'>");document.write ("</OBJECT>");</SCRIPT></center></div>
		  <div id="fullpage2" class="method" style="right:0px;display:none">
              <iframe scrolling="no" frameborder="0" src="about:blank"></iframe>
              <span title="²é¿´²Ù×÷˵Ã÷" onclick="chgTips();return false;"></span>
          </div>'''

具体游戏的swf路径有了,那下载地址在哪呢?

继续探索(其实就是找文章参考),拼上了完整的url:

http://s1.4399.com/4399swf//upload_swf/ftp2/hanbao/20101213/3.swf

通用方法:

1.在游戏网页源码中找到游戏链接(复制从/upload_swf开始一直到结尾的部分)

2.在前面加上http://s1.4399.com/4399swf/

3.完整链接:http://s1.4399.com/4399swf/+/upload_swf/...

tip:一定要有双斜杠符号//在4399swf和upload_swf中间拼接,不然访问失败!

完美!用迅雷下载,swf文件到手

很简单粗糙的方法,具体每个游戏还要看情况爬取(h5就不行)

Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐