o
    i                     @   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-8XMLHttpRequest)zContent-typezX-Requested-Withzid=)headersdataentry_identry_titlepathnonemp3designer_namedesigner_id	entry_urlentry_likesentry_rating)
idtitleurlvcodecextuploaderuploader_idwebpage_url
like_countaverage_rating)_download_jsonencodestrgetr   )selfplayer_entry_id	data_json r$   O/home/ubuntu/.local/lib/python3.10/site-packages/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/58749485r   zHula Hula Calls	unclemaki13512   r   r   r   r   r   r   r   r   	info_dictz+http://vikinggrace.audiodraft.com/entry/50122241z	MVG Happyfrog19142z*http://timferriss.audiodraft.com/entry/76519710ferris03malex17335c                 C   s0   |  |}| ||}| d||d}| |S )Nz$playAudio\(\'(player_entry_\d+)\'\);zplay entry id)	_match_id_download_webpage_search_regexr&   )r!   r   video_idwebpager"   r$   r$   r%   _real_extractC   s   

z AudiodraftCustomIE._real_extractNr'   r(   r)   IE_NAME
_VALID_URLint_TESTSr>   r$   r$   r$   r%   r*      sF    #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=3013830138r   zDROP in sound_V2
TiagoSilva19452   r/   r0   c                 C   s   |  |}| d| S )Nplayer_entry_)r9   r&   )r!   r   r<   r$   r$   r%   r>   \   s   
z!AudiodraftGenericIE._real_extractNr?   r$   r$   r$   r%   rD   K   s    rD   N)commonr   utilsr   r   r*   rD   r$   r$   r$   r%   <module>   s
    /