Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for YouTube Music search #291

Merged
merged 17 commits into from
Apr 3, 2020
Merged

Add support for YouTube Music search #291

merged 17 commits into from
Apr 3, 2020

Conversation

wb9688
Copy link
Contributor

@wb9688 wb9688 commented Mar 17, 2020

  • I carefully read the contribution guidelines and agree to them.
  • I did test the API against NewPipe.
  • I agree to ASAP create a PULL request for NewPipe for making in compatible when I changed the api.

I have to do a bit of cleaning up, make getYoutubeMusicKeys() more reliable and add tests. The problem with adding tests is that DownloaderTestImpl somehow behaves weirdly, which causes it to not work. The code works fine with OkHttp on Android in NewPipe.

@B0pol
Copy link
Member

B0pol commented Mar 17, 2020

Already talked about it in irc, channel are unusuable from youtube music search : no streams, no subscribers count, there are only banner and profile picture

@wb9688 wb9688 marked this pull request as ready for review March 20, 2020 10:35
@wb9688 wb9688 added enhancement New feature or request youtube service, https://www.youtube.com/ labels Mar 20, 2020
@wb9688
Copy link
Contributor Author

wb9688 commented Mar 20, 2020

This PR is 100% finished now.

@TobiGr: Could this be included in v0.19.0? It's not really a big change.

Map<String, List<String>> headers = new HashMap<>();
headers.put("X-YouTube-Client-Name", Collections.singletonList(youtubeMusicKeys[1]));
headers.put("X-YouTube-Client-Version", Collections.singletonList(youtubeMusicKeys[2]));
headers.put("Origin", Collections.singletonList("https://music.youtube.com"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, the default http client from java has some restrictions about request headers.

I think using another client for tests is the right choice (like you did earlier, OkHttp is a good one).

Should we do it in its own pull request? The front end is already using it, don't think too many problems would be a result of this, but then we can test thoroughly what kind of effects it will have.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should indeed be a different PR. I think OkHttp should be used, so we have the exact same behavior in the tests as in NewPipe.

Copy link
Contributor

@mauriciocolli mauriciocolli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed quite a bit of these null pointer exceptions, mainly because it's hard/verbose to check every selection made with the library we use right now (which leads to try-catch hell, null checks hell too).

Maybe we should try something equivalent to jq (JSON processor) for our value selections as well?

I should open a separate issue about it...

mauriciocolli
mauriciocolli previously approved these changes Mar 24, 2020
Copy link
Contributor

@mauriciocolli mauriciocolli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also 3b4fca8, what about the changes from #280? (No harm in doing nothing I guess, not the cleanest though).

Copy link
Contributor

@mauriciocolli mauriciocolli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a second look, I think it makes sense to create a separate class specifically for the music version, as you already did in the tests.

In my opinion, having isMusicSearch in every method just unnecessarily complicate things, as it could be done only once when StreamingService#getSearchExtractor is called to decide which extractor will be used.

@wb9688
Copy link
Contributor Author

wb9688 commented Apr 1, 2020

In a second look, I think it makes sense to create a separate class specifically for the music version, as you already did in the tests.

@mauriciocolli: Like we're doing with the mixes? I agree and I'll fix that today.

@wb9688 wb9688 requested a review from mauriciocolli April 1, 2020 08:29
@wb9688 wb9688 requested a review from mauriciocolli April 1, 2020 14:01
@wb9688 wb9688 dismissed mauriciocolli’s stale review April 1, 2020 14:03

I pushed new changes that fixes what he pointed out

Copy link
Contributor

@mauriciocolli mauriciocolli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@TobiGr TobiGr merged commit b81e22d into TeamNewPipe:dev Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request youtube service, https://www.youtube.com/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants