forked from recloudstream/cloudstream
		
	fixed this provider does not exist
This commit is contained in:
		
							parent
							
								
									cbf1975504
								
							
						
					
					
						commit
						2ac17cff0e
					
				
					 2 changed files with 11 additions and 1 deletions
				
			
		|  | @ -116,6 +116,15 @@ object APIHolder { | ||||||
|         return null |         return null | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     fun getApiFromUrlNull(url : String?) : MainAPI? { | ||||||
|  |         if (url == null) return null | ||||||
|  |         for (api in allProviders) { | ||||||
|  |             if(url.startsWith(api.mainUrl)) | ||||||
|  |                 return api | ||||||
|  |         } | ||||||
|  |         return null | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fun LoadResponse.getId(): Int { |     fun LoadResponse.getId(): Int { | ||||||
|         return url.replace(getApiFromName(apiName).mainUrl, "").replace("/", "").hashCode() |         return url.replace(getApiFromName(apiName).mainUrl, "").replace("/", "").hashCode() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -7,6 +7,7 @@ import androidx.lifecycle.ViewModel | ||||||
| import androidx.lifecycle.viewModelScope | import androidx.lifecycle.viewModelScope | ||||||
| import com.lagradost.cloudstream3.* | import com.lagradost.cloudstream3.* | ||||||
| import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull | import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull | ||||||
|  | import com.lagradost.cloudstream3.APIHolder.getApiFromUrlNull | ||||||
| import com.lagradost.cloudstream3.APIHolder.getId | import com.lagradost.cloudstream3.APIHolder.getId | ||||||
| import com.lagradost.cloudstream3.AcraApplication.Companion.setKey | import com.lagradost.cloudstream3.AcraApplication.Companion.setKey | ||||||
| import com.lagradost.cloudstream3.mvvm.Resource | import com.lagradost.cloudstream3.mvvm.Resource | ||||||
|  | @ -279,7 +280,7 @@ class ResultViewModel : ViewModel() { | ||||||
|         _publicEpisodes.postValue(Resource.Loading()) |         _publicEpisodes.postValue(Resource.Loading()) | ||||||
| 
 | 
 | ||||||
|         _apiName.postValue(apiName) |         _apiName.postValue(apiName) | ||||||
|         val api = getApiFromNameNull(apiName) |         val api = getApiFromNameNull(apiName) ?: getApiFromUrlNull(url) | ||||||
|         if (api == null) { |         if (api == null) { | ||||||
|             _resultResponse.postValue( |             _resultResponse.postValue( | ||||||
|                 Resource.Failure( |                 Resource.Failure( | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue