Python 3 Subtitles Extractor From Youtube Video Script and Downloads it as .SRT File in Windows,Mac and Linux Using BeautifulSoup4 and Click Library Full Project For Beginners

You are currently viewing Python 3 Subtitles Extractor From Youtube Video Script and Downloads it as .SRT File in Windows,Mac and Linux Using BeautifulSoup4 and Click Library Full Project For Beginners

 

Welcome folks today in this post we will be extracting subtitles from youtube video and download it in a .srt file and store it locally in python using beautifulsoup4 library. All the full source code of the application is given below.

 

 

Get Started

 

 

In order to get started you need to install the following libraries using pip command as shown below

 

pip install click

 

pip install requests

 

pip install bs4

 

After installing all these dependencies now make an empty folder and then download the given source code from github

 

DOWNLOAD SOURCE CODE

 

 

Usage:

If you have python in your path, simply drag and drop files and folders you wish to get subtitles from on subtitle-downloader.py

Windows:

  • Install Python Follow the steps at http://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-7 to set the python path.
  • install click, requests, bs4 libraries
  • Place subtitle-downloader.py file in C:\
  • Place the Subtitle.cmd in sendto folder in windows (can be accessed by typing shell:sendto in address bar)
  • Right click the movie file (not the movie folder). You can also select multiple files. and click sendto -> Subtitle.cmd
  • If you want to download subtitles for all movies in a folder, you can use a folder as parameter to subtitle-downloader.py.

Mac:

  • Install python and make sure it is in your path
  • install click, requests, bs4 libraries
  • Open Automator and create a new document of type “Service”
  • Add an action called “Run Shell Script”
  • On the top, under ‘Service receives selected’ drop-down, select ‘files or folder’ and in the next drop-down, for ‘in’ select ‘Finder’
  • On the right top of the Run Shell Script action, make sure you selected “as arguments” for “Pass Input”
  • Copy the contents of subtitle.sh in the action
  • Edit the path to “subtitle-downloader.py” to wherever you have downloaded
  • Press Command + S to save it and give some name like “Download Subtitle”
  • Now, Right click the movie file (not the movie folder). You can also select multiple files. Click Services -> Download Subtitle
Linux with Nautilus file manager(Tested on Debian Based with nautilus as file manager):
  • Install python
  • install click, requests, bs4 libraries
  • Go to ~/.local/share/nautilus/scripts/ (Ubuntu 13.04 or above) OR ~/.gnome2/nautilus-scripts/ (Ubuntu 12.10 and below) folder and add Subtitles_in_english.sh in the folder.
  • The path for subtitle-downloader.py is hardcoded to Desktop …U can change it accordingly.
  • Now Right Click on the movie file (not the movie folder). You can also select multiple files. Click Services -> Subtitles_in_english.

Leave a Reply