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 bbb14643fd v0.13||1 year ago|
|COPYING.WTFPL||4 years ago|
|QYTTS.sh||1 year ago|
|README.md||1 year ago|
# QsYouTubeTrailerScraper - QYTTS v0.13
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.
Ensure all configuration options are set correctly, then just run the script as the same user that runs Kodi. No arguments needed, just make sure the Kodi user has write access to temp & trailer directories.
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 100MB), 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 may have to get more clever with extracting the YT video ID from their page...
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.