{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"%%capture\n!pip install youtube-dl\n!youtube-dl -f 18 https://www.youtube.com/watch?v=dQw4w9WgXcQ --output video.mp4","metadata":{"execution":{"iopub.status.busy":"2021-08-16T15:47:47.528526Z","iopub.execute_input":"2021-08-16T15:47:47.52894Z","iopub.status.idle":"2021-08-16T15:47:58.294354Z","shell.execute_reply.started":"2021-08-16T15:47:47.528888Z","shell.execute_reply":"2021-08-16T15:47:58.292549Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from IPython.display import HTML\nfrom base64 import b64encode\n\ndef play(filename):\n    html = ''\n    video = open(filename,'rb').read()\n    src = 'data:video/mp4;base64,' + b64encode(video).decode()\n    html += '<video width=540 controls autoplay loop><source src=\"%s\" type=\"video/mp4\"></video>' % src \n    return HTML(html)\n\nplay('./video.mp4')","metadata":{"execution":{"iopub.status.busy":"2021-08-16T15:48:11.799935Z","iopub.execute_input":"2021-08-16T15:48:11.800336Z","iopub.status.idle":"2021-08-16T15:48:12.497549Z","shell.execute_reply.started":"2021-08-16T15:48:11.800297Z","shell.execute_reply":"2021-08-16T15:48:12.49319Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Sorry, it had to be done...","metadata":{}}]}