From 8a344d764a0b53610df8e370d3352e25faa63b67 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 7 Apr 2012 00:03:51 +0200 Subject: [PATCH] Rottentomatoes userscript --- .../userscript/rottentomatoes/__init__.py | 6 ++++++ .../userscript/rottentomatoes/main.py | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 couchpotato/core/providers/userscript/rottentomatoes/__init__.py create mode 100644 couchpotato/core/providers/userscript/rottentomatoes/main.py diff --git a/couchpotato/core/providers/userscript/rottentomatoes/__init__.py b/couchpotato/core/providers/userscript/rottentomatoes/__init__.py new file mode 100644 index 00000000..ee8266eb --- /dev/null +++ b/couchpotato/core/providers/userscript/rottentomatoes/__init__.py @@ -0,0 +1,6 @@ +from .main import RottenTomatoes + +def start(): + return RottenTomatoes() + +config = [] diff --git a/couchpotato/core/providers/userscript/rottentomatoes/main.py b/couchpotato/core/providers/userscript/rottentomatoes/main.py new file mode 100644 index 00000000..cb36b6cf --- /dev/null +++ b/couchpotato/core/providers/userscript/rottentomatoes/main.py @@ -0,0 +1,19 @@ +from BeautifulSoup import BeautifulSoup +from couchpotato.core.event import fireEvent +from couchpotato.core.providers.userscript.base import UserscriptBase + +class RottenTomatoes(UserscriptBase): + + includes = ['http*://www.rottentomatoes.com/m/*'] + + def getMovie(self, url): + + try: + data = self.urlopen(url) + except: + return + + html = BeautifulSoup(data) + title = html.find('span', {'itemprop':'name'}).text + info = fireEvent('scanner.name_year', title, single = True) + return self.search(info['name'], info['year'])