o
    ˆ¬i³  ã                   @   s@   d dl mZ ddlmZmZmZ ddlmZ G dd„ deƒZdS )é   )ÚInfoExtractoré   )Úint_or_noneÚstr_or_noneÚurl_or_none)Útraverse_objc                   @   s2   e Zd ZdZdddddddd	œd
œgZdd„ ZdS )Ú	AlibabaIEzGhttps?://(?:www\.)?alibaba\.com/product-detail/[\w-]+_(?P<id>\d+)\.htmlzmhttps://www.alibaba.com/product-detail/Kids-Entertainment-Bouncer-Bouncy-Castle-Waterslide_1601271126969.htmlÚ6000280444270Ú1601271126969Úmp4znKids Entertainment Bouncer Bouncy Castle Waterslide Juex Gonflables Commercial Inflatable Tropical Water Slideé   zMhttps://sc04.alicdn.com/kf/Hc5bb391974454af18c7a4f91cbe4062bg.jpg_120x120.jpg)ÚidÚ
display_idÚextÚtitleÚdurationÚ	thumbnail)ÚurlÚ	info_dictc                 C   s´   |   |¡}|  ||¡}|  d|d|¡d d }i t|ddd„ tdththfd	thfd
thfddd„ ddthfdthfdthfdthfdthfdœfdœfƒ¥t|dt	hfƒ|dœ¥S )Nzwindow\.detailData\s*=zdetail dataÚ
globalDataÚproductÚ
mediaItemsc                 S   s   |d dko	|d S )NÚtypeÚvideoÚvideoId© ©Ú_Úvr   r   úL/home/ubuntu/.local/lib/python3.10/site-packages/yt_dlp/extractor/alibaba.pyÚ<lambda>   s    z)AlibabaIE._real_extract.<locals>.<lambda>r   r   ÚvideoCoverUrlÚvideoUrlc                 S   s   t |d ƒS )Nr"   )r   r   r   r   r   r       s    Ú
definitionÚbitrateÚwidthÚheightÚlength)r   Ú	format_idÚtbrr%   r&   Úfilesize)r   r   r   ÚformatsÚsubject)r   r   )
Ú	_match_idÚ_download_webpageÚ_search_jsonr   ÚanyÚintr   r   r   Ústr)Úselfr   r   ÚwebpageÚproduct_datar   r   r   Ú_real_extract   s6   
ÿÿÿúüÿñzAlibabaIE._real_extractN)Ú__name__Ú
__module__Ú__qualname__Ú
_VALID_URLÚ_TESTSr6   r   r   r   r   r      s    úþr   N)	Úcommonr   Úutilsr   r   r   Úutils.traversalr   r   r   r   r   r   Ú<module>   s    