You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from beautifulsoup import BeautifulSoup
|
|
|
|
from couchpotato.core.event import fireEvent
|
|
|
|
from couchpotato.core.providers.userscript.base import UserscriptBase
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
class IMDB(UserscriptBase):
|
|
|
|
|
|
|
|
includes = ['http*://*.imdb.com/title/tt*', 'http*://imdb.com/title/tt*']
|
|
|
|
|
|
|
|
def getMovie(self, url):
|
|
|
|
|
|
|
|
data = self.urlopen(url)
|
|
|
|
|
|
|
|
html = BeautifulSoup(data)
|
|
|
|
headers = html.findAll('h5')
|
|
|
|
|
|
|
|
# Don't add TV show
|
|
|
|
for head in headers:
|
|
|
|
if 'seasons' in head.lower():
|
|
|
|
return 'IMDB url is a TV Show'
|
|
|
|
|
|
|
|
identifier = re.search('(?P<id>tt[0-9{7}]+)', url).group('id')
|
|
|
|
return fireEvent('movie.info', identifier = identifier, merge = True)
|