a
    h                     @   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/loginZsoftwhiteunderbellyzAhttps?://(?:www\.)?softwhiteunderbelly\.com/videos/(?P<id>[\w-]+)z9https://www.softwhiteunderbelly.com/videos/kenneth-final1z&A single Soft White Underbelly EpisodeZ 8e79f29ec1f1bda6da2e0b998fcbebb8Z3201266Z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 VideosZuser80538407i   )
idext
display_idtitledescription	thumbnailuploader_urluploaderuploader_iddurationz$Failed to parse XML: not well-formed)urlZnotemd5Z	info_dictZexpected_warningsz;https://www.softwhiteunderbelly.com/videos/tj-2-final-2160pZ 286bd8851b4824c62afb369e6f307036Z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   Zsignin_page r"   Y/mnt/pikpak/tmp/myenv/lib/python3.9/site-packages/yt_dlp/extractor/softwhiteunderbelly.py_perform_login4   s    z$SoftWhiteUnderbellyIE._perform_loginc                 C   s   |  |}| ||}d|v rB| 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| |pdd dpd 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   )groupZurl_transparentz
watch-info)r   zvideo-title)clsr   )default )query)_typeie_keyr   r   r   r   r   r   )Z	_match_idr   Z_get_cookiesgetr   Zraise_login_requiredr   r   r-   Z_smuggle_referrerr
   r	   r   Z_html_search_metar   Z_og_search_thumbnail)r    r   r   ZwebpageZ	embed_urlZembed_idr"   r"   r#   _real_extractA   s&    


 z#SoftWhiteUnderbellyIE._real_extractN)	__name__
__module____qualname__r   Z_NETRC_MACHINEZ
_VALID_URLZ_TESTSr$   r/   r"   r"   r"   r#   r      sL   $r   N)commonr   Zvimeor   utilsr   r   r   r   Zutils.traversalr	   r
   r   r"   r"   r"   r#   <module>   s   