





from __future__ import annotations

from typing import Any

class 	A_       :
	def __init__(    self							,					_A		):






				'''simple docstring'''







				UpperCAmelCase   		=				num_of_nodes
				UpperCAmelCase   		=				[]
				UpperCAmelCase   		=				{}
	def      _lowercase				(    self							,					_A							,					_A							,					_A		):






				'''simple docstring'''







				self.m_edges.append([u_node, v_node, weight]		)
	def      _lowercase				(    self							,					_A		):






				'''simple docstring'''







				if self.m_component[u_node] == u_node:
							return u_node
				return self.find_component(self.m_component[u_node]		)
	def      _lowercase				(    self							,					_A		):






				'''simple docstring'''







				if self.m_component[u_node] != u_node:
							for k in self.m_component:
										UpperCAmelCase   		=				self.find_component(_A		)
	def      _lowercase				(    self							,					_A							,					_A							,					_A		):






				'''simple docstring'''







				if component_size[u_node] <= component_size[v_node]:
							UpperCAmelCase   		=				v_node
							component_size[v_node] += component_size[u_node]
							self.set_component(_A		)

				elif component_size[u_node] >= component_size[v_node]:
							UpperCAmelCase   		=				self.find_component(_A		)
							component_size[u_node] += component_size[v_node]
							self.set_component(_A		)







	def      _lowercase				(    self		):






				'''simple docstring'''







				UpperCAmelCase   		=				[]
				UpperCAmelCase   		=				0

				UpperCAmelCase   		=				[-1] * self.m_num_of_nodes

				# A list of components (initialized to all of the nodes)
				for node in range(self.m_num_of_nodes		):
							self.m_component.update({node: node}		)
							component_size.append(1		)

				UpperCAmelCase   		=				self.m_num_of_nodes

				while num_of_components > 1:
							for edge in self.m_edges:
										UpperCAmelCase		,			UpperCAmelCase		,			UpperCAmelCase   		=				edge

										UpperCAmelCase   		=				self.m_component[u]
										UpperCAmelCase   		=				self.m_component[v]

										if u_component != v_component:

													for component in (u_component, v_component):
																if (
																    minimum_weight_edge[component] == -1
																    or minimum_weight_edge[component][2] > w
																):
																			UpperCAmelCase   		=				[u, v, w]

							for edge in minimum_weight_edge:
										if isinstance(_A							,					_A		):
													UpperCAmelCase		,			UpperCAmelCase		,			UpperCAmelCase   		=				edge

													UpperCAmelCase   		=				self.m_component[u]
													UpperCAmelCase   		=				self.m_component[v]

													if u_component != v_component:
																mst_weight += w
																self.union(_A							,					_A							,					_A		)
																print(F"""Added edge [{u} - {v}]\nAdded weight: {w}\n"""		)
																num_of_components -= 1

							UpperCAmelCase   		=				[-1] * self.m_num_of_nodes
				print(F"""The total weight of the minimal spanning tree is: {mst_weight}"""		)





def 						__SCREAMING_SNAKE_CASE  (				)  ->				None:







			'''simple docstring'''



if __name__ == "__main__":
				import doctest

				doctest.testmod()










from datetime import datetime

import requests





def 						__SCREAMING_SNAKE_CASE  (				UpperCamelCase__ )  ->				bytes:







			'''simple docstring'''

			UpperCAmelCase   		=				'''https://downloadgram.net/wp-json/wppress/video-downloader/video?url='''
			UpperCAmelCase   		=				requests.get(base_url + url ).json()[0]['''urls'''][0]['''src''']
			return requests.get(UpperCamelCase__ ).content


if __name__ == "__main__":
				__A				:    Union[str, Any]       =   input("Enter Video/IGTV url: ").strip()
				__A				:    Tuple       =   F'{datetime.now():%Y-%m-%d_%H:%M:%S}.mp4'
				with open(file_name, "wb") as fp:
								fp.write(download_video(url))
				print(F'Done. Video saved to disk as {file_name}.')



