|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 mengmei886 于 2020-3-29 15:49 编辑
- <html>前面一大堆html内容省略。。。</html>html>
- <script>前面好多script</script>
- <script>
- var vm = new Vue({
- el: '#listApp',
- data: function () {
- return {
- activeLog: "first",
- uploadDir: '',
- isCS: "0",
- loading: true,
- hasCollected: true,
- titles: "添加",
- isShow: ("1" != '2' && ("910" == "1234" || false)) ? true : false,
- listQuery: {
- bizId: "10020",
- clueId: "129300co",
- contactUnitId: "929537",
- contentId: "222999",
- clueType: "1012",
- supPageNum: 1,
- },
- logQuery: {
- bizId: "10020",
- clueId: "129300co",
- contentId: "222999",
- clueType: "1012",
- pageNum: 1,
- numPerPage: 10,
- contentKey: ''
- },
- }}})
- </script>
- <script type="text/javascript"> 省略 </script>
- <script>好多script</script>
- <script>好多script</script>
复制代码
求助各位大佬,这是python爬的网站内容,我怎么样才能将其中的一个<script>中的listQuery提取出来呢?使用beautifulsoup和正则应该怎么写?
也就是我只想要
- listQuery: {
- bizId: "10020",
- clueId: "129300co",
- contactUnitId: "929537",
- contentId: "222999",
- clueType: "1012",
- supPageNum: 1,
- }
复制代码
或者{}中的内容,感谢各位大佬
- re.search(r'(listQuery: .*?\}),', a, re.DOTALL).group(1)
复制代码
a就是原始字符,正则真的很方便
|
|