o
    i                     @   s<   d dl Z ddlmZ ddlmZmZmZ G dd deZdS )    N   )InfoExtractor   )extract_attributesget_element_by_attributeint_or_nonec                   @   sR   e Zd ZdZdddddddd	d
deeg dddddddddgZdd ZdS )SampleFocusIEz<https?://(?:www\.)?samplefocus\.com/samples/(?P<id>[^/?&#]+)z7https://samplefocus.com/samples/lil-peep-sad-emo-guitar 48c8d62d60be467293912e0e619a512040316zlil-peep-sad-emo-guitarmp3zLil Peep Sad Emo Guitarzre:^https?://.+\.pngzStandard LicenseCapsCtrlcapsctrl)SamplesGuitarzElectric guitar)id
display_idexttitle	thumbnaillicenseuploaderuploader_id
like_countcomment_count
categories)urlmd5	info_dictz5https://samplefocus.com/samples/dababy-style-bass-808T)r   only_matchingz/https://samplefocus.com/samples/young-chop-kickc                    sx    |} j||dd jdddd} jddp# d	d
} jdddddp:t jddddd } pI jddddd}g }tdD ]\}}	}
|	|	||
d qRd  }}t
d}|rs| \}}tdd}g }|rtd|D ]	\}}|	| q fdd}|||dddd|idg||| jdd dd d||d!| d"|d#||d$S )%NT)impersonatez?<input[^>]+id=(["\'])sample_id\1[^>]+value=(?:["\'])(?P<id>\d+)z	sample idr   )groupFfatalz<h1>(.+?)</h1>r   zH<input[^>]+id=(["\'])sample_mp3\1[^>]+value=(["\'])(?P<url>(?:(?!\2).)+)r   r   )r"   r    z,<meta[^>]+itemprop=(["\'])contentUrl\1[^>]*>zmp3 urlr   contentzT<img[^>]+class=(?:["\'])waveform responsive-img[^>]+src=(["\'])(?P<url>(?:(?!\1).)+)zt(?s)<p[^>]+class="comment-author"><a[^>]+href="/users/([^"]+)">([^"]+)</a>.+?<p[^>]+class="comment-body">([^>]+)</p>)author	author_idtextz->By <a[^>]+href="/users/([^"]+)"[^>]*>([^<]+)typeofBreadcrumbListz-<span[^>]+property=(["\'])name\1[^>]*>([^<]+)c                    s   t  jd|  d| ddS )Nz<span[^>]+class=(?:["\'])?z-count[^>]*>(\d+)Fr!   )r   _html_search_regex)klassselfwebpage P/home/ubuntu/.local/lib/python3.10/site-packages/yt_dlp/extractor/samplefocus.pyextract_countM   s   
z2SampleFocusIE._real_extract.<locals>.extract_countnoneReferer)r   r   vcodecacodechttp_headersz6<a[^>]+href=(["\'])/license\1[^>]*>(?P<license>[^<]+)<r   zsample-z
-favoritescomments)r   r   formatsr   r   r   r   r   r   r   r6   r   )	_match_id_download_webpage_search_regex_og_search_titler)   r   _og_search_thumbnailrefindallappendsearchgroupsr   )r,   r   r   	sample_idr   mp3_urlr   r6   r%   r$   bodyr   r   mobj
breadcrumbr   _namer0   r.   r+   r/   _real_extract%   s~   

	zSampleFocusIE._real_extractN)__name__
__module____qualname__
_VALID_URLint_TESTSrI   r.   r.   r.   r/   r      s2    r   )r=   commonr   utilsr   r   r   r   r.   r.   r.   r/   <module>   s    