kewlbear / YoutubeDL-iOS

Swift package of youtube_dl python module for iOS
MIT License
112 stars 35 forks source link

how can I extract direct link? using it. #8

Closed DAZABAMUKER closed 1 year ago

DAZABAMUKER commented 1 year ago

Hello, I'm just a beginner of swift. I just wanted to play YouTube video with avplayer to change the video eq to do so I need to extract direct link to use. so I read your YouTubeDL git and source code of it a lot for 1 month but I cannot understand it cause my studying is low. how can I extract direct link of video and play on avfoundation? pls I really want to do it for my study like 'Musi' on App Store...

kewlbear commented 1 year ago

You can extract URLs for many formats using YoutubeDL. You should use a format that AVFoundation can play. Probably an mp4 using HLS, but you should exclude AV1 codec.

DAZABAMUKER commented 1 year ago

You can extract URLs for many formats using YoutubeDL. You should use a format that AVFoundation can play. Probably an mp4 using HLS, but you should exclude AV1 codec.

extractInfo로 인포를 얻은 뒤 formats.filter { !$0.isRemuxingNeeded && !$0.isTranscodingNeeded }.last 자체가 url 인가요? 이 url을 avplayer 넣으면 동작하나요? format의 url에 접근할 수는 없죠?

anyway your beautiful Code was very helpful for my swift learning ^^ thx~

kewlbear commented 1 year ago

https://github.com/kewlbear/YoutubeDL-iOS/blob/811ea597014bc483f44737a1d80c54d0896c36b0/Sources/YoutubeDL/YoutubeDL.swift#L59

참고하세요.

DAZABAMUKER commented 1 year ago

url이 public이 아니라서 package로 다운 받고 youtubeDL이 수정이 안되서 url을 가져오지는 못하고 url request만 접근이 가능한것 같아요..

DAZABAMUKER commented 1 year ago

urlRequest.url이면 쉽게 접근 가능했네요 감사합니다 정말 최고세요 ㅎㅎ