Update plex_netflix_check.py

This commit is contained in:
blacktwin 2017-09-15 15:02:45 -04:00 committed by GitHub
parent 7faff46ec4
commit 6051989ece

View File

@ -24,19 +24,19 @@ def instantwatch_search(name, type):
NETFLIX_URL = 'http://www.netflix.com/title/' NETFLIX_URL = 'http://www.netflix.com/title/'
if type == 'movie': if type == 'movie':
search_type = '&content_type%5B%5D=1' content_type = '1'
elif type == 'show': elif type == 'show':
search_type = '&content_type%5B%5D=3' content_type = '3'
else: else:
search_type ='' content_type =''
search_title = name.lower().replace(' ','+') payload = {'content_type': content_type,
search_url = 'http://instantwatcher.com/search?source=1+2+3&q={}'.format(search_title) 'q': name.lower()}
r = requests.get('http://instantwatcher.com/search'.rstrip('/'), params=payload)
results_lst = [] results_lst = []
r = requests.get(search_url + search_type)
res_data = bf.data(fromstring(r.content)) res_data = bf.data(fromstring(r.content))
res_data = res_data['html']['body']['div']['div'][1] res_data = res_data['html']['body']['div']['div'][1]
@ -79,6 +79,7 @@ def instantwatch_search(name, type):
else: else:
print('Could not find exact name match.') print('Could not find exact name match.')
for t in plex.library.section('Movies').all(): for t in plex.library.section('Movies').all():
print('Running check on {}'.format(t.title)) print('Running check on {}'.format(t.title))
instantwatch_search(t.title, t.type) instantwatch_search(t.title, t.type)