diff --git a/couchpotato/core/providers/userscript/filmweb/__init__.py b/couchpotato/core/providers/userscript/filmweb/__init__.py new file mode 100644 index 00000000..8ead54d6 --- /dev/null +++ b/couchpotato/core/providers/userscript/filmweb/__init__.py @@ -0,0 +1,6 @@ +from .main import Filmweb + +def start(): + return Filmweb() + +config = [] diff --git a/couchpotato/core/providers/userscript/filmweb/main.py b/couchpotato/core/providers/userscript/filmweb/main.py new file mode 100644 index 00000000..5e6adbe1 --- /dev/null +++ b/couchpotato/core/providers/userscript/filmweb/main.py @@ -0,0 +1,28 @@ +from couchpotato.core.providers.userscript.base import UserscriptBase +import re + + +class Filmweb(UserscriptBase): + + includes = ['http://www.filmweb.pl/*'] + + def getMovie(self, url): + + cookie = {'Cookie': 'welcomeScreen=welcome_screen'} + + try: + data = self.urlopen(url, headers = cookie) + except: + return + + name = re.search("(?P[^<]+)", data) + + if name is None: + name = re.search("(?P[^<]+)", data) + + name = name.group('name').decode('string_escape') + + year = re.search("\((?P[^\)]+)\).*?", data) + year = year.group('year') + + return self.search(name, year)