mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 06:35:12 +00:00 
			
		
		
		
	[extractor] Add _perform_login function (#2943)
				
					
				
			* Adds new functions `_initialize_pre_login` and `_perform_login` as part of the extractor API * Adds `ie.supports_login` to the public API
This commit is contained in:
		| @@ -25,13 +25,11 @@ class ZattooPlatformBaseIE(InfoExtractor): | ||||
|     def _host_url(self): | ||||
|         return 'https://%s' % (self._API_HOST if hasattr(self, '_API_HOST') else self._HOST) | ||||
|  | ||||
|     def _login(self): | ||||
|         username, password = self._get_login_info() | ||||
|         if not username or not password: | ||||
|             self.raise_login_required( | ||||
|                 'A valid %s account is needed to access this media.' | ||||
|                 % self._NETRC_MACHINE) | ||||
|     def _real_initialize(self): | ||||
|         if not self._power_guide_hash: | ||||
|             self.raise_login_required('An account is needed to access this media', method='password') | ||||
|  | ||||
|     def _perform_login(self, username, password): | ||||
|         try: | ||||
|             data = self._download_json( | ||||
|                 '%s/zapi/v2/account/login' % self._host_url(), None, 'Logging in', | ||||
| @@ -52,7 +50,7 @@ class ZattooPlatformBaseIE(InfoExtractor): | ||||
|  | ||||
|         self._power_guide_hash = data['session']['power_guide_hash'] | ||||
|  | ||||
|     def _real_initialize(self): | ||||
|     def _initialize_pre_login(self): | ||||
|         webpage = self._download_webpage( | ||||
|             self._host_url(), None, 'Downloading app token') | ||||
|         app_token = self._html_search_regex( | ||||
| @@ -72,8 +70,6 @@ class ZattooPlatformBaseIE(InfoExtractor): | ||||
|                 'format': 'json', | ||||
|             })) | ||||
|  | ||||
|         self._login() | ||||
|  | ||||
|     def _extract_cid(self, video_id, channel_name): | ||||
|         channel_groups = self._download_json( | ||||
|             '%s/zapi/v2/cached/channels/%s' % (self._host_url(), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 pukkandan
					pukkandan