我有一个名为 link 的字符串变量,它从远程站点返回数据。我如何在等号(令牌=)之后解析数据?例如,我想从下面的行中获取“234132421reafdfasdfsdfdsf3234423edfasfdsf”。
file: "http://www.aaastreams.com/playlist.m3u8?token=234132421reafdfasdfsdfdsf3234423edfasfdsf"
});
蟒蛇代码:
req = urllib2.Request('http://www.somesite.com/test.php')
req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0')
response = urllib2.urlopen(req)
link = response.read()
来自“打印链接;”的示例响应值:
.......rest of response
<script>
jwplayer("container").setup({
width:700,
height:220,
primary: "hls",
title:"streams",
autostart:true,
image: "./1.jpg",
file: "http://www.aaastreams.com/playlist.m3u8?token=234132421reafdfasdfsdfdsf3234423edfasfdsf"
});
jwplayer().onError(function(){
jwplayer().load({file:"http://www.aaa.com/jwplayer/ads.mp4",image:"http://aaa.com/2.png"});
jwplayer().play();
});
</script>
.......rest of response