Skip to content

Commit

Permalink
Replace deprecated distuils, apply pull request eMBee#41 from @jessew…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Brey committed Jul 25, 2023
1 parent fa82fce commit 143a06d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions vimeo-download.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import sys
import subprocess as sp
import os
import distutils.core
import argparse
from urllib.parse import urljoin
from shutil import which
import datetime

import random
Expand Down Expand Up @@ -43,7 +43,7 @@
FFMPEG_BIN = 'ffmpeg.exe'
else:
try:
FFMPEG_BIN = distutils.spawn.find_executable("ffmpeg")
FFMPEG_BIN = which("ffmpeg")
except AttributeError:
FFMPEG_BIN = 'ffmpeg'

Expand Down Expand Up @@ -88,9 +88,11 @@ def download_video(base_url, content):


def download_audio(base_url, content):
"""Downloads the video portion of the content into the INSTANCE_TEMP folder"""
"""Downloads the audio portion at max resolution of the content into the INSTANCE_TEMP folder"""
result = True
audio = content[0]
bitrates = [(i, d['bitrate']) for (i, d) in enumerate(content)]
idx, _ = max(bitrates, key=lambda t: t[1])
audio = content[idx]
audio_base_url = urljoin(base_url, audio['base_url'])
print('audio base url:', audio_base_url)

Expand Down Expand Up @@ -162,7 +164,7 @@ def merge_audio_video(output_filename):
print("Output filename set to:", output_filename)

if not args.skip_download:
master_json_url = args.url
master_json_url = args.url.strip()

# get the content
resp = requests.get(master_json_url)
Expand Down

0 comments on commit 143a06d

Please sign in to comment.