refactor(extractors): simplify and combine jwplayer extraction #2398
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that a lot of extractors are based on the following pattern:
scriptfile containing JWPlayer configPreviously, all extractors had their own logic for extracting the JWPlayer config, even though the JavaScript data parsed always looks the same. So there's been a lot of duplicated code that behaved inconsistent (i.e. some only supported
m3u8links and no other stream types likemp4and others didn't parse the subtitles).This logic is now handled by
JWPlayerHelper.kt.I've also noticed that some of the files could be merged, e.g.
contain almost the exact same logic and
also do the exact same thing. I suspect that all these providers are based on the exact same code (only some UI changes), but I haven't moved their extractors into the same class yet because I'd like to hear some other opinions first before doing that.
The deleted files are usages of the JWPlayer API on sites that no longer exist, so I removed them.