diff --git a/couchpotato/core/providers/automation/imdb/__init__.py b/couchpotato/core/providers/automation/imdb/__init__.py index ce2ea5ea..f9baabf2 100644 --- a/couchpotato/core/providers/automation/imdb/__init__.py +++ b/couchpotato/core/providers/automation/imdb/__init__.py @@ -12,7 +12,7 @@ config = [{ 'list': 'watchlist_providers', 'name': 'imdb_automation_watchlist', 'label': 'IMDB', - 'description': 'From any public IMDB watchlists. Url should be the CSV link.', + 'description': 'From any public IMDB watchlists.', 'options': [ { 'name': 'automation_enabled', diff --git a/couchpotato/core/providers/automation/imdb/main.py b/couchpotato/core/providers/automation/imdb/main.py index 25f2fee8..4f41bc14 100644 --- a/couchpotato/core/providers/automation/imdb/main.py +++ b/couchpotato/core/providers/automation/imdb/main.py @@ -1,4 +1,5 @@ import traceback +import re from bs4 import BeautifulSoup from couchpotato import fireEvent @@ -42,23 +43,55 @@ class IMDBWatchlist(IMDBBase): index = -1 for watchlist_url in watchlist_urls: + try: + # Get list ID + ids = re.findall('[list/|list_id=]([a-zA-Z0-9\-_]{11})', watchlist_url) + if len(ids) == 1: + watchlist_url = 'http://www.imdb.com/list/%s/?view=compact&sort=created:asc' % ids[0] + # Try find user id with watchlist + else: + userids = re.findall('(ur\d{7})', watchlist_url) + if len(userids) == 1: + watchlist_url = 'http://www.imdb.com/user/%s/watchlist?view=compact&sort=created:asc' % userids[0] + except: + log.error('Failed getting id from watchlist: %s', traceback.format_exc()) + index += 1 if not watchlist_enablers[index]: continue - try: - log.debug('Started IMDB watchlists: %s', watchlist_url) - rss_data = self.getHTMLData(watchlist_url) - imdbs = getImdb(rss_data, multiple = True) if rss_data else [] + start = 0 + while True: + try: - for imdb in imdbs: - movies.append(imdb) + w_url = '%s&start=%s' % (watchlist_url, start) + log.debug('Started IMDB watchlists: %s', w_url) + html = self.getHTMLData(w_url) - if self.shuttingDown(): + try: + split = splitString(html, split_on="