Q's YouTube Trailer Scraper A simple shell script to search YouTube and download movie trailers based on contents of my Kodi library. Makes for a better, locally served "Cinema Experience/Vision" mode.
|Category b1107a7dd1 v0.25 - formatiing clean-up||1 year ago|
|COPYING.WTFPL||7 years ago|
|QYTTS.sh||1 year ago|
|README.md||1 year ago|
# QsYouTubeTrailerScraper - QYTTS v0.25
This script will scrape your Kodi library for movie titles, then search YouTube for it's trailer. It'll download the trailers to a specified directory, which is used by the Cinema Experience script for Kodi to load trailers. This way you can see the trailers for films you own, withought having to deal with all the buffering that comes from streaming.
I know there are other tools out there to get trailers for your library, but most were windows based. The ones that weren't would just grab trailers for any film, whether you have it or not.
This was designed for my original Raspberry Pi Model B, running OSMC. As such, it'll probably run on any Linux Kodi setup.
This does work "out of the box" now, but the defaults may not be ideal.
There is one main configuration variable to change, the location to store downloaded trailers. This currently defaults to "~/Trailers/".
There are some other options that can be tweaked in addition:-
bash shell environment
You can set a config option in the script to automatically try and fix dependencies, currently this is only for systems using APT as a package manager. This is off by default to avoid making unwanted changes to your system.
It is IMPERATIVE that you use an up-to-date version of youtube-dl, as they are playing whack-a-mole with YouTube servers constantly. I have found that the version kept in some repos (namely raspbian) isn't always up to date. I highly recommend installing it direct from the developers as mentioned above. If you do run into any issues, running "youtube-dl -U" to update can often fix problems grabbing trailers.
Grabbing entire films
Due to the simplicity of this script, it will grab the first YouTube result after searching for the movie name + "trailer". In the case of some films - mostly older or independent films - the first result on youtube will be the complete film. To avoid this issue, there are 2 countermeasures - it will check the title of the YouTube video to ensure it contains the word "Trailer" (case insensitive). Secondly, after downloading it checks if it is larger than the maximum file size (default is 50MB), and if it is too large then deletes the file. Unfortunately I have no way to check file size before downloading, so looking at extra ways of avoiding unnecessary bandwidth usage...
YT updating their site
YouTube seem to be updating their search result page with increasing frequency, breaking my dirty-hack scraper. I currently have a good setup, which may last for some time. But now I know youtube-dl can also do search I will switch my method if Google break this script again.
If you encounter any other issues, please raise an issue on notabug or email (https://notabug.org/Category/QYTTS)
Copyright © 2015 Category categoryNOSPAM@quintendo.uk This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details.