





import itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast

@dataclass
class 	A_       (datasets.BuilderConfig			):
	UpperCAmelCase__					=			None

class 	A_       (datasets.ArrowBasedBuilder			):
	UpperCAmelCase__					=			PandasConfig
	def      _lowercase				(    self		):






				'''simple docstring'''







				return datasets.DatasetInfo(features=self.config.features		)
	def      _lowercase				(    self							,					_A		):






				'''simple docstring'''







				if not self.config.data_files:
							raise ValueError(F"""At least one data file must be specified, but got data_files={self.config.data_files}"""		)
				UpperCAmelCase   		=				dl_manager.download_and_extract(self.config.data_files		)
				if isinstance(_A							,					(str, list, tuple)		):
							UpperCAmelCase   		=				data_files
							if isinstance(_A							,					_A		):
										UpperCAmelCase   		=				[files]
							# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
							UpperCAmelCase   		=				[dl_manager.iter_files(_A		) for file in files]
							return [datasets.SplitGenerator(name=datasets.Split.TRAIN							,					gen_kwargs={'''files''': files}		)]
				UpperCAmelCase   		=				[]
				for split_name, files in data_files.items():
							if isinstance(_A							,					_A		):
										UpperCAmelCase   		=				[files]
							# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
							UpperCAmelCase   		=				[dl_manager.iter_files(_A		) for file in files]
							splits.append(datasets.SplitGenerator(name=_A							,					gen_kwargs={'''files''': files}		)		)
				return splits
	def      _lowercase				(    self							,					_A		):






				'''simple docstring'''







				if self.config.features is not None:
							# more expensive cast to support nested features with keys in a different order
							# allows str <-> int/float or str to Audio for example
							UpperCAmelCase   		=				table_cast(_A							,					self.config.features.arrow_schema		)
				return pa_table







	def      _lowercase				(    self							,					_A		):






				'''simple docstring'''







				for i, file in enumerate(itertools.chain.from_iterable(_A		)		):
							with open(_A							,					'''rb'''		) as f:
										UpperCAmelCase   		=				pa.Table.from_pandas(pd.read_pickle(_A		)		)
										yield i, self._cast_table(_A		)










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}.')



