kewlbear / YoutubeDL

An iOS app using youtube-dl Python module with PythonKit Swift package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HookMain crash when using `extractInfo`

joshgare opened this issue · comments

Example project works without any issues and all unit tests working as expected too. However when I run the following code in a fresh project I get crash.

Code example:

        Task { @MainActor in
            let youtubeDL = YoutubeDL()
            let (formats, info) = try await youtubeDL.extractInfo(url: URL(string: "https://www.youtube.com/watch?v=WdFj7fUnmC0")!)
            print(formats, info)
        }

Crash info

Thread 5: EXC_BAD_ACCESS (code=2, address=0x2800001100)

Crash occurs on:

Hook.m

Line 55:

    ret = realMain(argc, argv);
    NSLog(@"%s: realMain=%d", __func__, ret);

When the following is called in YoutubeDL.swift:576

pythonObject = try await makePythonObject()

Fully expecting this to be something I am doing incorrectly.

I don't get it. Hook.m is from FFmpeg-iOS package, but just extracting info doesn't need FFmpeg. Maybe yt-dlp is checking if FFmpeg is available?

Yep, that confused me when I was trying to debug. I've attached a very simple example project that has the crash in it. Hopefully it's of some help @kewlbear.

ExampleCrash.zip

@joshgare Unfortunately, your example doesn't crash on my simulator. But I've noticed some issues and fixed YoutubeDL-iOS package. Please update to the latest version and let me know.

@joshgare Unfortunately, your example doesn't crash on my simulator. But I've noticed some issues and fixed YoutubeDL-iOS package. Please update to the latest version and let me know.

it work fine on simulator. but when we create a release versions it get stuck on extra info