U
    พ๚gC  ใ                   @   sุ   d Z ddlmZmZ G dd deZG dd deZG dd deZG d	d
 d
eZG dd deZ	G dd deZ
G dd de
ZG dd de
ZG dd de
ZG dd de
ZG dd de
ZG dd de
ZdS )z'Library specific exception definitions.้    )ฺPatternฺUnionc                   @   s   e Zd ZdZdS )ฺPytubeErrorzไBase pytube exception that all others inherit.

    This is done to not pollute the built-in exceptions, which *could* result
    in unintended errors being unexpectedly and incorrectly handled within
    implementers code.
    Nฉฺ__name__ฺ
__module__ฺ__qualname__ฺ__doc__ฉ r
   r
   ๚5/tmp/pip-unpacked-wheel-1a9f0fi6/pytube/exceptions.pyr      s   r   c                   @   s   e Zd ZdZdS )ฺMaxRetriesExceededz#Maximum number of retries exceeded.Nr   r
   r
   r
   r   r      s   r   c                   @   s   e Zd ZdZdS )ฺHTMLParseErrorzHTML could not be parsedNr   r
   r
   r
   r   r      s   r   c                   @   s   e Zd ZdZdS )ฺExtractErrorz Data extraction based exception.Nr   r
   r
   r
   r   r      s   r   c                       s0   e Zd ZdZeeeef d fddZ  ZS )ฺRegexMatchErrorz)Regex pattern did not return any matches.)ฺcallerฺpatternc                    s&   t   | d| ก || _|| _dS )z
        :param str caller:
            Calling function
        :param str pattern:
            Pattern that failed to match
        z: could not find match for N)ฺsuperฺ__init__r   r   )ฺselfr   r   ฉฺ	__class__r
   r   r      s    zRegexMatchError.__init__)	r   r   r   r	   ฺstrr   r   r   ฺ__classcell__r
   r
   r   r   r      s   r   c                       s2   e Zd ZdZed fddZedd Z  ZS )ฺVideoUnavailablezBase video unavailable error.ฉฺvideo_idc                    s   || _ t  | jก dS ฉzN
        :param str video_id:
            A YouTube video identifier.
        N)r   r   r   ฺerror_stringฉr   r   r   r
   r   r   +   s    zVideoUnavailable.__init__c                 C   s   | j  dS )Nz is unavailabler   ฉr   r
   r
   r   r   3   s    zVideoUnavailable.error_stringฉ	r   r   r   r	   r   r   ฺpropertyr   r   r
   r
   r   r   r   )   s   r   c                       s2   e Zd ZdZed fddZedd Z  ZS )ฺAgeRestrictedErrorz>Video is age restricted, and cannot be accessed without OAuth.r   c                    s   || _ t  | j ก dS r   ฉr   r   r   r   r   r
   r   r   :   s    zAgeRestrictedError.__init__c                 C   s   | j  dS )Nz= is age restricted, and can't be accessed without logging in.r   r   r
   r
   r   r   B   s    zAgeRestrictedError.error_stringr    r
   r
   r   r   r"   8   s   r"   c                       s2   e Zd ZdZed fddZedd Z  ZS )ฺLiveStreamErrorzVideo is a live stream.r   c                    s   || _ t  | j ก dS r   r#   r   r   r
   r   r   I   s    zLiveStreamError.__init__c                 C   s   | j  dS )Nz' is streaming live and cannot be loadedr   r   r
   r
   r   r   Q   s    zLiveStreamError.error_stringr    r
   r
   r   r   r$   G   s   r$   c                       s.   e Zd Zed fddZedd Z  ZS )ฺVideoPrivater   c                    s   || _ t  | j ก dS r   r#   r   r   r
   r   r   W   s    zVideoPrivate.__init__c                 C   s   | j  dS )Nz is a private videor   r   r
   r
   r   r   _   s    zVideoPrivate.error_stringฉr   r   r   r   r   r!   r   r   r
   r
   r   r   r%   V   s   r%   c                       s.   e Zd Zed fddZedd Z  ZS )ฺRecordingUnavailabler   c                    s   || _ t  | j ก dS r   r#   r   r   r
   r   r   e   s    zRecordingUnavailable.__init__c                 C   s   | j  dS )Nz0 does not have a live stream recording availabler   r   r
   r
   r   r   m   s    z!RecordingUnavailable.error_stringr&   r
   r
   r   r   r'   d   s   r'   c                       s2   e Zd ZdZed fddZedd Z  ZS )ฺMembersOnlyzสVideo is members-only.

    YouTube has special videos that are only viewable to users who have
    subscribed to a content creator.
    ref: https://support.google.com/youtube/answer/7544492?hl=en
    r   c                    s   || _ t  | j ก dS r   r#   r   r   r
   r   r   y   s    zMembersOnly.__init__c                 C   s   | j  dS )Nz is a members-only videor   r   r
   r
   r   r      s    zMembersOnly.error_stringr    r
   r
   r   r   r(   r   s   r(   c                       s.   e Zd Zed fddZedd Z  ZS )ฺVideoRegionBlockedr   c                    s   || _ t  | j ก dS r   r#   r   r   r
   r   r      s    zVideoRegionBlocked.__init__c                 C   s   | j  dS )Nz  is not available in your regionr   r   r
   r
   r   r      s    zVideoRegionBlocked.error_stringr&   r
   r
   r   r   r)      s   r)   N)r	   ฺtypingr   r   ฺ	Exceptionr   r   r   r   r   r   r"   r$   r%   r'   r(   r)   r
   r
   r
   r   ฺ<module>   s   	