
    VGhz                         d dl mZ ddlmZmZmZmZmZ  G d de      Z G d de      Z	 G d d	e      Z
 G d
 de
      Z G d de
      Zy)   )InfoExtractor   )
clean_htmlformat_fieldint_or_nonestr_or_nonestrip_or_nonec                       e Zd ZdZddZy)MindsBaseIEzhttps?://(?:www\.)?minds\.com/Nc                     d|z   }| j                  |      j                  d      }| j                  ||d| dd|r|j                  ndd|      S )	Nzhttps://www.minds.com/api/z
XSRF-TOKENzDownloading z JSON metadatazhttps://www.minds.com/ )RefererzX-XSRF-TOKEN)headersquery)_get_cookiesget_download_jsonvalue)selfpathvideo_idresourcer   api_urltokens          _/var/www/it7/html/youtubeDownloader/venv/lib/python3.12/site-packages/yt_dlp/extractor/minds.py	_call_apizMindsBaseIE._call_api   sh    .5!!'*..|<""XhZ~F3/4"Q 	 #  	    )N)__name__
__module____qualname___VALID_URL_BASEr    r   r   r   r      s    7Or   r   c                       e Zd ZdZej
                  dz   Zddddddd	d
ddeeedgeddddddddddddddddddddgZd Z	y)MindsIEmindsz.(?:media|newsfeed|archive/view)/(?P<id>[0-9]+)z.https://www.minds.com/media/100000000000086822 215a658184a419764852239d4970b045100000000000086822mp4zMinds intro sequencezre:https?://.+\.pngottman20130524iuQBill Ottman	animationzattribution-cc)idexttitle	thumbnailuploader_idupload_date	timestampuploader
view_count
like_countdislike_counttagscomment_countlicense)urlmd5	info_dictz1https://www.minds.com/newsfeed/798025111988506624 b2733a74af78d7fd3f541c4cbbaa5950798022190320226304ColinFlaherty20180111iVZ)r-   r.   r/   r4   r2   r3   r1   z5https://www.minds.com/archive/view/715172106794442752T)r;   only_matchingz2https://www.minds.com/newsfeed/1197131838022602752c                 4   | j                  |      }| j                  d|z   |d      d   }|j                  d      dk(  r.|j                  d      dk(  r|d   }n | j                  |d         S |d	   dk(  sJ |}| j                  d
|z   |d      }g }|j                  d      xs g D ]R  }|j                  d      }|s|j	                  |j                  d      t        |j                  d            |d       T |j                  d      xs |}|j                  d      xs i }	|	j                  d      }
|j                  d      }|rt        |t              r|g}d }|j                  d      xs |j                  d      }|r"| j                  ||d      }|r|j                  }||j                  d      xs ||t        |j                  d            xs d t        |j                  d            t        |j                  d            t        |	j                  d            |
t        |
d d      t        |j                  d            t        |j                  d            t        |j                  d            |t        |j                  d             |d!S )"Nzv1/entities/entity/entitytypeactivitycustom_typevideoentity_guid	perma_urlsubtypezv2/media/video/sourcessrclabelsize)	format_idheightr;   ownerObjusernamer8   posterthumbnail_srcF)fatalr/   descriptionr:   time_creatednamezhttps://www.minds.com/%sz
play:countzthumbs:up:countzthumbs:down:countzcomments:count)r-   r/   formatsrW   r:   r3   r4   r1   uploader_urlr5   r6   r7   r8   r9   r0   )	_match_idr   r   
url_resultappendr   
isinstancestr_request_webpager;   r   r   r	   r   )r   r;   	entity_idrD   r   rH   rZ   sourcerM   ownerr1   r8   r0   rT   urlhs                  r   _real_extractzMindsIE._real_extractD   sv   NN3'	!I-y(DDLN::f+zz-(G3!-0vk':;;)$/// H((G= yy+1r 	F**U#CNN#ZZ0%fjj&89 		 8$.

:&,"ii
+zz&!JtS)6D	8$C

?(C(((GD HH	 ZZ(4H%fjj&?@HD"6::i#89$VZZ%?@%eii&78&(d<VW%fjj&>?%fjj1B&CD(4G)HI(4D)EF"
 	
r   N)
r   r   r    IE_NAMEr   r!   
_VALID_URLint_TESTSrf   r"   r   r   r$   r$      s    G,,/``J?1&+/#%#%  M '
* C1&)'%#*
	 G
 DG'FR:
r   r$   c                       e Zd ZdZd Zd Zy)MindsFeedBaseIE   c              #   p  K   | j                   dd}d}	 | j                  d| d|d| |      }|j                  d      xs g }|D ]@  }|j                  d      }|s| j                  d|z   t        j                         |       B |d	   |d
<   |d
   rt        |      | j                   k(  sy |dz  }w)Nr   )limitsynczv2/feeds/container/z/videoszpage entitiesguidzhttps://www.minds.com/newsfeed/z	load-nextfrom_timestamp)
_PAGE_SIZEr   r   r]   r$   ie_keylen)r   feed_idr   idatarq   rD   rr   s           r   _entrieszMindsFeedBaseIE._entries   s     //15>>%gYg65e-D xx
+1rH" ,zz&)oo5<NN$d, ,	, '+;&7E"#*+H0PFA s   B4B6c           	      2   | j                  |      }| j                  d| j                   d| || j                        | j                     }| j	                  | j                  |d         |t        |j                  d            |j                  d            S )Nzv1//rr   rY   briefdescription)r\   r   
_FEED_PATH
_FEED_TYPEplaylist_resultrz   r	   r   )r   r;   rw   feeds       r   rf   zMindsFeedBaseIE._real_extract   s    ..%~~$//"!G9-T__&&*oo7 ##MM$v,'$((6*+HH'(* 	*r   N)r   r   r    rt   rz   rf   r"   r   r   rl   rl      s    J(	*r   rl   c                   P    e Zd ZdZdez   Zej                  dz   ZdZdddddd	d
Z	y)MindsChannelIEchannelminds:z:(?!(?:newsfeed|media|api|archive|groups)/)(?P<id>[^/?&#]+)zhttps://www.minds.com/ottmanr)   r+   zCo-creator & CEO @minds)r-   r/   rW   6   r;   r=   playlist_mincountN
r   r   r    r   rg   r   r!   rh   r~   _TESTr"   r   r   r   r      sD    J#G,,/llJJ-"4

  Er   r   c                   N    e Zd ZdZdez   Zej                  dz   ZdZddddd	d
Z	y)MindsGroupIEgroupr   zgroups/profile/(?P<id>[0-9]+)zgroups/groupzChttps://www.minds.com/groups/profile/785582576369672204/feed/videos785582576369672204zCooking Videos)r-   r/   r   r   Nr   r"   r   r   r   r      sA    J#G,,/OOJJT&%
 Er   r   N)commonr   utilsr   r   r   r   r	   r   r$   rl   r   r   r"   r   r   <module>r      sR    ! 
- 
f
k f
R *k  *F_  ? r   