回答編集履歴

1

修正

2019/10/07 11:33

投稿

退会済みユーザー
test CHANGED
@@ -6,13 +6,11 @@
6
6
 
7
7
  url = 'https://www.youtube.com/watch?v=KP-2oBXwNuI'
8
8
 
9
- cmd = 'youtube-dl -e -s ' + url
9
+ res = subprocess.check_output(f'youtube-dl -e --get-id {url}'.split())
10
10
 
11
- res = subprocess.check_output(cmd.split())
11
+ res = res.decode('shift_jis').rstrip('\n').replace('\n', '-') # .decode('utf-8')
12
12
 
13
- print(res.decode('shift_jis').rstrip('\n') + '.mp3') # .decode('utf-8')?
13
+ print(res + '.mp3')
14
-
15
-
16
14
 
17
15
 
18
16