![Board logo](images/default/logo.gif)
标题: [文本处理] 【已解决】怎么提取js里面的指定字符 [打印本页]
作者: a6513375 时间: 2020-3-10 16:32 标题: 【已解决】怎么提取js里面的指定字符
本帖最后由 a6513375 于 2020-3-11 17:25 编辑
我弄了个下载网易云音乐的批处理,
在获取歌词的时候获取到了json- {"songStatus":3,"lyricVersion":6,"lyric":"[by:Trap_Girl]\n[00:00.40]And every single year\n[00:02.59]I'm drowning in my tears\n[00:05.65]I'm drowning in my tears again\n[00:11.71]I can't seem to forget the pain I seem to give\n[00:17.33]The pain I seem to give my friend\n[00:23.31]And every single year\n[00:26.44]I'm drowning in my tears\n[00:29.50]I'm drowning in my tears again\n[00:34.64]I can't seem to forget the pain I seem to give\n[00:41.48]The pain I seem to give my friend\n[00:46.00]\n[00:47.08]Oh oh\n[00:50.17]Oh oh\n[00:52.35]Oh oh\n[00:55.01]Ho oh\n[00:58.15]Ho oh\n[01:01.13]Ho oh\n[01:04.18]Woah oh\n[01:07.16]Ho oh\n[01:09.61]Woah oh\n[01:11.09]Woah oh\n[01:12.79]\n[01:23.59]And every single year\n[01:26.34]I'm drowning in my tears\n[01:29.37]I'm drowning in my tears again\n[01:34.96]I can't seem to forget the pain I seem to give\n[01:41.39]The pain I seem to give my friend (Woah oh)\n[01:47.98]And every single year\n[01:50.32]I'm drowning in my tears (Woah oh)\n[01:53.44]I'm drowning in my tears again (Woah oh)\n[01:58.74]Woah oh\n[02:00.14]I can't seem to forget the pain I seem to give(Woah oh)\n[02:05.85]The pain I seem to give my friend (Woah oh Woah oh)\n[02:12.36]\n[02:35.48]And every single year\n[02:38.30]I'm drowning in my tears\n[02:41.32]I'm drowning in my tears again\n[02:47.46]I can't seem to forget the pain I seem to give\n[02:53.75]The pain I seem to give my friend\n[02:59.21]Woah oh","code":200}
复制代码
我想获取lyric项的内容 就是歌词
我用本站的解析器http://www.bathome.net/viewthread.php?tid=34073&highlight=json
但是解析不出来 如果解析出来就是字符丢失
有人会吗...
作者: xczxczxcz 时间: 2020-3-10 17:15
- $str = @'
- {"songStatus":3,"lyricVersion":6,"lyric":"[by:Trap_Girl]\n[00:00.40]And every single year\n[00:02.59]I'm drowning in my tears\n[00:05.65]I'm drowning in my tears again\n[00:11.71]I can't seem to forget the pain I seem to give\n[00:17.33]The pain I seem to give my friend\n[00:23.31]And every single year\n[00:26.44]I'm drowning in my tears\n[00:29.50]I'm drowning in my tears again\n[00:34.64]I can't seem to forget the pain I seem to give\n[00:41.48]The pain I seem to give my friend\n[00:46.00]\n[00:47.08]Oh oh\n[00:50.17]Oh oh\n[00:52.35]Oh oh\n[00:55.01]Ho oh\n[00:58.15]Ho oh\n[01:01.13]Ho oh\n[01:04.18]Woah oh\n[01:07.16]Ho oh\n[01:09.61]Woah oh\n[01:11.09]Woah oh\n[01:12.79]\n[01:23.59]And every single year\n[01:26.34]I'm drowning in my tears\n[01:29.37]I'm drowning in my tears again\n[01:34.96]I can't seem to forget the pain I seem to give\n[01:41.39]The pain I seem to give my friend (Woah oh)\n[01:47.98]And every single year\n[01:50.32]I'm drowning in my tears (Woah oh)\n[01:53.44]I'm drowning in my tears again (Woah oh)\n[01:58.74]Woah oh\n[02:00.14]I can't seem to forget the pain I seem to give(Woah oh)\n[02:05.85]The pain I seem to give my friend (Woah oh Woah oh)\n[02:12.36]\n[02:35.48]And every single year\n[02:38.30]I'm drowning in my tears\n[02:41.32]I'm drowning in my tears again\n[02:47.46]I can't seem to forget the pain I seem to give\n[02:53.75]The pain I seem to give my friend\n[02:59.21]Woah oh","code":200}
- '@
- $json = ConvertFrom-json $str;
- $json.lyric;
复制代码
作者: a6513375 时间: 2020-3-10 17:42
本帖最后由 a6513375 于 2020-3-10 18:04 编辑
回复 2# xczxczxcz
这是啥东西
我说的是Bat , 批处理...
作者: Batcher 时间: 2020-3-10 18:44
回复 3# a6513375
PowerShell脚本可以这样执行:
http://bbs.bathome.net/thread-31071-1-1.html
推荐试试
作者: a6513375 时间: 2020-3-10 19:09
本帖最后由 a6513375 于 2020-3-10 20:23 编辑
回复 4# Batcher
好的 谢谢 我去试试
感谢!成功了!
还有个问题
我这个json长这个样子- {"songs":[{"name":"Don't Forget","id":1325390370,"pst":0,"t":0,"ar":[{"id":1193377,"name":"Toby Fox","tns":[],"alias":[]},{"id":65977,"name":"Laura Shigihara","tns":[],"alias":[]}],"alia":[],"pop":95.0,"st":0,"rt":"","fee":0,"v":11,"crbt":null,"cf":"","al":{"id":74266887,"name":"DELTARUNE Chapter 1 OST","picUrl":"https://p1.music.126.net/jru1E6T1yg4e95uTlhsMSg==/109951163665264121.jpg","tns":[],"pic_str":"109951163665264121","pic":109951163665264121},"dt":51424,"h":{"br":320000,"fid":0,"size":2059538,"vd":1973.0},"m":{"br":192000,"fid":0,"size":1235740,"vd":4532.0},"l":{"br":128000,"fid":0,"size":823841,"vd":5292.0},"a":null,"cd":"1","no":39,"rtUrl":null,"ftype":0,"rtUrls":[],"djId":0,"copyright":2,"s_id":0,"mark":262144,"originCoverType":0,"mst":9,"cp":0,"mv":0,"rtype":0,"rurl":null,"publishTime":1541001600007}],"privileges":[{"id":1325390370,"fee":0,"payed":0,"st":0,"pl":320000,"dl":999000,"sp":7,"cp":1,"subp":1,"cs":false,"maxbr":999000,"fl":320000,"toast":false,"flag":0,"preSell":false,"playMaxbr":999000,"downloadMaxbr":999000}],"code":200}
复制代码
我只能读取到songs 其他的读取不了 譬如 name id
作者: went 时间: 2020-3-10 21:43
回复 5# a6513375
$json.songs.name
$json.songs.id
作者: a6513375 时间: 2020-3-11 07:48
回复 6# went
感谢 可以了
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |