
    VGh                     F    d dl ZddlmZ ddlmZmZmZmZ  G d de      Z	y)    N   )InfoExtractor   )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| |ddd}|r||d<   | j                  | j                  t        j                  j	                  |      z   ||      }|d   dk7  rt        |d         |S )	Nzflickr.jsonr   )photo_idmethodapi_keyformatnojsoncallbacksecretstatokmessage)_download_json_API_BASE_URLurllibparse	urlencoder   )selfr1   video_idr2   noter5   querydatas           `/var/www/it7/html/youtubeDownloader/venv/lib/python3.12/site-packages/yt_dlp/extractor/flickr.py	_call_apizFlickrIE._call_api2   s}     x(
 $E(O""4#5#58N8Nu8U#UW_aef<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 infor5   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_idr9   rD   r	   strgetappendr   r   	_LICENSESr   )r>   r   r?   r2   
video_inforK   
preferencerc   rV   stream_typer[   r   uploader_pathr   rb   s                  rC   _real_extractzFlickrIE._real_extractA   s8   >>#&%%<h!##-/ ^^h1IKKRT
g')nn%x*Jx,@BBKMG #hjJ G!(+ !&**V"45!,!*-)+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:   ri   rD   rn    rE   rC   r   r      s    XJe1 n-#%)'Y /
E( <M #3(1%#.,-"I/?rE   r   )
urllib.parser;   commonr   utilsr   r   r   r	   r   rv   rE   rC   <module>rz      s#     ! d?} d?rE   