o
    i!                     @   s\   d dl Z d dlZddlmZ ddlmZmZmZm	Z	m
Z
 G dd deZG dd	 d	eZdS )
    N   )InfoExtractor   )ExtractorError
clean_htmldetermine_extint_or_noneparse_durationc                   @   s   e Zd ZdZdddddddd	d
ddddddddd	d
ddddddddddddddddddddddddddddddddddddddddd ddd!ddd"ddd#ddd$ddd%ddgZd&d' Zd(S ))	XVideosIEa  (?x)
                    https?://
                        (?:
                            (?:[^/]+\.)?xvideos2?\.com/video\.?|
                            (?:www\.)?xvideos\.es/video\.?|
                            (?:www|flashservice)\.xvideos\.com/embedframe/|
                            static-hw\.xvideos\.com/swf/xv-player\.swf\?.*?\bid_video=
                        )
                        (?P<id>[0-9a-z]+)
                    zrhttp://xvideos.com/video.ucuvbkfda4e/a_beautiful_red-haired_stranger_was_refused_but_still_came_to_my_room_for_sex 396255a900a6bddb3e98985f0b86c3fducuvbkfda4emp4zNA Beautiful Red-Haired Stranger Was Refused, But Still Came To My Room For Sexi     z.re:^https://cdn\d+-pic.xvideos-cdn.com/.+\.jpg)idexttitleduration	age_limit	thumbnailurlmd5	info_dictz5https://www.xvideos.com/video65982001/what_s_her_name 56742808292c8fa1418e4538c262c58b65982001zwhat's her name?x   z3https://flashservice.xvideos.com/embedframe/4588838T)r   only_matchingz*https://www.xvideos.com/embedframe/4588838z?http://static-hw.xvideos.com/swf/xv-player.swf?id_video=4588838z4http://xvideos.com/video4588838/biker_takes_his_girlz5https://xvideos.com/video4588838/biker_takes_his_girlz4https://xvideos.es/video4588838/biker_takes_his_girlz8https://www.xvideos.es/video4588838/biker_takes_his_girlz3http://xvideos.es/video4588838/biker_takes_his_girlz7http://www.xvideos.es/video4588838/biker_takes_his_girlz7http://fr.xvideos.com/video4588838/biker_takes_his_girlz8https://fr.xvideos.com/video4588838/biker_takes_his_girlz7http://it.xvideos.com/video4588838/biker_takes_his_girlz8https://it.xvideos.com/video4588838/biker_takes_his_girlz7http://de.xvideos.com/video4588838/biker_takes_his_girlz8https://de.xvideos.com/video4588838/biker_takes_his_girlz7https://flashservice.xvideos.com/embedframe/ucuvbkfda4ez.https://www.xvideos.com/embedframe/ucuvbkfda4ezChttp://static-hw.xvideos.com/swf/xv-player.swf?id_video=ucuvbkfda4ezrhttps://xvideos.es/video.ucuvbkfda4e/a_beautiful_red-haired_stranger_was_refused_but_still_came_to_my_room_for_sexc              
   C   s  |  |}| ||}td|}|r$t| j dt|d dd| jd|dd ddp2| 	|}g }t
d	D ]\}}| jd
| d|dd dd}	|	rU||	|d q9t| jd|d dpjt| jd|ddd}
g }tj| jd|ddd}|r||dd td|D ]C\}}}| }|dkr| j||ddddd}| || || q|dv r||dt|d|dd  |d rd!nd d" q||||
|d#d$S )%Nz"<h1 class="inlineError">(.+?)</h1>z said: r   T)expected)z <title>(?P<title>.+?)\s+-\s+XVIDz5setVideoTitle\s*\(\s*(["\'])(?P<title>(?:(?!\1).)+)\1r   )defaultgroup) 169setThumbUrlz)\(\s*(["\'])(?P<thumbnail>(?:(?!\1).)+)\1r   )r   
preferencer   )r   z4<span[^>]+class=["\']duration["\'][^>]*>.*?(\d[^<]+)F)fatalzflv_url=(.+?)&z	video URLr    flv)r   	format_idz%setVideo([^(]+)\((["\'])(http.+?)\2\)hlsr   m3u8_native)entry_protocolm3u8_idr$   )urllowurlhighz{}-{}   low)r   r&   qualityr   )r   formatsr   r   
thumbnailsr   )	_match_id_download_webpageresearchr   IE_NAMEr   r   _html_search_regex_og_search_title	enumerate_search_regexappendr   _og_search_propertyr	   urllibparseunquotefindalllower_extract_m3u8_formats_check_formatsextendformatr   endswith)selfr   video_idwebpagemobjr   r2   r#   r   thumbnail_urlr   r1   	video_urlkind_
format_urlr&   hls_formats rR   L/home/ubuntu/.local/lib/python3.10/site-packages/yt_dlp/extractor/xvideos.py_real_extractk   s   
"

zXVideosIE._real_extractN)__name__
__module____qualname__
_VALID_URL_TESTSrT   rR   rR   rR   rS   r
      s    Rr
   c                   @   s   e Zd ZdZdZddddddd	d
dddddddddd
dddddddddd
dddddddddd
ddgZdd ZdS )XVideosQuickiesIEzxvideos:quickieszphttps?://(?P<domain>(?:[^/?#]+\.)?xvideos2?\.com)/(?:profiles/|amateur-channels/)?[^/?#]+#quickies/a/(?P<id>\w+)z8https://www.xvideos.com/lili_love#quickies/a/ipdtikh1a4c f9e4f518ff1de14b99a400bbd0fc5ee0ipdtikh1a4cr   u   Mexican chichóna putisimar   Q   z-re:^https://cdn.*-pic.xvideos-cdn.com/.+\.jpg)r   r   r   r   r   r   r   zAhttps://www.xvideos.com/profiles/lili_love#quickies/a/ipphaob6fd1 5340938aac6b46e19ebdd1d84535862eipphaob6fd1z Puta chichona mexicana squirting8   zIhttps://www.xvideos.com/amateur-channels/lili_love#quickies/a/hfmffmd7661 92428518bbabcb4c513e55922e022491hfmffmd7661zChichona mexican slut	   zEhttps://www.xvideos.com/amateur-channels/wifeluna#quickies/a/47258683 16e322a93282667f1963915568f782c147258683zVerification video   c                 C   sB   |  |dd\}}| d| d| rdnd | dt|S )Ndomainr   zhttps://z/videor    .z/_)_match_valid_urlr   
url_result	isdecimalr
   )rH   r   rg   id_rR   rR   rS   rT      s   ,zXVideosQuickiesIE._real_extractN)rU   rV   rW   r7   rX   rY   rT   rR   rR   rR   rS   rZ      sZ    .rZ   )r5   urllib.parser>   commonr   utilsr   r   r   r   r	   r
   rZ   rR   rR   rR   rS   <module>   s    	 !