Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
abdlhay committed Nov 17, 2024
1 parent 25db9cd commit b51bfc4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/main/kotlin/com/abmo/providers/TvhaywProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.abmo.util.fetchDocument

class TvhaywProvider: Provider {

// TODO: Refactor duplicated code similar to PhimbetProvider.
// The logic for extracting video URLs is repeated across multiple providers.
// Consider moving the common code into a shared base class or utility function to reduce duplication.
override fun getVideoID(url: String): String? {
Expand Down
20 changes: 11 additions & 9 deletions src/main/kotlin/com/abmo/services/ProviderDispatcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ class ProviderDispatcher: KoinComponent {
* @return An instance of the Provider that matches the URL's host.
*/
fun getProviderForUrl(url: String): Provider {
return when(url.getHost()) {
"tvphim.my", "tvphim.cx", "tvphim.id" -> TvphimProvider(javaScriptExecutor)
"sieutamphim.com" -> SieutamphimProvider()
"phimbet.biz" -> PhimbetProvider()
"fimmoi.top" -> FimmoiProvider()
"motchill.taxi", "motchill.to", "subnhanh.win" -> MotchillProvider()
"animet3.biz" -> Animet3Provider()
"tvhayw.org" -> TvhaywProvider()
url.getHost().apply {
return when {
contains("tvphim") -> TvphimProvider(javaScriptExecutor)
equals("sieutamphim.com") -> SieutamphimProvider()
equals("phimbet.biz") -> PhimbetProvider()
equals("fimmoi.top") -> FimmoiProvider()
contains("motchill") || equals("subnhanh.win") -> MotchillProvider()
equals("animet3.biz") -> Animet3Provider()
equals("tvhayw.org") -> TvhaywProvider()

else -> AbyssToProvider()
else -> AbyssToProvider()
}
}
}

Expand Down

0 comments on commit b51bfc4

Please sign in to comment.