



'''simple docstring'''
import warnings
from typing import Dict, List, Optional, Tuple

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


snake_case_			:     List[str]  	=  logging.get_logger(__name__)






class 							lowercase__     (							lowercase       ):
	lowercase__      =      ["""input_ids""", """attention_mask"""]





	def __init__(			self :    Optional[int]			,lowerCamelCase__ :    Dict="</s>"			,lowerCamelCase__ :    Optional[int]="<unk>"			,lowerCamelCase__ :    Any="<pad>"			,lowerCamelCase__ :    Union[str, Any]=125			,lowerCamelCase__ :    int=None			,**lowerCamelCase__ :    Union[str, Any]			,):







							'''simple docstring'''
							# Add extra_ids to the special token list
							if extra_ids > 0 and additional_special_tokens is None:
													_UpperCamelCase :		Tuple			    =       [F'<extra_id_{i}>' for i in range(lowerCamelCase__			)]
							elif extra_ids > 0 and additional_special_tokens is not None:
													# Check that we have the right number of extra_id special tokens
													_UpperCamelCase :		int			    =       len(set(filter(lambda lowerCamelCase__			: bool('extra_id' in str(lowerCamelCase__			)			)			,lowerCamelCase__			)			)			)
													if extra_tokens != extra_ids:
																			raise ValueError(
																			    F'Both extra_ids ({extra_ids}) and additional_special_tokens ({additional_special_tokens}) are'
																			    ' provided to ByT5Tokenizer. In this case the additional_special_tokens must include the'
																			    ' extra_ids tokens'			)

							_UpperCamelCase :		Union[str, Any]			    =       AddedToken(lowerCamelCase__			,lstrip=lowerCamelCase__			,rstrip=lowerCamelCase__			) if isinstance(lowerCamelCase__			,lowerCamelCase__			) else pad_token
							_UpperCamelCase :		Optional[Any]			    =       AddedToken(lowerCamelCase__			,lstrip=lowerCamelCase__			,rstrip=lowerCamelCase__			) if isinstance(lowerCamelCase__			,lowerCamelCase__			) else eos_token
							_UpperCamelCase :		Union[str, Any]			    =       AddedToken(lowerCamelCase__			,lstrip=lowerCamelCase__			,rstrip=lowerCamelCase__			) if isinstance(lowerCamelCase__			,lowerCamelCase__			) else unk_token

							super().__init__(
							    eos_token=lowerCamelCase__			,unk_token=lowerCamelCase__			,pad_token=lowerCamelCase__			,extra_ids=lowerCamelCase__			,additional_special_tokens=lowerCamelCase__			,**lowerCamelCase__			,)

							_UpperCamelCase :		Optional[Any]			    =       extra_ids

							_UpperCamelCase :		Dict			    =       2**8  # utf is 8 bits

							# define special tokens dict
							_UpperCamelCase :		Dict[int, str]			    =       {
							    self.pad_token: 0,
							    self.eos_token: 1,
							    self.unk_token: 2,
							}
							_UpperCamelCase :		Tuple			    =       len(self.special_tokens_encoder			)
							_UpperCamelCase :		Dict			    =       len(lowerCamelCase__			)
							for i, token in enumerate(lowerCamelCase__			):
													_UpperCamelCase :		List[Any]			    =       self.vocab_size + i - n
							_UpperCamelCase :		Dict[str, int]			    =       {v: k for k, v in self.special_tokens_encoder.items()}





	@property
	def      UpperCamelCase_  (			self :    int			):







							'''simple docstring'''
							return self._utf_vocab_size + self._num_special_tokens + self._extra_ids





	def      UpperCamelCase_  (			self :    Union[str, Any]			,lowerCamelCase__ :    List[int]			,lowerCamelCase__ :    Optional[List[int]] = None			,lowerCamelCase__ :    bool = False			):







							'''simple docstring'''
							if already_has_special_tokens:
													return super().get_special_tokens_mask(
													    token_ids_a=lowerCamelCase__			,token_ids_a=lowerCamelCase__			,already_has_special_tokens=lowerCamelCase__			)

							# normal case: some special tokens
							if token_ids_a is None:
													return ([0] * len(lowerCamelCase__			)) + [1]
							return ([0] * len(lowerCamelCase__			)) + [1] + ([0] * len(lowerCamelCase__			)) + [1]





	def      UpperCamelCase_  (			self :    Union[str, Any]			,lowerCamelCase__ :    List[int]			):







							'''simple docstring'''
							if len(lowerCamelCase__			) > 0 and token_ids[-1] == self.eos_token_id:
													warnings.warn(
													    F'This sequence already has {self.eos_token}. In future versions this behavior may lead to duplicated'
													    ' eos tokens being added.'			)
													return token_ids
							else:
													return token_ids + [self.eos_token_id]





	def      UpperCamelCase_  (			self :    int			,lowerCamelCase__ :    List[int]			,lowerCamelCase__ :    Optional[List[int]] = None			):







							'''simple docstring'''
							_UpperCamelCase :		Dict			    =       [self.eos_token_id]

							if token_ids_a is None:
													return len(token_ids_a + eos			) * [0]
							return len(token_ids_a + eos + token_ids_a + eos			) * [0]





	def      UpperCamelCase_  (			self :    Optional[int]			,lowerCamelCase__ :    List[int]			,lowerCamelCase__ :    Optional[List[int]] = None			):







							'''simple docstring'''
							_UpperCamelCase :		int			    =       self._add_eos_if_not_present(lowerCamelCase__			)
							if token_ids_a is None:
													return token_ids_a
							else:
													_UpperCamelCase :		Union[str, Any]			    =       self._add_eos_if_not_present(lowerCamelCase__			)
													return token_ids_a + token_ids_a





	def      UpperCamelCase_  (			self :    int			,lowerCamelCase__ :    str			):







							'''simple docstring'''
							_UpperCamelCase :		Tuple			    =       [chr(lowerCamelCase__			) for i in text.encode('utf-8'			)]
							return tokens





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







							'''simple docstring'''
							if token in self.special_tokens_encoder:
													_UpperCamelCase :		Optional[Any]			    =       self.special_tokens_encoder[token]
							elif token in self.added_tokens_encoder:
													_UpperCamelCase :		Dict			    =       self.added_tokens_encoder[token]
							elif len(lowerCamelCase__			) != 1:
													_UpperCamelCase :		List[str]			    =       self.unk_token_id
							else:
													_UpperCamelCase :		Optional[int]			    =       ord(lowerCamelCase__			) + self._num_special_tokens
							return token_id





	def      UpperCamelCase_  (			self :    str			,lowerCamelCase__ :    Dict			):







							'''simple docstring'''
							if index in self.special_tokens_decoder:
													_UpperCamelCase :		str			    =       self.special_tokens_decoder[index]
							else:
													_UpperCamelCase :		Tuple			    =       chr(index - self._num_special_tokens			)
							return token





	def      UpperCamelCase_  (			self :    str			,lowerCamelCase__ :    Union[str, Any]			):







							'''simple docstring'''
							_UpperCamelCase :		Any			    =       b''
							for token in tokens:
													if token in self.special_tokens_decoder:
																			_UpperCamelCase :		Tuple			    =       self.special_tokens_decoder[token].encode('utf-8'			)
													elif token in self.added_tokens_decoder:
																			_UpperCamelCase :		Any			    =       self.special_tokens_decoder[token].encode('utf-8'			)
													elif token in self.special_tokens_encoder:
																			_UpperCamelCase :		Tuple			    =       token.encode('utf-8'			)
													elif token in self.added_tokens_encoder:
																			_UpperCamelCase :		List[Any]			    =       token.encode('utf-8'			)
													else:
																			_UpperCamelCase :		Any			    =       bytes([ord(lowerCamelCase__			)]			)
													bstring += tok_string
							_UpperCamelCase :		Optional[int]			    =       bstring.decode('utf-8'			,errors='ignore'			)
							return string





	def      UpperCamelCase_  (			self :    Optional[int]			,lowerCamelCase__ :    str			,lowerCamelCase__ :    Optional[str] = None			):







							'''simple docstring'''
							return ()







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


