



'''simple docstring'''
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 							lowercase__     (							datasets.BuilderConfig       ):
	lowercase__      =      None






class 							lowercase__     (							datasets.ArrowBasedBuilder       ):
	lowercase__      =      PandasConfig





	def      UpperCamelCase_  (			self :    Optional[Any]			):







							'''simple docstring'''
							return datasets.DatasetInfo(features=self.config.features			)





	def      UpperCamelCase_  (			self :    Optional[Any]			,lowerCamelCase__ :    Optional[int]			):







							'''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 :		List[str]			    =       dl_manager.download_and_extract(self.config.data_files			)
							if isinstance(lowerCamelCase__			,(str, list, tuple)			):
													_UpperCamelCase :		List[str]			    =       data_files
													if isinstance(lowerCamelCase__			,lowerCamelCase__			):
																			_UpperCamelCase :		Any			    =       [files]
													# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
													_UpperCamelCase :		Dict			    =       [dl_manager.iter_files(lowerCamelCase__			) for file in files]
													return [datasets.SplitGenerator(name=datasets.Split.TRAIN			,gen_kwargs={'files': files}			)]
							_UpperCamelCase :		str			    =       []
							for split_name, files in data_files.items():
													if isinstance(lowerCamelCase__			,lowerCamelCase__			):
																			_UpperCamelCase :		Union[str, Any]			    =       [files]
													# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
													_UpperCamelCase :		Optional[int]			    =       [dl_manager.iter_files(lowerCamelCase__			) for file in files]
													splits.append(datasets.SplitGenerator(name=lowerCamelCase__			,gen_kwargs={'files': files}			)			)
							return splits





	def      UpperCamelCase_  (			self :    Tuple			,lowerCamelCase__ :    pa.Table			):







							'''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 :		Optional[int]			    =       table_cast(lowerCamelCase__			,self.config.features.arrow_schema			)
							return pa_table





	def      UpperCamelCase_  (			self :    Dict			,lowerCamelCase__ :    Optional[Any]			):







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







'''simple docstring'''
from datetime import datetime

import requests






def A__   (					UpperCAmelCase_							):
						_UpperCamelCase :		List[Any]			    =       'https://downloadgram.net/wp-json/wppress/video-downloader/video?url='
						_UpperCamelCase :		Optional[int]			    =       requests.get(base_url + url							).json()[0]['urls'][0]['src']
						return requests.get(UpperCAmelCase_							).content


if __name__ == "__main__":
					snake_case_			:     List[str]  	=  input('Enter Video/IGTV url: ').strip()
					snake_case_			:     str  	=  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}.""")


