metube icon indicating copy to clipboard operation
metube copied to clipboard

[Feature request] Add support for curl-cffi

Open janusn opened this issue 1 year ago • 5 comments

I have encountered some videos on vimeo require curl-cffi in order to download. Is there a way to include it or an option to bundle it with the image?

janusn avatar Jul 09 '24 16:07 janusn

The analysis of video sites is done by yt-dlp. I don't think yt-dlp will call it after adding some wheels.

PikuZheng avatar Jul 09 '24 23:07 PikuZheng

There is a specific Impersonation section on the readme of yt-dlp that mentioned how to integrate curl_cffi as the recommended solution.

Could you please take a look?

janusn avatar Jul 10 '24 00:07 janusn

Since it is difficult to determine the architecture, I think the easiest way is to inspect the running metube container and install it.

take x86_64 for example:

wget -qO- https://github.com/yifeikong/curl-impersonate/releases/download/v0.7.0/libcurl-impersonate-v0.7.0.x86_64-linux-musl.tar.gz |tar xvz -C /lib
apk add build-base gcc g++ musl-dev
pip install --no-cache-dir curl_cffi==0.5.10

and determine if the installation was successful

yt-dlp --list-impersonate-targets

PikuZheng avatar Jul 10 '24 02:07 PikuZheng

Thanks for your prompt reply.

Yeah, I am ok to add a little script to install it but it has to be done every time metube is updated.

Is it possible for the container to run scripts in a specific directory every time it starts up? Like what linuxserver.io does?

janusn avatar Jul 10 '24 02:07 janusn

build with this Dockerfile if you really want :)

PikuZheng avatar Jul 10 '24 05:07 PikuZheng

Fixed in #663

alexta69 avatar May 27 '25 16:05 alexta69

@alexta69 As the feature #663 has been implemented, I have tried to build a metube image from the Dockerfile you suggested. But there are errors that stops it from building successfully. Copied from dockage:

 ✔ Container metube  Started                                                                        1.0s 
[+] Pulling 1/0
 ✔ metube Skipped - No image to be pulled                                                           0.0s 
[+] Running 1/0
 ✔ Container metube  Running                                                                        0.0s 
[+] Running 2/2
 ✔ Container metube        Removed                                                                  1.3s 
 ✔ Network metube_default  Removed                                                                  0.9s 
[+] Pulling 1/0
 ✔ metube Skipped - No image to be pulled                                                           0.0s 
[+] Building 3.9s (14/16)                                                                 docker:default
 => [metube internal] load build definition from Dockerfile                                         0.2s
 => => transferring dockerfile: 2.05kB                                                              0.0s
 => [metube internal] load metadata for docker.io/library/python:3.11-alpine                        2.1s
 => [metube internal] load metadata for docker.io/library/node:lts-alpine                           2.0s
 => [metube internal] load .dockerignore                                                            0.0s
 => => transferring context: 2B                                                                     0.0s
 => [metube stage-1 1/7] FROM docker.io/library/python:3.11-alpine@sha256:d0199977fdae5d1109a89d0b  1.2s
 => => resolve docker.io/library/python:3.11-alpine@sha256:d0199977fdae5d1109a89d0b0014468465e014a  0.2s
 => => sha256:d0199977fdae5d1109a89d0b0014468465e014a9834d0a566ea50871b3255ade 10.30kB / 10.30kB    0.0s
 => => sha256:81d42a73add8e508771ee8e923f9f8392ec1c3d1e482d7d594891d06e78fb51c 1.74kB / 1.74kB      0.0s
 => => sha256:43665da319622502584882475cf1cdca6afe17495867f55be1bd36b3627533d1 5.16kB / 5.16kB      0.0s
 => [metube internal] load build context                                                            0.8s
 => => transferring context: 2B                                                                     0.0s
 => CANCELED [metube builder 1/4] FROM docker.io/library/node:lts-alpine@sha256:9f3ae04faa4d218882  1.1s
 => => resolve docker.io/library/node:lts-alpine@sha256:9f3ae04faa4d2188825803bf890792f33cc39033c9  0.2s
 => => sha256:9f3ae04faa4d2188825803bf890792f33cc39033c9241fc6bb201149470436ca 6.41kB / 6.41kB      0.0s
 => => sha256:4437d7c27c4b9306c577caa17577dc7b367fc320fb7469dbe2c994e23b11d11c 1.72kB / 1.72kB      0.0s
 => => sha256:4f021eec40925e3101cfed8ecb38d55b09bb9d5e65b72b64b8a22f440053d108 6.21kB / 6.21kB      0.0s
 => CACHED [metube stage-1 2/7] WORKDIR /app                                                        0.0s
 => ERROR [metube stage-1 3/7] COPY Pipfile* docker-entrypoint.sh ./                                0.0s
 => CACHED [metube stage-1 4/7] RUN wget -qO- https://github.com/yifeikong/curl-impersonate/releas  0.0s
 => CACHED [metube stage-1 5/7] RUN sed -i 's/\r$//g' docker-entrypoint.sh &&     chmod +x docker-  0.0s
 => ERROR [metube stage-1 6/7] COPY app ./app                                                       0.0s
 => CACHED [metube builder 2/4] WORKDIR /metube                                                     0.0s
 => ERROR [metube builder 3/4] COPY ui ./                                                           0.0s
------
 > [metube stage-1 3/7] COPY Pipfile* docker-entrypoint.sh ./:
------
------
 > [metube stage-1 6/7] COPY app ./app:
------
------
 > [metube builder 3/4] COPY ui ./:
------
failed to solve: failed to compute cache key: failed to calculate checksum of ref be9d2008-aa60-4de0-beb1-72bdae774d2a::9wj8maoqllx3kjf31bvlr22rn: "/ui": not found

janusn avatar May 28 '25 18:05 janusn

=> ERROR [metube stage-1 3/7] COPY Pipfile* docker-entrypoint.sh ./

file not found

=> ERROR [metube stage-1 6/7] COPY app ./app

dir not found

PikuZheng avatar May 28 '25 23:05 PikuZheng

@PikuZheng

Thank you very much. I have created a custom build from your wonderful image.

$ cat Dockerfile
FROM alexta69/metube:latest

WORKDIR /app

RUN wget -qO- https://github.com/lexiforest/curl-impersonate/releases/download/v1.0.0/curl-impersonate-v1.0.0.x86_64-linux-musl.tar.gz |tar xvz -C /lib && \
	apk add build-base gcc g++ musl-dev && \
	pip install --no-cache-dir curl_cffi

Unfortunately, the watchtower can no longer monitor updates of this image. 😅

janusn avatar May 29 '25 20:05 janusn

Does it mean I don't have to build it locally now?

janusn avatar Jun 04 '25 16:06 janusn