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

Use immutable Map factory methods. #986

Merged
merged 2 commits into from
Jan 2, 2023

Conversation

Isira-Seneviratne
Copy link
Member

public static Map<String, List<String>> getYouTubeHeaders()
throws ExtractionException, IOException {
final var headers = getClientInfoHeaders();
headers.put("Cookie", List.of(generateConsentCookie()));
Copy link
Member

Choose a reason for hiding this comment

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

I think the downloader might need to add cookies, e.g. recaptcha cookies. Would it be able to do so with List.of()? I might be wrong on this though, since NewPipe itself does not actually modify the headers.

Copy link
Member

Choose a reason for hiding this comment

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

|| isTvHtml5SimplyEmbeddedPlayerStreamingUrl(baseStreamingUrl);
final boolean isAndroidStreamingUrl = isAndroidStreamingUrl(baseStreamingUrl);
final boolean isIosStreamingUrl = isIosStreamingUrl(baseStreamingUrl);
final boolean isHtml5StreamingUrl = YoutubeParsingHelper.isWebStreamingUrl(baseStreamingUrl)
Copy link
Member

Choose a reason for hiding this comment

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

Why are you changing imports? This is an unrelated change, and also related to personal preference, so it should be avoided. Also in other files. Please undo it.

@Stypox
Copy link
Member

Stypox commented Nov 29, 2022

Wait: since you turned a music.youtube.com into a https://music.youtube.com, a mock is now missing:

java.lang.NullPointerException: No mock response for request with url 'https://music.youtube.com/youtubei/v1/music/get_search_suggestions?alt=json&key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30&prettyPrint=false' exists in path 'src/test/resources/org/schabi/newpipe/extractor/services/youtube/youtubeParsingHelper'.

@Stypox
Copy link
Member

Stypox commented Nov 30, 2022

What did you do? I think it was perfectly ok to have https:// everywhere, you just had to update the mocks...

@Isira-Seneviratne
Copy link
Member Author

What did you do?

I switched to the old behavior of having the referrer exclude the URL protocol. I wasn't sure if including it would cause issues 😅

I think it was perfectly ok to have https:// everywhere, you just had to update the mocks...

Oh, okay. In that case, shall I undo the latest change?

@Stypox
Copy link
Member

Stypox commented Nov 30, 2022

Yes

@Stypox Stypox merged commit 45636b0 into TeamNewPipe:dev Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants