python源码,在线读取传奇列表,并解析为需要的JSON格式
[Server] ; 使用“/”字符分开颜色,也可以不使用颜色,支持以前的旧格式,只有标题和服务器标题支持颜色 ; 标题/颜色代码(0-255)|服务器标题/颜色代码(0-255)|服务器名称|服务器IP|服务器端口|是否自动展开(0不展开,1自动展开)|微端IP|微端网关端口(0表示不使用微端)|安全盾防火墙端口(0表示不使用防火墙)|防火墙类型,0=安全盾防火墙 1=风盾 2=恶魔盾 0=电信服务器/254|热血传奇7008/250|传奇归来7008|127.0.0.1|7000|1|127.0.0.1|0|0 1=电信服务器/254|传奇归来7000/251|传奇归来7000|127.0.0.1|7000|1|127.0.0.1|0|0 2=网通服务器/249|热血传奇7008/252|传奇归来7008|127.0.0.1|7000|1|127.0.0.1|0|0 3=网通服务器/249|传奇归来7000/253|传奇归来7000|127.0.0.1|7000|1|127.0.0.1|0|0 0=电信服务器/254|热血传奇7008/250|传奇归来7008|127.0.0.1|7000|1|127.0.0.1|0|0 1=电信服务器/254|传奇归来7000/251|传奇归来7000|127.0.0.1|7000|1|127.0.0.1|0|0 2=网通服务器/249|热血传奇7008/252|传奇归来7008|127.0.0.1|7000|1|127.0.0.1|0|0 3=网通服务器/249|传奇归来7000/253|传奇归来7000|127.0.0.1|7000|1|127.0.0.1|0|0 2=双线服务器|热血传奇7008|传奇归来7008|127.0.0.1|7008|1|127.0.0.1|0|0 3=双线服务器|传奇归来7000|传奇归来7000|127.0.0.1|7000|1|127.0.0.1|0|0 2=双线服务器|热血传奇7008|传奇归来7008|127.0.0.1|7008|1|127.0.0.1|0|0 3=双线服务器|传奇归来7000|传奇归来7000|127.0.0.1|7000|1|127.0.0.1|0|0 [Setup] 公告地址=http://www.gameofmir.com 官方首页=http://www.gameofmir.com 客户服务=http://www.gameofmir.com 刷新速度=360 ;时间秒,参数不小于30 自动刷新=0 ;0不自动刷新 1自动刷新 自动选择游戏区=电信服务器|传奇归来7000|传奇归来7000 ;增加这里的输入前面三个名称,登录器打开就会自动选择这个区,如果只输入“电信服务器”就会自动展开“电信服务器”这一项 ;例如:自动选择游戏区=电信服务器 就会自动展开“电信服务器” 输入完整的前面三个名称就会自动选择这个区 ;为空时,当然就不会自动选择任何区。 [Upgrade] ;列表最下面有登录器更新内容。切记获取的MD5值是压缩包的值,而不是压缩包内的文件。 ;如果您打包的是文件夹如data,文件夹整个打包,那么保存目录就使用“\”,意思就是文件自动解压到登录器所在位置,如果您打包的是data内的补丁文件,那么保存目录就写位Data! ;------------------------------------------------------------------------------------------------------------------------------ ;------------------------补丁自动更新配置演示,如果没有补丁更新的,请把以下的内容全部删除-------------------------------------- ;------------------------------------------------------------------------------------------------------------------------------ ;------------------------补丁的MD5值获取方法:把补丁拖动到登陆器配置器上就可以------------------------------------------------- ;------------------------------------------------------------------------------------------------------------------------------ ;------------------------------------------------------------------------------------------------------------------------------ ;类型(0=普通文件 1=更新登录器本身时必须是exe文件 2=zip压缩文件) 保存目录(更新登录器本身时目录名称使用\斜杠) 文件名称 MD5值 下载地址 ;登录器自身的更新,有的空间可能不支持扩展名为“.exe”文件的下载,可以把扩展名称改成“.rar”这样就可以下载了,注意不是压缩成rar格式,而是直接把“.exe”扩展名称修改成“.rar” 0=1 \ GameOfMir_登录器.exe 6cb5a722f54ed491ca4fddd0a507332d http://www.gameofmir.com/GameOfMir_登录器.exe 1=2 Data data.zip fdc49e06560f62ddbc5c178d3c02b736 http://www.gameofmir.com/data.zip 2=2 Map Map.zip fdc49e06560f62ddbc5c178d3c02b736 http://www.gameofmir.com/Map.zip 3=2 Wav Wav.zip fdc49e06560f62ddbc5c178d3c02b736 http://www.gameofmir.com/Wav.zip 4=2 Resources\Data Resdata.zip fdc49e06560f62ddbc5c178d3c02b736 http://www.gameofmir.com/Resdata.zip 5=2 Resources\Map ResMap.zip fdc49e06560f62ddbc5c178d3c02b736 http://www.gameofmir.com/ResMap.zip 6=2 Resources\Wav ResWav.zip fdc49e06560f62ddbc5c178d3c02b736 http://www.gameofmir.com/ResWav.zip 7=2 Resources\Graphics\Human Human.zip fdc49e06560f62ddbc5c178d3c02b736 http://www.gameofmir.com/Human.zip
通过http读取此列表内容,然后分解解析为JSON格式,以例更好的使用。解析后的内容如下:
{"Adv":"{"NoticeUrl":"http://www.gameofmir.com","HttpPage":"http://www.xxx.com","HomePage":"http://www.xxx.com","boAuto":"FALSE","AutoTime":"360","Caption":"电信服务器","FilePath":"传奇归来7000","ServerName":"传奇归来7000"}","List","[{"TitleColor":"电信服务器/254","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"热血传奇7008/250","ServerName":"传奇归来7008","ServerAddr":"127.0.0.1","ServerPort":"7012"},{"TitleColor":"电信服务器/254","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"传奇归来7000/251","ServerName":"传奇归来7000","ServerAddr":"127.0.0.1","ServerPort":"7012"},{"TitleColor":"网通服务器/249","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"热血传奇7008/252","ServerName":"传奇归来7008","ServerAddr":"127.0.0.1","ServerPort":"7012"},{"TitleColor":"网通服务器/249","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"传奇归来7000/253","ServerName":"传奇归来7000","ServerAddr":"127.0.0.1","ServerPort":"7012"},{"TitleColor":"电信服务器/254","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"热血传奇7008/250","ServerName":"传奇归来7008","ServerAddr":"127.0.0.1","ServerPort":"7012"},{"TitleColor":"电信服务器/254","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"传奇归来7000/251","ServerName":"传奇归来7000","ServerAddr":"127.0.0.1","ServerPort":"7012"},{"TitleColor":"网通服务器/249","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"热血传奇7008/252","ServerName":"传奇归来7008","ServerAddr":"127.0.0.1","ServerPort":"7012"},{"TitleColor":"网通服务器/249","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"传奇归来7000/253","ServerName":"传奇归来7000","ServerAddr":"127.0.0.1","ServerPort":"7012"},{"TitleColor":"双线服务器","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"热血传奇7008","ServerName":"传奇归来7008","ServerAddr":"127.0.0.1","ServerPort":"7008"},{"TitleColor":"双线服务器","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"传奇归来7000","ServerName":"传奇归来7000","ServerAddr":"127.0.0.1","ServerPort":"7000"},{"TitleColor":"双线服务器","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"热血传奇7008","ServerName":"传奇归来7008","ServerAddr":"127.0.0.1","ServerPort":"7008"},{"TitleColor":"双线服务器","UpdateAddr":"127.0.0.1","UpdatePort":"0","Caption":"传奇归来7000","ServerName":"传奇归来7000","ServerAddr":"127.0.0.1","ServerPort":"7000"}]"}
源码运行截图如下: