U
    g                     @   sL   d dl mZ ddlmZ G dd deZG dd deZG dd	 d	eZd
S )   )InfoExtractor   )int_or_nonec                   @   s   e Zd Zdd ZdS )AudiodraftBaseIEc                 C   st   | j d|dddd|  d}t|d |d|d	 d
d|d|d|dt|dt|dd
S )NzFhttps://www.audiodraft.com/scripts/general/player/getPlayerInfoNew.phpz0application/x-www-form-urlencoded; charset=UTF-8ZXMLHttpRequest)zContent-typezX-Requested-Withzid=)headersdataZentry_idZentry_titlepathnonemp3Zdesigner_nameZdesigner_idZ	entry_urlZentry_likesZentry_rating)
idtitleurlZvcodecextuploaderuploader_idZwebpage_url
like_countaverage_rating)Z_download_jsonencodestrgetr   )selfplayer_entry_idZ	data_json r   ?/tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/audiodraft.py_audiodraft_extract_from_id   s&     
z,AudiodraftBaseIE._audiodraft_extract_from_idN)__name__
__module____qualname__r   r   r   r   r   r      s   r   c                   @   sh   e Zd ZdZdZddddddd	ed
dddddddd	ed
dddddddd	ed
dgZdd ZdS )AudiodraftCustomIEzAudiodraft:customz6https?://(?:[-\w]+)\.audiodraft\.com/entry/(?P<id>\d+)z*http://nokiatune.audiodraft.com/entry/5874Z9485r
   zHula Hula CallsZ	unclemakiZ13512   r   r   r   r   r   r   r   r   Z	info_dictz+http://vikinggrace.audiodraft.com/entry/501Z22241z	MVG HappyZfrogZ19142z*http://timferriss.audiodraft.com/entry/765Z19710Zferris03ZmalexZ17335c                 C   s0   |  |}| ||}| d||d}| |S )Nz$playAudio\(\'(player_entry_\d+)\'\);zplay entry id)	_match_idZ_download_webpageZ_search_regexr   )r   r   video_idZwebpager   r   r   r   _real_extractC   s    
   z AudiodraftCustomIE._real_extractNr   r   r   ZIE_NAMEZ
_VALID_URLintZ_TESTSr$   r   r   r   r   r      sD   #r   c                	   @   s8   e Zd ZdZdZddddddd	ed
dgZdd ZdS )AudiodraftGenericIEzAudiodraft:genericzEhttps?://www\.audiodraft\.com/contests/[^/#]+#entries&eid=(?P<id>\d+)zShttps://www.audiodraft.com/contests/570-Score-A-Video-Surprise-Us#entries&eid=30138Z30138r
   zDROP in sound_V2Z
TiagoSilvaZ19452   r    r!   c                 C   s   |  |}| d| S )NZplayer_entry_)r"   r   )r   r   r#   r   r   r   r$   \   s    
z!AudiodraftGenericIE._real_extractNr%   r   r   r   r   r'   K   s   r'   N)commonr   utilsr   r   r   r'   r   r   r   r   <module>   s   /