o
    i1                     @   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 ),VideocampusSachsenIEViMP)Fz
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.fh-swf.dezmedia.hs-furtwangen.dezmedia.hwr-berlin.dezmediathek.dkfz.dezmediathek.htw-berlin.dezmediathek.polizei-bw.dezmedien.hs-merseburg.dezmitmedia.manukau.ac.nzz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-nb.dezvideo.hs-offenburg.dezvideo.hs-pforzheim.dezvideo.hspv.nrw.dezvideo.irtshdf.frzvideo.pareygo.dezvideo.tu-dortmund.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.landesfilmdienste.dezvimp.oth-regensburg.dezvimp.ph-heidelberg.dezvimp.sma-events.comzvimp.weka-fachmedien.dezvimpdesk.comzwebtv.univ-montp3.frzwww.b-tu.de/mediazwww.bergauf.tvzwww.bigcitytv.dezwww.cad-videos.dezwww.drehzahl.tvzwww.hohu.tvzwww.hsbi.de/medienportalzwww.logistic.tvzwww.orvovideo.comzwww.printtube.co.ukz
www.rwe.tvzwww.salzi.tvzwww.signtube.co.ukzwww.twb-power.comz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/e0d6c8ce6e394c188f1342f1ab7c50ed6fc4490b808699801def5cb2e46d76ca7367f622a9f516c542ffb805b24d6b643bd7c81f385acaac4c59081b87a2767b 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/fc99c527e4205b121cb7c74433469262 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/100 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.mp4 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/c8816f1cc942c12b6cce57c835cffd7c 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   sP  |  |ddddd\}}}}}| j||p|ddpd}|s,|p+| d	| d
|d}|s>|s>| jd|ddd}d }	d }
n| jd|dd}| jd|dd}	| jd|dd}
g i }}z| jd| d| d|dddd\}}W n ty } zt|jt	r|jj
dvr W Y d }~nd }~ww |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   hlsT)m3u8_idr   )i  i  r   z/getMedium/z.mp4)r   r   r   r   r   formats	subtitles)_match_valid_urlgroup_download_webpage_html_search_regex_html_search_meta#_extract_m3u8_formats_and_subtitlesr   
isinstancecauser   statusappend)selfr   r   r    r   r   r   webpager   r   r   r#   r$   e r2   X/home/ubuntu/.local/lib/python3.10/site-packages/yt_dlp/extractor/videocampus_sachsen.py_real_extract   sN   



z"VideocampusSachsenIE._real_extractN)__name__
__module____qualname__IE_NAME
_INSTANCESformatjoinmapreescape
_VALID_URL_TESTSr4   r2   r2   r2   r3   r	   	   sv    HBr	   c                   @   s   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	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?://(?:{}))/(?:
        (?P<mode1>album)/view/aid/(?P<album_id>[0-9]+)|
        (?P<mode2>category|channel)/(?P<name>[\w-]+)/(?P<channel_id>[0-9]+)|
        (?P<mode3>tag)/(?P<tag_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   playlist_mincountz3https://www.hsbi.de/medienportal/album/view/aid/208z	album-208z4KG Praktikum ABT/MEC - Playlists - HSBI-Medienportal   z@https://videocampus.sachsen.de/category/online-tutorials-onyx/91zcategory-91z8Online-Seminare ONYX - BPS - Bildungseinrichtungen - VCS   z(https://videocampus.sachsen.de/tag/26902z	tag-26902z2advanced mobile and v2x communication - Tags - VCS   
   c           	      c   sT    | j | d| ||ddt|d}td|}|D ]}| || tV  qd S )Nz/media/ajax/component/boxList/r   )page	page_only)querydataz"([^"]*/video/[^"]+)")r'   r   r=   findall
url_resultr	   )	r/   r   url_partplaylist_idrK   rH   r0   urlsr   r2   r2   r3   _fetch_page   s   zViMPPlaylistIE._fetch_pagec                 C   s8  |  |dddddddd\}}}}}}}}	|p|p|	}
|p"|p"|}| j||d	d
p,d}| jd|d	d
p9| |}|rAd| n|
dkrMd| d| n|
dkrYd| d| nd| }d|
d|
 d|d|rkdn|
dkrqdn|
dkrwdndd|dd d!t| ji}| jtt	
| j||||| j||
 d"| d#S )$Nr   album_idname
channel_idtag_idmode1mode2mode3Fr   r   r   zaid/categoryz	category/z/category_id/channelztitle/z	/channel/ztag/z
vars[mode]zvars[]zvars[context]41album30zvars[context_id]zvars[layout]thumbzvars[per_page][thumb]-)playlist_titler   )r%   r&   r'   r)   _html_extract_titlestr
_PAGE_SIZEplaylist_resultr   	functoolspartialrQ   )r/   r   r   rR   rS   rT   rU   rV   rW   rX   moderO   r0   r   rN   rK   r2   r2   r3   r4      s:   
$
	zViMPPlaylistIE._real_extractN)r5   r6   r7   r8   r:   r;   r<   r=   r>   r	   r9   r?   r@   rf   rQ   r4   r2   r2   r2   r3   rA      sB    	rA   )rh   r=   commonr   networking.exceptionsr   utilsr   r   r   r	   rA   r2   r2   r2   r3   <module>   s     >