kewlbear / YoutubeDL

An iOS app using youtube-dl Python module with PythonKit Swift package
MIT License
210 stars 36 forks source link

get stream URL #13

Open Franknxtn opened 1 year ago

Franknxtn commented 1 year ago

Is there a way i can get the steam URL without the downloading?

kewlbear commented 1 year ago

Maybe this? https://github.com/kewlbear/YoutubeDL-iOS/issues/8

Franknxtn commented 1 year ago
Screenshot 2023-05-03 at 10 13 33 PM

This shows up in log when i try to use this library. Is this normal?

kewlbear commented 1 year ago

I guess you can ignore it. Maybe setting some environment variable to a writable path could fix it.

kewlbear commented 1 year ago

Looks like you can use this:

--cache-dir DIR                 Location in the filesystem where yt-dlp can
                                store some downloaded information (such as
                                client ids and signatures) permanently. By
                                default ${XDG_CACHE_HOME}/yt-dlp
Franknxtn commented 1 year ago

I i try to extract info using extractInfo(url: URL) function, It works for first time. However, if i call this function in quick succession, the framework crashes.

Below is code sample i am using for link extraction:

 let youtubeDL: PythonObject = try await YtDlp().yt_dlp.YoutubeDL(["nocheckcertificate": true])

        let info = try PythonDecoder()
            .decode(
                Info.self,
                from: youtubeDL
                    .extract_info
                    .throwing
                    .dynamicallyCall(withKeywordArguments: ["": "WdFj7fUnmC0", "download": false])
            )

It returns me info object which contains [Format].

If i call above method in quick succession, it crashes randomly.

kewlbear commented 1 year ago

Can you show stack trace or other relevant console output?

Franknxtn commented 1 year ago

Sure, here are the stack traces:

Screenshot 2023-05-07 at 9 22 49 PM Screenshot 2023-05-07 at 9 23 21 PM Screenshot 2023-05-07 at 9 23 40 PM Screenshot 2023-05-07 at 9 23 59 PM Screenshot 2023-05-07 at 9 24 14 PM Screenshot 2023-05-07 at 9 24 27 PM
kewlbear commented 1 year ago

Seems to me some kind of memory allocation or infinite loop issue.

f0enix commented 1 year ago

I i try to extract info using extractInfo(url: URL) function, It works for first time. However, if i call this function in quick succession, the framework crashes.

Below is code sample i am using for link extraction:

 let youtubeDL: PythonObject = try await YtDlp().yt_dlp.YoutubeDL(["nocheckcertificate": true])

        let info = try PythonDecoder()
            .decode(
                Info.self,
                from: youtubeDL
                    .extract_info
                    .throwing
                    .dynamicallyCall(withKeywordArguments: ["": "WdFj7fUnmC0", "download": false])
            )

It returns me info object which contains [Format].

If i call above method in quick succession, it crashes randomly.

I tried using this but it fails on certain non video urls due to the missing formats key in the response. Have you encountered this issue? I posted more details here: https://github.com/kewlbear/YoutubeDL-iOS/issues/9#issuecomment-1576410513