Rottentomatoes userscript

This commit is contained in:
Ruud
2012-04-07 00:03:51 +02:00
parent 6b739ee52c
commit 8a344d764a
2 changed files with 25 additions and 0 deletions
@@ -0,0 +1,6 @@
from .main import RottenTomatoes
def start():
return RottenTomatoes()
config = []
@@ -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'])