U
    a+d                     @   s.   d Z ddlZddlZddlmZ dddZdS )z+
Utilities to get a file from the internet
    N)subprocess_callFc              
   C   s   t j|r|sdS d| kr^tj| dd}t|d"}|jddD ]}|| qBW 5 Q R X nFztd| d	|g W n0 t	k
r } zt	|j
d
 W 5 d}~X Y nX dS )a   Small utility to download the file at 'url' under name 'filename'.
    If url is a youtube video ID like z410eauCnH it will download the video
    using youtube-dl (install youtube-dl first !).
    If the filename already exists and overwrite=False, nothing will happen.
    N.T)streamwb   )
chunk_sizez
youtube-dlz-ozs
 A possible reason is that youtube-dl is not installed on your computer. Install it with  "pip install youtube_dl")ospathexistsrequestsgetopeniter_contentwriter   OSErrormessage)urlfilename	overwriterfdchunke r   ?/tmp/pip-unpacked-wheel-0yp4gafk/moviepy/video/io/downloader.pydownload_webfile   s    r   )F)__doc__r   r   Zmoviepy.toolsr   r   r   r   r   r   <module>   s   