
    i-                         S SK Jr  SSKJrJrJr  SSKJr   " S S\5      r " S S\5      r	 " S	 S
\	5      r
 " S S\	5      r " S S\	5      r " S S\	5      rg)   )InfoExtractor   )int_or_noneunified_timestampurl_or_none)traverse_objc                   x    \ rS rSrSrSSSSSSS	/S
S/SS/SSSS.
S.SSSSSSS/SS/SSSS.	S.SSS./rS  rS!rg")#IdagioTrackIE   z`https?://(?:www\.)?app\.idagio\.com(?:/[a-z]{2})?/recordings/\d+\?(?:[^#]+&)?trackId=(?P<id>\d+)z;https://app.idagio.com/recordings/30576934?trackId=30576943 15148bd71804b2450a2508931a116b5630576943mp3zTheme. AndanteR   Edward ElgarVasily Petrenko&Royal Liverpool Philharmonic Orchestra
OrchestralOther Orchestral Musice\20190405)
idexttitleduration	composersartistsgenrestrack	timestampupload_date)urlmd5	info_dictzJhttps://app.idagio.com/recordings/20514467?trackId=20514478&utm_source=pcl 3acef2ea0feadf889123b70e5a1e7fa720514478zI. Adagio sostenutoi<  Ludwig van BeethovenKeyboardSonata (Keyboard)|Z20180208)	r   r   r   r   r   r   r   r   r    zMhttps://app.idagio.com/de/recordings/20514467?trackId=20514478&utm_source=pclTr!   only_matchingc                    U R                  U5      nU R                  SU 3USSS9n[        US5      S:X  a  U R                  5         U R                  SU 3USS	S
S.S9nSSU[        US[        145      S.[        USSS[
        14SS[        SS914SS[
        14S[        14SS[
        14SSS[
        1[        4SSSSS[
        1[        [        [        4	SSSSS[
        1[        4S .45      E$ )!Nz,https://api.idagio.com/v2.0/metadata/tracks/Fi  )fatalexpected_status
error_codezidagio.error.blocked.locationz*https://api.idagio.com/v1.8/content/track/02zweb-4)qualityformatclient_type)queryr   noner!   )r   vcodecr   r!   resultpiecer   	recording
created_at  scalelocationr   	conductor)	ensembles.)soloists.nameworkpartworkcomposergenresubgenre)r   r   r@   r   r   r   r   r   )		_match_id_download_jsonr   raise_geo_restrictedr   strr   filterall)selfr!   track_id
track_infocontent_infos        D/app/mltbenv/lib/python3.13/site-packages/yt_dlp/extractor/idagio.py_real_extractIdagioTrackIE._real_extract*   sO   >>#&((:8*EE3 ) 8
 
L15TT%%'**8
CX& +  u{m.DE	

 :!7SE2)<+D:Q9RS(*se<'+7!7SE2')]_ehkglntu%z6:vPSuV\^acij"J8MwY\X]_ef	3 	( 	
 	
     N)__name__
__module____qualname____firstlineno__
_VALID_URL_TESTSrW   __static_attributes__rZ   rY   rV   r
   r
      s    tJL1%())+ST#%=>%#%
  \1*01!#67*#%

 _; FD
rY   r
   c                   (    \ rS rSrSrSrS rS rSrg)IdagioPlaylistBaseIEL   zESubclasses must set _API_URL_TMPL and define _parse_playlist_metadatar   c              #      #    [        USS 45       H-  nUS   nUS   S   nU R                  SU SU 3[        US9v   M/     g 7f)Ntracksc                 *    US   =(       a    US   S   $ )Nr   r;   rZ   )_vs     rV   <lambda>/IdagioPlaylistBaseIE._entries.<locals>.<lambda>Q   s    aPTgNnZ[\gZhimZnNnrY   r   r;   z"https://app.idagio.com/recordings/z	?trackId=)ievideo_id)r   
url_resultr
   )rR   playlist_info
track_datarS   recording_ids        rV   _entriesIdagioPlaylistBaseIE._entriesP   sa     &}xAn6opJ!$'H%k248L//4\N)H:V 8 " 5 5 qs   AAc                     U R                  U5      nU R                  U R                  R                  U5      U5      S   nSSU R                  USU R                  U5      0U R                  U5      E$ )Nr9   _typeplaylistentries)rL   rM   _API_URL_TMPLr4   _PLAYLIST_ID_KEYrr   _parse_playlist_metadata)rR   r!   playlist_idro   s       rV   rW   "IdagioPlaylistBaseIE._real_extractX   s    nnS)++%%k2KAAIK Z!!;t}}]3
 ++M:	
 	
rY   rZ   N)	r[   r\   r]   r^   __doc__ry   rr   rW   ra   rZ   rY   rV   rc   rc   L   s    O5

rY   rc   c                   p    \ rS rSrSrSSSS/SS/S	S
/SSSSS.	SS.SSSS/SS/SSSSS.SS./rSrS rSrg)IdagioRecordingIEe   z`https?://(?:www\.)?app\.idagio\.com(?:/[a-z]{2})?/recordings/(?P<id>\d+)(?![^#]*[&?]trackId=\d+)z*https://app.idagio.com/recordings/3057693430576934z&Variations on an Original Theme op. 36r   r   r   r   r   r   r   )	r   r   r   r   r   r   modified_timestampmodified_dater       r!   r#   playlist_countz-https://app.idagio.com/de/recordings/2051446720514467z1Sonata for Piano No. 14 in C sharp minor op. 27/2r&   r'   r(   r)   r*   )r   r   r   r   r   r    r   r      z2https://api.idagio.com/v2.0/metadata/recordings/{}c                     [        USS[        14S[        SS914S[        SS914S[        14SS[        14SS	S[        1[        4SS
S[        14SS[        14S.5      $ )NrG   r   r<   r=   r>   r@   rA   rE   rH   rI   tags.)r   r   r   r@   r   r   r   r   )r   rO   r   rQ   rR   ro   s     rV   rz   *IdagioRecordingIE._parse_playlist_metadata   s    Mgu-&4)@(AB#/+D2I1J"K#cU+LfWZV[\ *fseSA4guES3%(	,
 	 		rY   rZ   N	r[   r\   r]   r^   r_   r`   rx   rz   ra   rZ   rY   rV   r   r   e   s    tJ;=())+ST#%=>#",'%

  ?H01!#67#%",'	
 F8 IM
rY   r   c                   x    \ rS rSrSrSSSSSS/ S	QS
SSSS.
SS.SSSSSS/ SQSSSSSS/S.SS./rS rS!rS" rS#r	g$)%IdagioAlbumIE   zGhttps?://(?:www\.)?app\.idagio\.com(?:/[a-z]{2})?/albums/(?P<id>[\w-]+)zWhttps://app.idagio.com/albums/elgar-enigma-variations-in-the-south-serenade-for-stringsz$a9f139b8-f70d-4b8a-a9a4-5fe8d35eaf9cz9elgar-enigma-variations-in-the-south-serenade-for-stringsz<Elgar: Enigma Variations, In the South, Serenade for Strings z+re:https://.+/albums/880040420521/main\.jpg)r   r   r   i `\20190329g  HA20190708)
r   
display_idr   description	thumbnailr   r   r    r   r      r   zbhttps://app.idagio.com/de/albums/brahms-ein-deutsches-requiem-3B403DF6-62D7-4A42-807B-47173F3E0192z$2862ad4e-4a61-45ad-9ce4-7fcf0c2626fezAbrahms-ein-deutsches-requiem-3B403DF6-62D7-4A42-807B-47173F3E0192zBrahms: Ein deutsches RequiemzEGRAMOPHONE CLASSICAL MUSIC AWARDS 2025 Recording of the Year & Choralz,re:https://.+/albums/3149020954522/main\.jpg)zSabine Devieilheu   Stéphane Degoutu   Raphaël Pichon	PygmalionzJohannes BrahmsiLh20251010i h20251016recommendedzrecent-release)r   r   r   r   r   r   r   r    r   r   r      z.https://api.idagio.com/v2.0/metadata/albums/{}r   c                     [        US[        14S[        14S[        14S[        14S[        14S[        14SSS	[        14S
S[        14S.5      $ )Nr   r   publishDatelastModifiedimageUrlr   participants.rE   r   )r   r   r   r   r   r   r   r   )r   rO   r   r   r   s     rV   rz   &IdagioAlbumIE._parse_playlist_metadata   so    M#-u%'*;)<=#14E3F"G${m4)C51&VcU;S3%(	,
 	 		rY   rZ   N
r[   r\   r]   r^   r_   r`   rx   ry   rz   ra   rZ   rY   rV   r   r      s    [Jh8USGd#%".'
   t8]4bHr#%",'"$45
 F@ EM#
rY   r   c            	       ^    \ rS rSrSrSSSSSSS	/S
.SS.SSSSSSS	/S
.SS./rSrSrS rSr	g)IdagioPlaylistIE   zWhttps?://(?:www\.)?app\.idagio\.com(?:/[a-z]{2})?/playlists/(?!personal/)(?P<id>[\w-]+)zIhttps://app.idagio.com/playlists/beethoven-the-most-beautiful-piano-musicz$31652bec-8c5b-460e-a3f0-cf1f69817f53z(beethoven-the-most-beautiful-piano-musicz)Beethoven: the most beautiful piano musicz$md5:d41bb04b8896bb69377f5c2cd9345ad1zFre:https://.+/playlists/31652bec-8c5b-460e-a3f0-cf1f69817f53/main\.jpgIDAGIO)r   r   r   r   r   creators   )r!   r#   playlist_mincountzAhttps://app.idagio.com/de/playlists/piano-music-for-an-autumn-dayz$d70e9c7f-7080-4308-ae0f-f890dddeda82zpiano-music-for-an-autumn-dayzPiano Music for an Autumn DayzZGet ready to snuggle up and enjoy all the musical colours of this cosy, autumnal playlist.zFre:https://.+/playlists/d70e9c7f-7080-4308-ae0f-f890dddeda82/main\.jpg#   r   z(https://api.idagio.com/v2.0/playlists/{}r   c                 x    [        US[        14S[        14S[        14S[        14SS[        1[        4S.5      $ )Nr   r   r   r   curatorrE   )r   r   r   r   r   )r   rO   r   rQ   r   s     rV   rz   )IdagioPlaylistIE._parse_playlist_metadata   sK    M#-u%${m4)C51"FSE37,
  	rY   rZ   Nr   rZ   rY   rV   r   r      so    kJZ8D@Ab!

   S894wb!

 F. ?M#rY   r   c            
       L    \ rS rSrSrSSSS/SSS	S
SS.SS.SSS./rSrS rSrg)IdagioPersonalPlaylistIE   zVhttps?://(?:www\.)?app\.idagio\.com(?:/[a-z]{2})?/playlists/personal/(?P<id>[\da-f-]+)zNhttps://app.idagio.com/playlists/personal/99dad72e-7b3a-45a4-b216-867c08046ed8z$99dad72e-7b3a-45a4-b216-867c08046ed8Testz$1a6f16a6-4514-4d0c-b481-3a9877835626z%re:https://.+/artists/86371/main\.jpgi_ih2020101620250819)r   r   r   r   r   r   r    r   d   r   zQhttps://app.idagio.com/de/playlists/personal/99dad72e-7b3a-45a4-b216-867c08046ed8Tr+   z1https://api.idagio.com/v1.0/personal-playlists/{}c                     [        US[        14S[        14S[        1[        4S[	        SS914S[	        SS914S.5      $ )	Nr   	image_urluser_idr<   r=   r>   
updated_at)r   r   r   r   r   )r   rO   r   rQ   r   r   s     rV   rz   1IdagioPersonalPlaylistIE._parse_playlist_metadata   sV    Mu%%}5"SE3/&4)@(AB#/+D2I1J"K,
  	rY   rZ   Nr   rZ   rY   rV   r   r      sV    jJ_8?@A#",%'	
  cF" HMrY   r   N)commonr   utilsr   r   r   utils.traversalr   r
   rc   r   r   r   r   rZ   rY   rV   <module>r      sc    ! ? ? *C
M C
L
= 
2*, *Z/( /d#+ #L3 rY   