o
    i                     @   sT   d dl mZ d dlmZ ddlmZmZmZmZ ddl	m
Z
mZ G dd deZdS )	   )InfoExtractor)
VHXEmbedIE   )ExtractorError
clean_html
update_urlurlencode_postdata)find_elementtraverse_objc                   @   sx   e Zd ZdZdZdZdddddd	d
ddddddd
dgddddddddddddddd
dgdgZdd Zdd  Zd!S )"SoftWhiteUnderbellyIEz)https://www.softwhiteunderbelly.com/loginsoftwhiteunderbellyzAhttps?://(?:www\.)?softwhiteunderbelly\.com/videos/(?P<id>[\w-]+)z9https://www.softwhiteunderbelly.com/videos/kenneth-final1z&A single Soft White Underbelly Episode 8e79f29ec1f1bda6da2e0b998fcbebb83201266mp4zkenneth-final1z!Appalachian Man interview-KennethzeSoft White Underbelly interview and portrait of Kenneth, an Appalachian man in Clay County, Kentucky.zYhttps://vhx.imgix.net/softwhiteunderbelly/assets/249f6db0-2b39-49a4-979b-f8dad4681825.jpgzhttps://vimeo.com/user80538407z
OTT Videosuser80538407i   )
idext
display_idtitledescription	thumbnailuploader_urluploaderuploader_iddurationz$Failed to parse XML: not well-formed)urlnotemd5	info_dictexpected_warningsz;https://www.softwhiteunderbelly.com/videos/tj-2-final-2160p 286bd8851b4824c62afb369e6f3070363506029ztj-2-final-2160pz(Fentanyl Addict interview-TJ (follow up)z\Soft White Underbelly follow up interview and portrait of TJ, a fentanyl addict on Skid Row.zYhttps://vhx.imgix.net/softwhiteunderbelly/assets/c883d531-5da0-4faf-a2e2-8eba97e5adfc.jpgi1  )
r   r   r   r   r   r   r   r   r   r   c                 C   s@   |  | jd d}| j | jd dt||| d|dddd d S )NzFetching authenticity tokenz
Logging inz8name=["\']authenticity_token["\']\s+value=["\']([^"\']+)authenticity_tokenT)emailpasswordr"   utf8)data)_download_webpage
_LOGIN_URLr   _html_search_regex)selfusernamer$   signin_page r-   X/home/ubuntu/.local/lib/python3.10/site-packages/yt_dlp/extractor/softwhiteunderbelly.py_perform_login4   s   
z$SoftWhiteUnderbellyIE._perform_loginc                 C   s   |  |}| ||}d|v r!| ddrtddd|   | jd|dd	d
\}}dt t	|d||t
|tddhtddhthf| jd|d dt| |pUdd dpZd dS )Nz<div id="watch-unauthorized"z#https://www.softwhiteunderbelly.com_sessionz.This account is not subscribed to this contentT)expectedzLembed_url:\s*["\'](?P<url>https?://embed\.vhx\.tv/videos/(?P<id>\d+)[^"\']*)z	embed url)r   r   )groupurl_transparentz
watch-info)r   zvideo-title)clsr   )default )query)_typeie_keyr   r   r   r   r   r   )	_match_idr'   _get_cookiesgetr   raise_login_requiredr)   r   r9   _smuggle_referrerr
   r	   r   _html_search_metar   _og_search_thumbnail)r*   r   r   webpage	embed_urlembed_idr-   r-   r.   _real_extractA   s&   


 z#SoftWhiteUnderbellyIE._real_extractN)	__name__
__module____qualname__r(   _NETRC_MACHINE
_VALID_URL_TESTSr/   rD   r-   r-   r-   r.   r      sN    $r   N)commonr   vimeor   utilsr   r   r   r   utils.traversalr	   r
   r   r-   r-   r-   r.   <module>   s
    