Try?
Browse files- Dockerfile +6 -1
- app.py +1 -1
Dockerfile
CHANGED
|
@@ -9,8 +9,13 @@ ENV PYTHONUNBUFFERED=1 \
|
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
ca-certificates \
|
| 11 |
curl \
|
|
|
|
|
|
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
# Create non-root user
|
| 15 |
RUN useradd -m -u 1000 user
|
| 16 |
USER user
|
|
@@ -27,4 +32,4 @@ COPY --chown=user . .
|
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
# Run application
|
| 30 |
-
CMD ["python", "app.py"]
|
|
|
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
ca-certificates \
|
| 11 |
curl \
|
| 12 |
+
nodejs \
|
| 13 |
+
npm \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
+
# Install npm package
|
| 17 |
+
RUN npm install -g youtube-po-token-generator
|
| 18 |
+
|
| 19 |
# Create non-root user
|
| 20 |
RUN useradd -m -u 1000 user
|
| 21 |
USER user
|
|
|
|
| 32 |
EXPOSE 7860
|
| 33 |
|
| 34 |
# Run application
|
| 35 |
+
CMD ["python", "app.py"]
|
app.py
CHANGED
|
@@ -13,7 +13,7 @@ def download_audio(url):
|
|
| 13 |
try:
|
| 14 |
# Configure YouTube client
|
| 15 |
logger.info("Initializing YouTube object...")
|
| 16 |
-
yt = YouTube(url)
|
| 17 |
|
| 18 |
# Get best audio stream
|
| 19 |
audio_stream = yt.streams.filter(only_audio=True).order_by('abr').desc().first()
|
|
|
|
| 13 |
try:
|
| 14 |
# Configure YouTube client
|
| 15 |
logger.info("Initializing YouTube object...")
|
| 16 |
+
yt = YouTube(url, 'WEB')
|
| 17 |
|
| 18 |
# Get best audio stream
|
| 19 |
audio_stream = yt.streams.filter(only_audio=True).order_by('abr').desc().first()
|