
    yf]                     N    d dl mZ ddlmZmZ ddlmZmZmZm	Z	  G d de      Z
y)   )InfoExtractor   )
compat_strcompat_urllib_parse_urlencode)ExtractorErrorformat_fieldint_or_none	qualitiesc                   h    e Zd ZdZdddddddd	d
dddeeedddZdZddddddddddddZd dZ	d Z
y)!FlickrIEzDhttps?://(?:www\.|secure\.)?flickr\.com/photos/[\w\-_@]+/(?P<id>\d+)zThttp://www.flickr.com/photos/forestwander-nature-pictures/5645318632/in/photostream/ 164fe3fa6c22e18d448d4d5af2330f31
5645318632mpgzWaterfalls in the Springtime at Dark Hollow Waterfalls. These are located just off of Skyline Drive in Virginia. They are only about 6/10 of a mile hike but it is a pretty steep hill and a good climb back up.zDark Hollow Waterfalls   i$EM20110423z10922353@N03zForest Wanderz;https://www.flickr.com/photos/forestwander-nature-pictures/zAttribution-ShareAlike)idextdescriptiontitleduration	timestampupload_dateuploader_iduploaderuploader_urlcomment_count
view_counttagslicense)urlmd5	info_dictz%https://api.flickr.com/services/rest?zAll Rights Reservedz$Attribution-NonCommercial-ShareAlikezAttribution-NonCommercialz"Attribution-NonCommercial-NoDerivsAttributionzAttribution-NoDerivszNo known copyright restrictionszUnited States government workzPublic Domain Dedication (CC0)zPublic Domain Work)012345678910Nc                     |d|z  |ddd}|r||d<   | j                  | j                  t        |      z   ||      }|d   dk7  rt        |d         |S )	Nz	flickr.%sjsonr   )photo_idmethodapi_keyformatnojsoncallbacksecretstatokmessage)_download_json_API_BASE_URLr   r   )selfr2   video_idr3   noter6   querydatas           9/usr/lib/python3/dist-packages/yt_dlp/extractor/flickr.py	_call_apizFlickrIE._call_api4   ss     !F*
 $E(O""4#5#58UV[8\#\^fhlm<4 i11    c                 h   | j                  |      }| j                  d|d      d   }| j                  d||d      d   }|d   dk(  r| j                  d	||d
|d         d   }t        g d      }g }|d   D ]:  }t	        |j                  d            }	|j                  |	|d    ||	      d       < |j                  di       }
|
j                  d      }|
j                  d      xs |}t        |d d      }||d   d   |j                  di       j                  d      |t        |j                  d            t        |j                  di       j                  d            ||
j                  d      |t        |j                  di       j                  d            t        |j                  d            |j                  di       j                  dg       D cg c]  }|j                  d       c}| j                  j                  |j                  d            d S t        d!d"#      c c}w )$Nz.https://www.flickr.com/hermes_error_beacon.gnezDownloading api keysite_keyzphotos.getInfozDownloading video infophotomediavideozvideo.getStreamInfozDownloading streams infor6   streams)
288piphone_wifi100300700360pappletv720p1080porigstreamtype_content)	format_idr    qualityownernsid
path_aliasz!https://www.flickr.com/photos/%s/r   r   dateuploadedr   realnamecommentsviewsr   tagr   )r   r   r   formatsr   r   r   r   r   r   r   r   r   znot a videoT)expected)	_match_idr:   rB   r
   r   getappendr   r	   	_LICENSESr   )r<   r    r=   r3   
video_inforI   
preferencera   rT   stream_typerY   r   uploader_pathr   r`   s                  rA   _real_extractzFlickrIE._real_extractC   s8   >>#&%%<h!##-/ ^^h1IKKRT
g')nn%x*Jx,@BBKMG #hjJ G!(+ (F);<!,!*-)+6   NN7B/E))F+K!IIl3B{M't=`aL #G,Z8)~~mR@DDZP"()GH'
w(C(G(G
(ST*!IIj1 ,!,Z^^J-K-O-OPZ-[!\)*..*AB8Bvr8R8V8VW\^`8ab,b>>--jnnY.GH   !>>	 cs   H/)N)__name__
__module____qualname__
_VALID_URLintlist_TESTr;   rf   rB   rk    rC   rA   r   r      s    XJe1 n-#%)'Y /
E( <M #3(1%#.,-"I/?rC   r   N)commonr   compatr   r   utilsr   r   r	   r
   r   rs   rC   rA   <module>rw      s%    ! d?} d?rC   