BOSS 怎样用Htmlparse 中的内容

发布于 2021-11-07 03:10:36 字数 2340 浏览 878 评论 3

     在网页中一个<script>中有如下这么一段

A.VideoInfo = A.ObjectInfo = { setCount: false, hd:0, commvid: "", id: "2BAHMOZYIdXaapP7", uid: "13865433", usernick: "u706bu821eu795eu98de", title: "u300au9f99u95e8u98deu7532u300b3Du7ec8u6781u7248u9884u544au7247", tag: "", soHost:"http://re2.v.so.ku6.com", desc: "", time: "63", channel: "135000", activity: "0", cover: "http://i3.ku6img.com/encode/picpath/2011/12/13/12/1326944298669_11955981_11955981/5.jpg", data: {"data":{"s":0,"srctype":0,"flag":"","t":"u300au9f99u95e8u98deu7532u300b3Du7ec8u6781u7248u9884u544au7247","u":13865433,"a":"1","ad":"httpu003a//ku6afpu002eallyesu002ecom/su003fuseru003dku6afpu007cu007c135000_playeru0026dbu003dku6afpu0026borderu003d0u0026localu003dlistu0026kvu003duu007c13865433u003bvu007c2BAHMOZYIdXaapP7u003bhu007c0u003btu007cu0025E3u002580u00258Au0025E9u0025BEu002599u0025E9u002597u0025A8u0025E9u0025A3u00259Eu0025E7u002594u0025B2u0025E3u002580u00258B3Du0025E7u0025BBu002588u0025E6u00259Eu002581u0025E7u002589u002588u0025E9u0025A2u002584u0025E5u002591u00258Au0025E7u002589u002587","comm":0,"fav":1,"c":135000,"picpath":"httpu003a//i3u002eku6imgu002ecom/encode/picpath/2011/12/13/12/1326944298669_11955981_11955981/5u002ejpg","bigpicpath":"httpu003a//i3u002eku6imgu002ecom/encode/picpath/2011/12/13/12/1326944298669_11955981_11955981/105u002ejpg","commvid":"","hd":0,"logocoors":"",

"profitAddr":"httpu003a//stat1u002e888u002eku6u002ecom/dostatu002edou003fmu003ddostatu0026pu003dNA7Im66Uj_62pnNTt9hnu002dBgmfFPALlnxBSjtWepJvbNf6CUbb0hA8yYLTfizGJuj","sndap2p":"1","vtime":63,"vtimems":63000,"videosize":"799u00406682145","f":"httpu003a//mainu002egslbu002eku6u002ecom/s1/OX4lHo2jwQvT5iRb/1323829297360/8750c7c3f542999498ff0cff749ca3f2/1323929700140/v363/68/13/8a1df93054b104807534189f1731d9d7u002df4vu002dh264u002daacu002d1446u002d32u002d63018u002e0u002d11695593u002d1323815140009u002df485dfe19b9155ec51543954cbeea8dcu002d1u002d00u002d00u002d00u002ef4v","r":99},"status":1} };

怎样提取"httpu003a//mainu002egslbu002eku6u002ecom/s1/OX4lHo2jwQvT5iRb/1323829297360/8750c7c3f542999498ff0cff749ca3f2/1323929700140/v363/68/13/8a1df93054b104807534189f1731d9d7u002df4vu002dh264u002daacu002d1446u002d32u002d63018u002e0u002d11695593u002d1323815140009u002df485dfe19b9155ec51543954cbeea8dcu002d1u002d00u002d00u002d00u002ef4v"yp这段并且国际码转换成正常的呢?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

剑心龙吟 2021-11-08 20:19:32

这个Script不是全部吧?用Java6里的ScriptEngine可以提取出来:

    public static void main(String[] args) throws IOException, ScriptException {
        String string = new String(Files.readAllBytes(Paths.get("/home/canghailan/js-code")));
        ScriptEngine engine = new ScriptEngineManager().getEngineByName("javascript");
        engine.eval("var A = {}");
        engine.eval(string);
        String value = engine.eval("A.VideoInfo['data']['data']['f']").toString();
        System.out.println(value);
    }

/home/canghailan/js-code里是你给的script

结果是:http://main.gslb.ku6.com/s1/OX4lHo2jwQvT5iRb/1323829297360/8750c7c3f542999498ff0cff749ca3f2/1323929700140/v363/68/13/8a1df93054b104807534189f1731d9d7-f4v-h264-aac-1446-32-63018.0-11695593-1323815140009-f485dfe19b9155ec51543954cbeea8dc-1-00-00-00.f4v

能否归途做我良人 2021-11-08 18:50:18

这个可以转码正常: 

URLDecoder.decode("httpu003a//mainu002egslbu002eku6u002ecom/s1/OX4lHo2jwQvT5iRb/1323829297360/8750c7c", "utf-8");

http://main.gslb.ku6.com/s1/OX4lHo2jwQvT5iRb/1323829297360/8750c7c

无声静候 2021-11-08 11:20:31

我也不知道哦

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文