U
    g!                     @   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_sexZ 396255a900a6bddb3e98985f0b86c3fdZ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md5Z	info_dictz5https://www.xvideos.com/video65982001/what_s_her_nameZ 56742808292c8fa1418e4538c262c58bZ65982001zwhat's her name?x   z3https://flashservice.xvideos.com/embedframe/4588838T)r   Z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|}|rHt| j dt|d dd| jd|dd ddpd| 	|}g }t
d	D ]8\}}| jd
| d|dd dd}	|	rr||	|d qrt| jd|d dpt| jd|ddd}
g }tj| jd|ddd}|r
||dd td|D ]\}}}| }|dkr`| j||ddddd}| || || nB|dk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) Z169ZsetThumbUrlz)\(\s*(["\'])(?P<thumbnail>(?:(?!\1).)+)\1r   )r   
preferencer   )r   z4<span[^>]+class=["\']duration["\'][^>]*>.*?(\d[^<]+)F)fatalzflv_url=(.+?)&z	video URLr   Zflv)r   	format_idz%setVideo([^(]+)\((["\'])(http.+?)\2\)Zhlsr   Zm3u8_native)Zentry_protocolZm3u8_idr   )ZurllowZurlhighz{}-{}   low)r   r   Zqualityr   )r   formatsr   r   
thumbnailsr   )Z	_match_idZ_download_webpageresearchr   IE_NAMEr   r   Z_html_search_regexZ_og_search_title	enumerateZ_search_regexappendr   Z_og_search_propertyr	   urllibparseunquotefindalllowerZ_extract_m3u8_formatsZ_check_formatsextendformatr   endswith)selfr   Zvideo_idZwebpageZmobjr   r"   r   r   Zthumbnail_urlr   r!   Z	video_urlkind_Z
format_urlr   Zhls_formats r3   </tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/xvideos.py_real_extractk   s    
"  
   
    
    
    
zXVideosIE._real_extractN)__name__
__module____qualname__
_VALID_URL_TESTSr5   r3   r3   r3   r4   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/ipdtikh1a4cZ f9e4f518ff1de14b99a400bbd0fc5ee0Z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/ipphaob6fd1Z 5340938aac6b46e19ebdd1d84535862eZipphaob6fd1z Puta chichona mexicana squirting8   zIhttps://www.xvideos.com/amateur-channels/lili_love#quickies/a/hfmffmd7661Z 92428518bbabcb4c513e55922e022491Zhfmffmd7661zChichona mexican slut	   zEhttps://www.xvideos.com/amateur-channels/wifeluna#quickies/a/47258683Z 16e322a93282667f1963915568f782c1Z47258683zVerification video   c                 C   sB   |  |dd\}}| d| d| r.dnd | dt|S )Ndomainr   zhttps://z/videor   .z/_)Z_match_valid_urlr   Z
url_result	isdecimalr
   )r0   r   r@   Zid_r3   r3   r4   r5      s    zXVideosQuickiesIE._real_extractN)r6   r7   r8   r%   r9   r:   r5   r3   r3   r3   r4   r;      sX   .r;   )r#   urllib.parser(   commonr   utilsr   r   r   r   r	   r
   r;   r3   r3   r3   r4   <module>   s   	 !