
    yf                     l    d dl Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
  G d de      Z G d	 d
e      Zy)    N   )InfoExtractor   )compat_urllib_parse_unquote)
clean_htmldetermine_extExtractorErrorint_or_noneparse_durationc                       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& Zy')(	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           	         | j                  |      }| j                  ||      }t        j                  d|      }|r4t	        | j
                  dt        |j                  d            d      | j                  d|dd d      xs | j                  |      }g }t        d	      D ]5  \  }}| j                  d
|z  |dd d      }	|	s"|j                  |	|d       7 t        | j                  d|d             xs t        | j                  d|dd            }
g }t!        | j                  d|dd            }|r|j                  |dd       t        j"                  d|      D ]  \  }}}|j%                         }|dk(  r;| j'                  ||dddd      }| j)                  ||       |j+                  |       W|dv s\|j                  |t-        |d      d|dd  |j/                  d      rd nd d!        ||||
|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) 169z6setThumbUrl%s\(\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urlhigh-   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   r   findalllower_extract_m3u8_formats_check_formatsextendr   endswith)selfr   video_idwebpagemobjr   r6   r&   r   thumbnail_urlr   r5   	video_urlkind_
format_urlr)   hls_formatss                     :/usr/lib/python3/dist-packages/yt_dlp/extractor/xvideos.py_real_extractzXVideosIE._real_extractk   sx   >>#&((h7yy>H $,,
4::VW=@Y!Zeijj''GWd	 (  = #33G<	 	 
%.{%; 	!J	 ..IIUd+ / GM !!(",# 	 t77  8  / 0 33AG5  243 	 /0B0BwR 1C 1A B	NN " 
 $&::8'$C 	D!Z

IE!"88%#0%u 9 N ##K:{+33%,9*e,LiXYXZm!\%.%7%7%>rD  	"  $
 	
    N)__name__
__module____qualname__
_VALID_URL_TESTSrS    rT   rR   r   r      sl   	J D1eJ
 G1(J
	 E < Q F G F J E I I J I J I J I @ U D[PFd@
rT   r   c            	       6    e Zd ZdZdZddddddd	d
ddgZd Zy)XVideosQuickiesIEzxvideos:quickiesz]https?://(?P<domain>(?:[^/]+\.)?xvideos2?\.com)/amateur-channels/[^#]+#quickies/a/(?P<id>\d+)zEhttps://www.xvideos.com/amateur-channels/wifeluna#quickies/a/47258683 16e322a93282667f1963915568f782c147258683r   zVerification videor      z-re:^https://cdn.*-pic.xvideos-cdn.com/.+\.jpg)r   r   r   r   r   r   r   c                     | j                  |      j                  dd      \  }}| j                  d| d| dt        |      S )Ndomainr   zhttps://z/videoz/_)_match_valid_urlr#   
url_resultr   )rH   r   ra   id_s       rR   rS   zXVideosQuickiesIE._real_extract   sE    ++C066xF&uB?CPPrT   N)rU   rV   rW   r;   rX   rY   rS   rZ   rT   rR   r\   r\      s;     GqJV1)I
 FQrT   r\   )r9   commonr   compatr   utilsr   r   r	   r
   r   r   r\   rZ   rT   rR   <module>rh      s5    	 ! 0 ]
 ]
@Q QrT   