lonng / yinyue

MV and MP3 downloader for NetEase cloud music (https://music.163.com)
48 stars 11 forks source link

Truncate query parameter in URL #6

Closed xiaochuanyu closed 4 years ago

xiaochuanyu commented 4 years ago

Sometimes the URL for MVs may have query parameter afterwards which screws up the file extension:

$ cargo run -- -t mv https://music.163.com/#/song?id=542906780
...
2020-07-25 13:54:12,542 INFO  [main] Downloading: [1/1]大傻DamnShine & GAI周延 & 布瑞吉Bridge - 长河.mp4?wsSecret=61c1d4285520dcd9186adaf36b27aac0&wsTime=1595699652]
2020-07-25 13:54:12,543 ERROR [main] Download file failed: Io(Os { code: 123, kind: Other, message: "The filename, directory name, or volume label syntax is incorrect." })
...

This PR fixes that by truncating after ?.

lonng commented 4 years ago

@xiaochuanyu Thanks for your contribution.