Skip to content

Commit

Permalink
Upgrade youtube downloader on docker container start
Browse files Browse the repository at this point in the history
  • Loading branch information
deadman2000 committed Jul 28, 2024
1 parent d19a918 commit 834580f
Show file tree
Hide file tree
Showing 15 changed files with 231 additions and 1,402 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh eol=lf
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ RUN pip install --no-cache-dir -r requirements.txt

COPY work/*.py ./

CMD [ "python3", "./processor.py" ]
COPY entrypoint.sh ./
ENTRYPOINT ./entrypoint.sh
2 changes: 2 additions & 0 deletions docker-proc/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PREFIX=home
SERVER=http://192.168.1.17
7 changes: 3 additions & 4 deletions docker-proc/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ services:
image: deadman2099/video_ocr
restart: always
volumes:
- ./download:/usr/src/app/download
environment:
SERVER: http://192.168.1.17
PREFIX: home
- ../work/download:/usr/src/app/download
env_file:
- .env
2 changes: 1 addition & 1 deletion docker-proc/up.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
docker compose pull
docker compose up -d --scale proc=5
docker compose up -d --scale proc=16
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

pip install -U -r requirements.txt

python3 ./processor.py
300 changes: 22 additions & 278 deletions work/analysis.ipynb

Large diffs are not rendered by default.

33 changes: 9 additions & 24 deletions work/download_video.ipynb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "90349b15",
"cell_type": "raw",
"id": "698ba561-083a-46ab-8241-5a1a76951bee",
"metadata": {},
"source": [
"https://youtu.be/Oevq2aSOs0M"
"%pip install -U yt-dlp"
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "d42c659c",
"metadata": {},
"outputs": [],
Expand All @@ -20,7 +20,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "56707c00-30fd-4670-a272-7971f8686963",
"metadata": {},
"outputs": [],
Expand All @@ -35,27 +35,13 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "ea354196",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[youtube] Extracting URL: https://www.youtube.com/watch?v=rd-epKNOo0U\n",
"[youtube] rd-epKNOo0U: Downloading webpage\n",
"[youtube] rd-epKNOo0U: Downloading android player API JSON\n",
"[youtube] rd-epKNOo0U: Downloading MPD manifest\n",
"[info] rd-epKNOo0U: Downloading 1 format(s): 22\n",
"[download] download\\rd-epKNOo0U.mp4 has already been downloaded\n",
"[download] 100% of 406.00MiB\n"
]
}
],
"outputs": [],
"source": [
"with YoutubeDL(ydl_opts) as ydl:\n",
" ydl.download('https://www.youtube.com/watch?v=rd-epKNOo0U')"
" ydl.download('https://www.youtube.com/watch?v=q4rYhQpGmRI')"
]
}
],
Expand All @@ -74,8 +60,7 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 834580f

Please sign in to comment.