From 349d7d48661028bff4ab05d0ddb817aab9b7e369 Mon Sep 17 00:00:00 2001 From: softcat Date: Tue, 8 Apr 2014 13:44:03 +0200 Subject: [PATCH] Added filmstarts.de userscript --- .../media/movie/providers/userscript/filmstarts.py | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 couchpotato/core/media/movie/providers/userscript/filmstarts.py diff --git a/couchpotato/core/media/movie/providers/userscript/filmstarts.py b/couchpotato/core/media/movie/providers/userscript/filmstarts.py new file mode 100644 index 0000000..1e35be2 --- /dev/null +++ b/couchpotato/core/media/movie/providers/userscript/filmstarts.py @@ -0,0 +1,29 @@ +from BeautifulSoup import BeautifulSoup +from couchpotato.core.media._base.providers.userscript.base import UserscriptBase + +autoload = 'Filmstarts' + +class Filmstarts(UserscriptBase): + + includes = ['*://www.filmstarts.de/kritiken/*'] + + def getMovie(self, url): + try: + data = self.getUrl(url) + except: + return + + html = BeautifulSoup(data) + table = html.find("table", attrs={"class": "table table-standard thead-standard table-striped_2 fs11"}) + + if table.find(text='Originaltitel'): + # Get original film title from the table specified above + name = table.find("div", text="Originaltitel").parent.parent.parent.td.text + else: + # If none is available get the title from the meta data + name = html.find("meta", {"property":"og:title"})['content'] + + # Year of production is not available in the meta data, so get it from the table + year = table.find("tr", text="Produktionsjahr").parent.parent.parent.td.text + + return self.search(name, year) \ No newline at end of file