U
    g]*                     @   s`   d dl Z d dlZddlmZ ddlmZ ddlmZmZm	Z	 G dd deZ
G d	d
 d
eZdS )    N   )InfoExtractor   )	HTTPError)ExtractorErrorOnDemandPagedListurlencode_postdatac                   @   s   e Zd ZdZdZddeej	e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gZd)d* Zd+S ),VideocampusSachsenIEZViMP)<z
bergauf.tvzcampus.demo.vimp.comzcorporate.demo.vimp.comzdancehalldatabase.comzdrehzahl.tvzeduchannel.hs-gesundheit.dezemedia.ls.haw-hamburg.dezglobale-evolution.netzhohu.tvzhtvideos.hightechhigh.orgzk210039.vimp.mivitec.netzmedia.cmslegal.comzmedia.hs-furtwangen.dezmedia.hwr-berlin.dezmediathek.dkfz.dezmediathek.htw-berlin.dezmediathek.polizei-bw.dezmedien.hs-merseburg.dezmportal.europa-uni.dezpacific.demo.vimp.comz	slctv.comzstreaming.prairiesouth.caztube.isbonline.cnzunivideo.uni-kassel.dezursula2.genetics.emory.eduzursulablicklevideoarchiv.comzv.agrarumweltpaedagogik.atzvideo.eplay-tv.dezvideo.fh-dortmund.dezvideo.hs-offenburg.dezvideo.hs-pforzheim.dezvideo.hspv.nrw.dezvideo.irtshdf.frzvideo.pareygo.dezvideo.tu-freiberg.dezvideocampus.sachsen.dezvideoportal.uni-freiburg.dezvideoportal.vm.uni-freiburg.dezvideos.duoc.clzvideos.uni-paderborn.dezvimp-bemus.udk-berlin.dezvimp.aekwl.dezvimp.hs-mittweida.dezvimp.oth-regensburg.dezvimp.ph-heidelberg.dezvimp.sma-events.comzvimp.weka-fachmedien.dezwebtv.univ-montp3.frzwww.b-tu.de/mediazwww.bergauf.tvzwww.bigcitytv.dezwww.cad-videos.dezwww.drehzahl.tvz www.fh-bielefeld.de/medienportalzwww.hohu.tvzwww.orvovideo.comz
www.rwe.tvzwww.salzi.tvzwww.wenglor-media.comzwww2.univ-sba.dzz(?x)https?://(?P<host>{})/(?:
        m/(?P<tmp_id>[0-9a-f]+)|
        (?:category/)?video/(?P<display_id>[\w-]+)/(?P<id>[0-9a-f]{{32}})|
        media/embed.*(?:\?|&)key=(?P<embed_id>[0-9a-f]{{32}}&?)
    )|zhttps://videocampus.sachsen.de/m/e0d6c8ce6e394c188f1342f1ab7c50ed6fc4490b808699801def5cb2e46d76ca7367f622a9f516c542ffb805b24d6b643bd7c81f385acaac4c59081b87a2767bZ e6b9349905c1628631f175712250f2a1z-Konstruktiver Entwicklungsprozess Vorlesung 7zIhttps://videocampus.sachsen.de/cache/1a985379ad3aecba8097a6902c7daa4e.jpgmp4)idtitledescription	thumbnailext)url	info_dictzfhttps://videocampus.sachsen.de/video/Was-ist-selbstgesteuertes-Lernen/fc99c527e4205b121cb7c74433469262Z fc99c527e4205b121cb7c74433469262z!Was ist selbstgesteuertes Lernen?z$md5:196aa3b0509a526db62f84679522a2f5zIhttps://videocampus.sachsen.de/cache/6f4a85096ba24cb398e6ce54446b57ae.jpgz Was-ist-selbstgesteuertes-Lernen)r   r   r   r   
display_idr   zhttps://videocampus.sachsen.de/category/video/Tutorial-zur-Nutzung-von-Adobe-Connect-aus-Veranstalter-Sicht/09d4ed029002eb1bdda610f1103dd54c/100Z 09d4ed029002eb1bdda610f1103dd54cz=Tutorial zur Nutzung von Adobe Connect aus Veranstalter-Sichtz$md5:3d379ca3cc17b9da6784d7f58cca4d58zIhttps://videocampus.sachsen.de/cache/2452498fe8c2d5a7dc79a05d30f407b6.jpgz=Tutorial-zur-Nutzung-von-Adobe-Connect-aus-Veranstalter-Sichtzhttps://www2.univ-sba.dz/video/Presentation-de-la-Faculte-de-droit-et-des-sciences-politiques-Journee-portes-ouvertes-202122/0183356e41af7bfb83d7667b20d9b6a3zGhttps://www2.univ-sba.dz/getMedium/0183356e41af7bfb83d7667b20d9b6a3.mp4Z 0183356e41af7bfb83d7667b20d9b6a3uc   Présentation de la Faculté de droit et des sciences politiques - Journée portes ouvertes 2021/22z$md5:508958bd93e0ca002ac731d94182a54fzChttps://www2.univ-sba.dz/cache/4d5d4a0b4189271a8cc6cb5328e14769.jpgz]Presentation-de-la-Faculte-de-droit-et-des-sciences-politiques-Journee-portes-ouvertes-202122)r   r   r   r   r   r   r   zohttps://vimp.weka-fachmedien.de/video/Preisverleihung-Produkte-des-Jahres-2022/c8816f1cc942c12b6cce57c835cffd7cZ c8816f1cc942c12b6cce57c835cffd7cu,   Preisverleihung »Produkte des Jahres 2022«z$md5:60c347568ca89aa25b772c4ea564ebd3zJhttps://vimp.weka-fachmedien.de/cache/da9f3090e9227b25beacf67ccf94de14.pngz(Preisverleihung-Produkte-des-Jahres-2022zOhttps://videocampus.sachsen.de/media/embed?key=fc99c527e4205b121cb7c74433469262)r   r   r   c              
   C   sT  |  |ddddd\}}}}}| j||p.|ddp8d}|sX|pV| d	| d
|d}|s||s|| jd|ddd}d }	d }
n0| jd|dd}| jd|dd}	| jd|dd}
g i  }}z*| jd| d| d|dddd\}}W nB tk
r" } z"t|jt	r|jj
dkr W 5 d }~X Y nX |dd| d| di |||	|
|||dS )Nhostr   tmp_idr   embed_idFfatal zsrc="https?://z'/media/embed.*(?:\?|&)key=([0-9a-f]+)&?video_idz*<video-js[^>]* data-piwik-title="([^"<]+)"r   )zog:titleztwitter:titler   )zog:descriptionztwitter:descriptionr   )zog:imageztwitter:imagezhttps://z/media/hlsMedium/key/z)/format/auto/ext/mp4/learning/0/path/m3u8r   ZhlsT)Zm3u8_idr   )i  i  r   z/getMedium/z.mp4)r   r   r   r   r   formats	subtitles)_match_valid_urlgroup_download_webpageZ_html_search_regex_html_search_metaZ#_extract_m3u8_formats_and_subtitlesr   
isinstancecauser   statusappend)selfr   r   r   r   r   r   webpager   r   r   r   r   e r(   H/tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/extractor/videocampus_sachsen.py_real_extract   s\    
    
   
   z"VideocampusSachsenIE._real_extractN)__name__
__module____qualname__IE_NAME
_INSTANCESformatjoinmapreescape
_VALID_URL_TESTSr*   r(   r(   r(   r)   r	   	   st   >Br	   c                   @   sr   e Zd ZdZddeeje	j
Zdddddd	d
ddddd	dddddd	gZdZdd Zdd ZdS )ViMPPlaylistIEzViMP:Playlistz(?x)(?P<host>https?://(?:{}))/(?:
        album/view/aid/(?P<album_id>[0-9]+)|
        (?P<mode>category|channel)/(?P<name>[\w-]+)/(?P<id>[0-9]+)
    )r
   zBhttps://vimp.oth-regensburg.de/channel/Designtheorie-1-SoSe-2020/3z	channel-3z<Designtheorie 1 SoSe 2020 :: Channels :: ViMP OTH Regensburg)r   r   	   )r   r   Zplaylist_mincountz;https://www.fh-bielefeld.de/medienportal/album/view/aid/208z	album-208z4KG Praktikum ABT/MEC :: Playlists :: FH-Medienportal   z@https://videocampus.sachsen.de/category/online-tutorials-onyx/91zcategory-91z8Online-Seminare ONYX - BPS - Bildungseinrichtungen - VCS   
   c           	      c   sR   | j | d| ||ddt|d}td|}|D ]}| || tV  q6d S )Nz/media/ajax/component/boxList/r   )pageZ	page_only)querydataz"([^"]+/video/[^"]+)")r   r   r3   findallZ
url_resultr	   )	r%   r   url_partplaylist_idr>   r<   r&   urlsr   r(   r(   r)   _fetch_page   s      zViMPPlaylistIE._fetch_pagec                 C   s  |  |ddddd\}}}}}| j||p.|ddp8d}| jd	|ddpR| |}|rbd
| n&|dkrzd| d| nd| d| }	|pd}d|d| d|p|d|rdn|dkrdndd|p|dddt| ji}
| jtt	
| j||	|p||
| j|| d|p
| dS )Nr   album_idmodenamer   Fr   r   r   zaid/categoryz	category/z/category_id/ztitle/z	/channel/Zalbumz
vars[mode]zvars[]zvars[context]413zvars[context_id]zvars[layout]Zthumbzvars[per_page][thumb]-)Zplaylist_titler   )r   r   r   r    Z_html_extract_titlestr
_PAGE_SIZEZplaylist_resultr   	functoolspartialrC   )r%   r   r   rD   rE   rF   rA   r&   r   r@   r>   r(   r(   r)   r*      sT    
     
     	     zViMPPlaylistIE._real_extractN)r+   r,   r-   r.   r0   r1   r2   r3   r4   r	   r/   r5   r6   rN   rC   r*   r(   r(   r(   r)   r7      s4   	r7   )rO   r3   commonr   Znetworking.exceptionsr   utilsr   r   r   r	   r7   r(   r(   r(   r)   <module>   s    4