当前位置:编程学习 > C#/ASP.NET >>

正则表达式·高手来啊


{"data":[{"ct":"n","cs":"264","logo":"http:\/\/g1.ykimg.com\/1100641F46506653883408055644D802FE2243-251A-349B-9CE0-9C9CF909E80D","seed":2852,"tags":["\u6c7d\u8f66"],"categories":"104","videoid":"113988440","vidEncoded":"XNDU1OTUzNzYw","username":"Turboleg","userid":"89539800","title":"2012 Ferrari 458 Italia vs V10 Audi R8","up":10,"down":3,"ts":"2cdbATlJGrswjy5xATho9ug","tsup":"2cdfAzpJGrswjy5xAjps9ug","lastpoint":0,"key1":"bd72af71","key2":"05a19b92c89527d8","tt":"0","videoSource":"2","seconds":"69.10","streamfileids":{"hd2":"45*38*45*45*45*51*45*51*45*45*59*45*8*8*59*38*6*59*53*37*37*59*45*59*59*8*58*58*27*6*38*6*59*6*53*51*49*8*44*37*58*45*37*44*8*58*45*37*44*49*58*30*51*44*6*53*51*59*51*45*45*37*51*27*6*30*","mp4":"45*38*45*45*45*6*45*51*45*45*59*45*8*8*59*35*21*6*53*37*37*59*45*59*59*8*58*58*27*6*38*6*59*6*53*51*49*8*44*37*58*45*37*44*8*58*45*37*44*49*58*30*51*44*6*53*51*59*51*45*45*37*51*27*6*30*","flv":"45*38*45*45*45*35*45*51*45*45*59*45*8*8*59*45*49*21*53*37*37*59*45*59*59*8*58*58*27*6*38*6*59*6*53*51*49*8*44*37*58*45*37*44*8*58*45*37*44*49*58*30*51*44*6*53*51*59*51*45*45*37*51*27*6*30*"},"segs":{"hd2":[{"no":0,"size":"10268501","seconds":"69","k":"3e9f17032717416b261c9a05","k2":"116fdcb4d2cf6e0dd"}],"mp4":[{"no":0,"size":"4696069","seconds":"69","k":"aa0d3b332d51bdd2261c9a05","k2":"1b2303c276b27b544"}],"flv":[{"no":0,"size":"2458901","seconds":"69","k":"69dc2bd98585ed7024112936","k2":"11cef3c89295269e2"}]},"streamsizes":{"hd2":"10268501","mp4":"4696069","flv":"2458901"},"stream_ids":{"hd2":"87572584","mp4":"87572216","flv":"87570853"},"streamlogos":{"hd2":"1","mp4":"1","flv":"1"},"streamtypes":["hd2","mp4","flv"],"streamtypes_o":["hd2","flvhd","mp4"]}],"user":{"id":"20780781"},"controller":{"search_count":true,"mp4_restrict":1,"stream_mode":2,"share_disabled":false,"download_disabled":false,"video_capture":true,"area_code":210100,"dma_code":4837,"continuous":1,"playmode":"normal"}}

取seed 的值
取streamfileids  flv的值
取segs    flv 的k --------------------编程问答-------------------- string s=@"你的源文本";
		string seed = Regex.Match(s, @"(?is)""seed"":([^,]+)").Groups[1].Value;
string flv = Regex.Match(s, @"(?is)""streamfileids"":.+?""flv"":""([^""]+)").Groups[1].Value;
string flvk = Regex.Match(s, @"(?is)""segs"":.+?""flv"":\[{.+?""k"":""([^""]+)").Groups[1].Value;
Response.Write(seed + "<br/>");
Response.Write(flv + "<br/>");
Response.Write(flvk);
--------------------编程问答-------------------- 输出:
2852
45*38*45*45*45*35*45*51*45*45*59*45*8*8*59*45*49*21*53*37*37*59*45*59*59*8*58*58*27*6*38*6*59*6*53*51*49*8*44*37*58*45*37*44*8*58*45*37*44*49*58*30*51*44*6*53*51*59*51*45*45*37*51*27*6*30*
69dc2bd98585ed7024112936  --------------------编程问答-------------------- 这个正则 是可以解决,但是不推荐,这个明显是一个json格式的,你转换一下,更简单 --------------------编程问答-------------------- 高版本。net都有json的处理类,直接用就是了
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,