b5i / YouTubeKit

A way to interact with YouTube's API in Swift (without any API key!)
https://swiftpackageindex.com/b5i/YouTubeKit
MIT License
83 stars 9 forks source link

Search results are in French regardless of the value of selectedLocale #1

Closed omarsinan closed 1 year ago

omarsinan commented 1 year ago

Hey, awesome project! I had a small issue and I'm not sure if I'm missing something, but no matter what the selectedLocale is, the results returned by SearchResponse are always in French. Here is my code:

let YTM = YouTubeModel()

let textQuery: String = "my super query"
let dataParameters: [HeadersList.AddQueryInfo.ContentTypes : String] = [
    .query: textQuery
]

SearchResponse.sendRequest(youtubeModel: YTM, data: dataParameters, result: { result, error in
     /// Process here the result.
     print(result)

     /// If the result is nil you should obtain an error explaining why there is one.
     print(error)
})

In this case, YTM.selectedLocale is "en".

Here is a sample of the response:

YouTubeKit.YTVideo(id: Optional(0), videoId: "...", title: Optional("..."), channel: YouTubeKit.YTLittleChannelInfos(channelId: Optional("..."), name: Optional("..."), thumbnails: [...]), viewCount: Optional("1,3 M de vues"), timePosted: Optional("il y a 2 ans"), timeLength: Optional("..."), thumbnails: [...])

Any help is appreciated, thanks!

b5i commented 1 year ago

Hello, thank for using YouTubeKit! There is indeed a problem with YouTubeModel: I haven't modified the locales in the request's body. It should be fixed very soon. Thanks for reporting this issue!

b5i commented 1 year ago

Should be resolved in 1.0.1, tell me if you encounter any other error.

omarsinan commented 1 year ago

Works perfectly, thank you!