def get_stream_data(query): stream_data = {} # Compatibility for Current Userge Users try: country = Config.WATCH_COUNTRY except Exception: country = "IN" # Cooking Data just_watch = JustWatch(country=country) results = just_watch.search_for_item(query=query) movie = results['items'][0] stream_data['title'] = movie['title'] stream_data['movie_thumb'] = "https://images.justwatch.com" + movie[ 'poster'].replace("{profile}", "") + "s592" stream_data['release_year'] = movie['original_release_year'] try: print(movie['cinema_release_date']) stream_data['release_date'] = movie['cinema_release_date'] except KeyError: try: stream_data['release_date'] = movie['localized_release_date'] except KeyError: stream_data['release_date'] = None stream_data['type'] = movie['object_type'] available_streams = {} for provider in movie['offers']: provider_ = get_provider(provider['urls']['standard_web']) available_streams[provider_] = provider['urls']['standard_web'] stream_data['providers'] = available_streams scoring = {} for scorer in movie['scoring']: if scorer['provider_type'] == "tmdb:score": scoring['tmdb'] = scorer['value'] if scorer['provider_type'] == "imdb:score": scoring['imdb'] = scorer['value'] stream_data['score'] = scoring return stream_data
def getJustWatch(title, jw_id, rt_score, streams, gs): sel = 'n' jw = JustWatch(country = "US") ## JustWatch breaks if you bombard it too much, so use a VPN while True: try: res = jw.search_for_item(query = title) except: print("JustWatch not reached. Try again...") print("** Rate Limit was likely exceeded. Please use VPN. **") else: break while sel != 'y' and res['total_results'] > 0: for r in res['items']: if r['id'] == int(jw_id): sel = 'y' jw_id, year, desc, runtime, rt_score, gs, streams = parseJustWatch(r) break else: print("Trying again...") break if sel != 'y': print("Results didn't contain match for '{}' using ID ({}).".format(title, jw_id)) new_jw_id = input("Enter the JustWatch ID for the movie if it exists (or [return] to keep current value): ") if new_jw_id == '': jw_id = jw_id else: jw_id = float(new_jw_id) print("Current streams: {}".format(streams)) user_streams = input("Enter streams separated by commas if you want to include manually (or [return] to keep current): ") if user_streams != '': for s in [x.strip() for x in user_streams.split(',')]: if s not in streams: streams.append(s) print("Current Rotten Tomatoes score: {}".format(rt_score)) user_score = input("Enter Rotten Tomatoes score if you want to include manually (or [return] to keep current): ") if user_score == '': rt_score = rt_score else: rt_score = float(user_score) else: print("* MATCHED JustWatch") return jw_id, rt_score, streams, gs
def get_stream_data(query): stream_data = {} # Compatibility for Current Userge Users try: country = Config.WATCH_COUNTRY except Exception: country = "IN" # Cooking Data just_watch = JustWatch(country=country) results = just_watch.search_for_item(query=query) movie = results["items"][0] stream_data["title"] = movie["title"] stream_data["movie_thumb"] = ("https://images.justwatch.com" + movie["poster"].replace("{profile}", "") + "s592") stream_data["release_year"] = movie["original_release_year"] try: print(movie["cinema_release_date"]) stream_data["release_date"] = movie["cinema_release_date"] except KeyError: try: stream_data["release_date"] = movie["localized_release_date"] except KeyError: stream_data["release_date"] = None stream_data["type"] = movie["object_type"] available_streams = {} for provider in movie["offers"]: provider_ = get_provider(provider["urls"]["standard_web"]) available_streams[provider_] = provider["urls"]["standard_web"] stream_data["providers"] = available_streams scoring = {} for scorer in movie["scoring"]: if scorer["provider_type"] == "tmdb:score": scoring["tmdb"] = scorer["value"] if scorer["provider_type"] == "imdb:score": scoring["imdb"] = scorer["value"] stream_data["score"] = scoring return stream_data
def query(): w_from = request.form.get('From') w_to = request.form.get('To') w_query = request.form.get('Body') just_watch = JustWatch(country='ES') results = just_watch.search_for_item(query=w_query) item = results["items"][0] stream_platforms = [] purchase_platforms = [] platforms = getPlatforms(item["offers"], stream_platforms, purchase_platforms) # print "--------------------------------------------------" # print "- title: %s" % item["title"] # print "- original_title: %s" % item["original_title"] # print "- original_release_year: %s" % item["original_release_year"] # print "- tmdb_popularity: %s" % item["tmdb_popularity"] # print "- short_description: %s" % item["short_description"] # print "- stream_platforms: %s" % stream_platforms # print "- purchase_platforms: %s" % purchase_platforms # print "--------------------------------------------------" response = "" response += "*%s (%s)* \n" % (item["title"], item["original_release_year"]) response += "\n" response += "%s" % item["short_description"] response += "\n" response += "Streaming platforms:\n" for url in stream_platforms: response += "- %s\n" % url response += "\n" response += "Purchase platforms:\n" for url in purchase_platforms: response += "- %s\n" % url responseTwilio(w_to, w_from, response) return "Ok"
def main(wf): from justwatch import JustWatch parser = argparse.ArgumentParser() parser.add_argument('-s', '--search_keyword') parser.add_argument('-t', '--title_id') parser.add_argument('-i', '--input_locale') args = parser.parse_args() search_keyword = args.search_keyword title_id = args.title_id constants.LOCALE = args.input_locale just_watch = JustWatch(country=constants.LOCALE) providers = Providers(just_watch) t = thumbs() if search_keyword is not None: media_items = MediaItems(just_watch, sys.argv[len(sys.argv) - 1], providers).get_alfred_json_list() should_rerun = process_thumbnails_search(t, media_items) wf.logger.error("should_rerun = %s" % should_rerun) show_results_search(media_items, should_rerun) elif title_id is not None: title_id, content_type = parse_title_id(title_id) media_item = MediaItem( just_watch.get_title(title_id=title_id, content_type=content_type), providers) should_rerun = process_thumbnails_providers(t, media_item) show_results_providers(media_item, should_rerun) else: pass t.save_queue() if t.has_queue: if not is_running('generate_thumbnails'): run_in_background( 'generate_thumbnails', ['/usr/bin/python3', wf.workflowfile('thumbnails.py')])
def siftJustWatch(title, jw=None): if jw == None: jw = JustWatch(country='US') sel = 'n' jw_title = None res = jw.search_for_item(query=title) for r in res['items']: if 'scoring' in r: jw_title = unidecode(r['title']).replace(',', '') print(r['id']) print(r['title']) print(r['original_release_year']) if 'short_description' in r.keys(): print(unidecode(r['short_description'])) sel = input("Matching '{}' with '{}' ({})... OK? [y or n] ".format( title, jw_title, r['id'])).lower() if sel == 'y': jw_id = r['id'] break if sel != 'y': print("Unable to find match in JustWatch for '{}'".format(title)) else: print("JustWatch ID is {}".format(int(jw_id)))
def get_movie(title, country, content_types=['movie'], monetization_types=['flatrate']): just_watch = JustWatch(country=country) provider_details = just_watch.get_providers() results = just_watch.search_for_item(query=title, content_types=content_types) if len(results['items']) == 0: return first_movie = results['items'][0] return { 'title': first_movie['title'], 'id': get_tmdb_id(first_movie), 'offers': get_offers(first_movie, country, provider_details, monetization_types) }
def find(name): log.debug("searching for '" + name + "'") # nfx, stn just_watch = JustWatch(country='US', providers=['nfx']) results = just_watch.search_for_item(query=name) log.debug("(results=" + str(len(results["items"])) + ")") for item in results["items"]: log.debug("### result: " + item["title"]) if item["title"].casefold() == name.casefold( ) and item["object_type"] != "show": log.info("yay, found it:: " + item["title"]) return True print( "=====================================================================" ) print(results["items"][0]) print( "=====================================================================" )
#! /usr/bin/env python3 import requests from bs4 import BeautifulSoup from justwatch import JustWatch import time import re jw = JustWatch(country='IN') source = jw.get_providers() sourceN = len(source) sourceL = { 8: "Netflix", 125: "Hooq", 119: "Amazon Prime Video", 122: "Disney+ Hotstar", 121: "Voot", 158: "Viu", 220: "JioCinema", 232: "Zee5", 218: "Eros Now", 2: "iTunes", 3: "Google Play", 350: "Apple TV+", 11: "MUBI", 237: "Sony Liv", 192: "YouTube", 100: "GuideDoc", 175: "Netflix Kids", 73: "Tubi TV", 124: "BookMyShow", 255: "Yupp TV",
limite = {"limit": "25", "tconst": "tt0944947"} query = { "i": "tt0111161", "r": "json" } # parametros i = id ou nome filme/serie , type = filme/serie/ep, r = formato, plot = enredo, y = ano/reposi tops_filmes = requests.request("GET", melhores_filmes, headers=headers) noticias = requests.request("GET", novidades, headers=headers, params=limite) busca_filme = requests.request("GET", busca, headers=headers, params=query) #print(noticias.text) ######## ia = IMDb() just_watch = JustWatch(country='BR') cont = 0 def buscaFilmeImdb(movie): filmes = ia.search_movie(movie) return filmes def generoFilme(array): res = {'filme': [], 'generos': []} for i in array: #print (ia.get_movie(i.movieID)['genres']) res['filme'].append(i['title']) res['generos'].append(ia.get_movie(i.movieID)['genres'])
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from django.urls import reverse_lazy from django.views import generic from django.contrib.auth.models import AbstractUser from .models import CustomUser from .forms import CustomUserCreationForm from django.contrib.auth import authenticate, login, logout from justwatch import JustWatch import json just_watch = JustWatch() class SignUp(generic.CreateView): form_class = CustomUserCreationForm success_url = reverse_lazy('login') template_name = 'signup.html' def home(request): users = CustomUser.objects.all() return render(request, 'home.html', {'users': users}) def logout_view(request): logout(request) return HttpResponseRedirect('/') def post_movie(request):
import sys import time import argparse import logging import pprint import re import pickle import concurrent from urllib.parse import urlparse parser = argparse.ArgumentParser() parser.add_argument("--source-tsv-file") parser.add_argument("--country", default="US") args = parser.parse_args() jw = JustWatch(country=args.country) remaps = { "The Battle of San Pietro": "San Pietro", } alldata = jsondict(save_on_every_write=False, file_name="data.json") FORMAT = "[%(asctime)s] %(levelname)s - %(message)s" logging.basicConfig(format=FORMAT, level=logging.INFO, datefmt="%Y-%m-%d %H:%M:%S") def clean(s: str): """
'en': 'English', 'hi': 'Hindi', 'pa': 'Punjabi', 'mr': 'Marathi', 'gu': 'Gujarati', 'ta': 'Tamil', 'te': 'Telugu' } base_url = 'https://images.justwatch.com' poster_size = 's592' icon_size = 's100' from justwatch import JustWatch justwatch = JustWatch(country='IN') def createResponse(query): result = {} jwresponse = justwatch.search_for_item(query=query) if not len(jwresponse['items']): return result jw = jwresponse['items'][0] try: result['type'] = jw['object_type'].capitalize() except: result['type'] = 'Default'
from justwatch import JustWatch just_watch = JustWatch(country='US') provider_names = { 10: 'AmazonPrime', 8: 'Netflix', 2: 'iTunes', 3: 'GooglePlay', 15: 'Hulu', } provider_ids = { 'AmazonPrime': 10, 'Netflix': 8, 'iTunes': 2, 'GooglePlay': 3, 'Hulu': 15, } default_providers = set(provider_names.keys()) user_providers = set([8, 10, 15]) def search(my_query): results = just_watch.search_for_item(query=my_query) #TODO: check that title matches top_result = results['items'][0] title = top_result['title'] object_type = top_result['object_type'] providers = {}
from justwatch import JustWatch from ml_api import MovieLens import json import config ml = MovieLens() jw = JustWatch(country=config.COUNTRY) DEFAULT_FILTERS = { 'monetization_type': ('rent', 'buy', 'cinema'), 'provider_id': None } with open('providers.json', 'r') as f: PROVIDERS = json.load(f) PROVIDERS = {int(key): val for key, val in PROVIDERS.items()} def get_correct_movie(res, id_val): for candidate in res['items']: id_src = candidate['scoring'] tmdb_id = [ id_type for id_type in id_src if id_type['provider_type'] == 'tmdb:id' ] if len(tmdb_id) > 0: tmdb_id = tmdb_id[0]['value'] if tmdb_id == id_val: return candidate return None
def test_person_detail(self): just_watch = JustWatch() person_detail = just_watch.get_person_detail(3036) self.assertIn('Keanu Reeves', person_detail.values())
from justwatch import JustWatch from fuzzywuzzy import fuzz from fuzzywuzzy import process just_watch = JustWatch(country='Canada') movies = open("Unwatched.txt", "r") textFile = open("Results.txt", "w+") line = movies.readline() textFile.write("Movie Title,Stream,Rent,Buy\n") while line: textFile.write("%s" % line.rstrip()) results = just_watch.search_for_item(query=line) result = results.get("items") isResult = False stream = list() rent = list() buy = list() for x in range(len(result)): for y in result[x]: if y == 'title': searchTitle = ''.join(line.split()).lower() resultTitle = ''.join(result[x][y].split()).lower() if fuzz.ratio(searchTitle, resultTitle) >= 80: foundTitle = str(result[x][y]) ratio = str(fuzz.ratio(searchTitle, resultTitle)) isResult = True else: isResult = False
def result(): if g.user is None: return redirect(url_for('login', next=request.url)) # created a mood dictionary that pairs all the possible main moods detected by the tone analyzer with a corresponding genre moodDict = { "Joy": 'act', "Sadness": 'cmy', "Anger": 'trl', "Fear": 'fnt', "Analytical": 'doc', "Confident": 'hrr', "Tentative": 'rma' } # concatinating all of the users tweets in variable text, which is then passed to the IBM Watson Tone Analyzer API tweet = lastTwentyTweets() tweets = [] for i in range(len(tweet)): tweets.append(tweet[i]['text']) text = "" for i in range(len(tweets)): text += " " text += tweets[i] just_watch = JustWatch(country='US') resultsMovies = [] resultsTV = [] mood = tone_analyzer.tone(text, content_type="text/plain") max_mood = mood.get('document_tone').get('tones')[0].get('tone_name') selected = request.form.getlist('check') # following if statement checks that the user picks at least one provider when requesting a suggestion if len(selected) == 0: return render_template('index.html', tweets=tweet, noneCheck=True) genre = moodDict[max_mood] # Here we implement our caching, before requesting movies / tvshows of the appropriate genre and correct provider # from the JustWatch API, the following code checks our SQL database to see if the relevant movies / tvshows are # already being present in the Database, if so the suggestion is made from this data cachedMovies = searchCachedMovies(selected, genre) cachedShows = searchCachedShows(selected, genre) if cachedMovies != (): if cachedShows != (): # to allow for some variation in the recommended movie / show a random index is used chosenMovie = cachedMovies[randint(0, len(cachedMovies) - 1)] chosenShow = cachedShows[randint(0, len(cachedShows) - 1)] return render_template('suggest.html', cachedMovie=chosenMovie, cachedShow=chosenShow, mood=max_mood, tweets=text) # below occurs if no relevant info found within the Database, the following code retrieves relevant movies and # tv shows depending on what providers the user selected, all of the results are stored within our database # using the storeMovie and storeShow helper function, additionally the linkMovieProvider and linkShowProvider # helper functions are used to ensure that the movies / tvshows are linked to the correct provider # (this is done to ensure DB accuracy) else: for i in range(len(selected)): # for loop goes through all the selected providers and retrieves / stores relevant data from them, # each if statement checks which provider the current index represents and then passes the relevent data # for retrieval and storage if selected[i] == 'Netflix': results_by_multiplea = just_watch.search_for_item( providers=['nfx'], genres=[genre], content_types=['movie']) movies = results_by_multiplea['items'] for x in range(len(movies)): storeMovie(movies[x]['title'], movies[x]['short_description'], genre) linkMovieProvider(movies[x]['title'], 'Netflix') resultsMovies.append(movies[x]) results_by_multiplef = just_watch.search_for_item( providers=['nfx'], genres=[genre], content_types=['show']) tv = results_by_multiplef['items'] for x in range(len(tv)): storeShow(tv[x]['title'], tv[x]['short_description'], genre) linkShowProvider(tv[x]['title'], 'Netflix') resultsTV.append(tv[x]) if selected[i] == 'Playstation Video': results_by_multipleb = just_watch.search_for_item( providers=['pls'], content_types=['movie'], genres=[genre]) movies = results_by_multipleb['items'] for x in range(len(movies)): storeMovie(movies[x]['title'], movies[x]['short_description'], genre) linkMovieProvider(movies[x]['title'], 'Playstation Video') resultsMovies.append(movies[x]) results_by_multiplef = just_watch.search_for_item( providers=['pls'], genres=[genre], content_types=['show']) tv = results_by_multiplef['items'] for x in range(len(tv)): storeShow(tv[x]['title'], tv[x]['short_description'], genre) linkShowProvider(tv[x]['title'], 'Playstation Video') resultsTV.append(tv[x]) if selected[i] == 'Itunes': results_by_multiplec = just_watch.search_for_item( providers=['itu'], content_types=['movie'], genres=[genre]) movies = results_by_multiplec['items'] for x in range(len(movies)): storeMovie(movies[x]['title'], movies[x]['short_description'], genre) linkMovieProvider(movies[x]['title'], 'Itunes') resultsMovies.append(movies[x]) results_by_multiplef = just_watch.search_for_item( providers=['itu'], genres=[genre], content_types=['show']) tv = results_by_multiplef['items'] for x in range(len(tv)): storeShow(tv[x]['title'], tv[x]['short_description'], genre) linkShowProvider(tv[x]['title'], 'Itunes') resultsTV.append(tv[x]) if selected[i] == 'Google Play': results_by_multipled = just_watch.search_for_item( providers=['ply'], content_types=['movie'], genres=[genre]) movies = results_by_multipled['items'] for x in range(len(movies)): storeMovie(movies[x]['title'], movies[x]['short_description'], genre) linkMovieProvider(movies[x]['title'], 'Google Play') resultsMovies.append(movies[x]) results_by_multiplef = just_watch.search_for_item( providers=['ply'], genres=[genre], content_types=['show']) tv = results_by_multiplef['items'] for x in range(len(tv)): storeShow(tv[x]['title'], tv[x]['short_description'], genre) linkShowProvider(tv[x]['title'], 'Google Play') resultsTV.append(tv[x]) # generate the movie / tvshow recommendation from all the data retrieved using a random index # this allows for some variation in the recommended result chosenMovie = resultsMovies[randint(0, len(resultsMovies) - 1)] chosenShow = resultsTV[randint(0, len(resultsTV) - 1)] results = [chosenMovie, chosenShow] return render_template('suggest.html', selected=results, mood=max_mood, tweets=text)
def result(): moodDict = { "Joy": 'act', "Sadness": 'cmy', "Anger": 'trl', "Fear": 'fnt', "Analytical": 'doc', "Confident": 'hrr', "Tentative": 'rma' } tweet = lastTenTweets() tweets = [] for i in range(len(tweet)): tweets.append(tweet[i]['text']) text = "" for i in range(len(tweets)): text += " " text += tweets[i] just_watch = JustWatch(country='US') resultsMovies = [] resultsTV = [] mood = tone_analyzer.tone(text, content_type="text/plain") max_mood = mood.get('document_tone').get('tones')[0].get('tone_name') selected = request.form.getlist('check') genre = moodDict[max_mood] for i in range(len(selected)): if selected[i] == 'Netflix': results_by_multiplea = just_watch.search_for_item( providers=['nfx'], genres=[genre], content_types=['movie']) movies = results_by_multiplea['items'] for x in range(len(movies)): resultsMovies.append(movies[x]) results_by_multiplef = just_watch.search_for_item( providers=['nfx'], genres=[genre], content_types=['show']) tv = results_by_multiplef['items'] for x in range(len(tv)): resultsTV.append(tv[x]) if selected[i] == 'Playstation Video': results_by_multipleb = just_watch.search_for_item( providers=['pls'], content_types=['movie'], genres=[genre]) movies = results_by_multipleb['items'] for x in range(len(movies)): resultsMovies.append(movies[x]) results_by_multiplef = just_watch.search_for_item( providers=['pls'], genres=[genre], content_types=['show']) tv = results_by_multiplef['items'] for x in range(len(tv)): resultsTV.append(tv[x]) if selected[i] == 'Itunes': results_by_multiplec = just_watch.search_for_item( providers=['itu'], content_types=['movie'], genres=[genre]) movies = results_by_multiplec['items'] for x in range(len(movies)): resultsMovies.append(movies[x]) results_by_multiplef = just_watch.search_for_item( providers=['itu'], genres=[genre], content_types=['show']) tv = results_by_multiplef['items'] for x in range(len(tv)): resultsTV.append(tv[x]) if selected[i] == 'Google Play': results_by_multipled = just_watch.search_for_item( providers=['ply'], content_types=['movie'], genres=[genre]) movies = results_by_multipled['items'] for x in range(len(movies)): resultsMovies.append(movies[x]) results_by_multiplef = just_watch.search_for_item( providers=['ply'], genres=[genre], content_types=['show']) tv = results_by_multiplef['items'] for x in range(len(tv)): resultsTV.append(tv[x]) results = [ resultsMovies[randint(0, len(resultsMovies) - 1)], resultsTV[randint(0, len(resultsTV) - 1)] ] return render_template('suggest.html', selected=results, mood=max_mood, tweets=text)
LAUNCH_MESSAGE = "What films would you like to know more about?" HELP_MESSAGE = "You can ask me a question about a film, or you can say exit ... What can I help you with?" HELP_REPROMPT = "What can I help you with?" STOP_MESSAGE = "Goodbye!" FALLBACK_MESSAGE = "I cannot help with that. Movie Helper is able to answer any film-related questions you may have. What can I help you with?" FALLBACK_REPROMPT = 'What can I help you with?' MOVIE_DESCRIPTION_ERROR_MESSAGE = "I'm sorry I cannot find the description of this movie" MOVIE_RELEASE_YEAR_ERROR_MESSAGE = "I'm sorry I cannot find the release year of this movie" MOVIE_PROVIDER_ERROR_MESSAGE = "I'm sorry I cannot find the providers of this movie" MOVIE_RUNTIME_ERROR_MESSAGE = "I'm sorry I cannot find the runtime of this movie" NETFLIX_PROVIDER_ID = 8 AMAZON_PROVIDER_ID = 9 just_watch = JustWatch(country='GB') # --------------- App entry point ----------------- def lambda_handler(event, context): """ App entry point """ #print(event) if event['session']['new']: on_session_started() if event['request']['type'] == "LaunchRequest": return on_launch(event['request']) elif event['request']['type'] == "IntentRequest":
, 'title' : [] , 'rating' : [] , 'netflix_rating' : [] , 'genres' : [] , 'netflix_instant' : [] , 'streams' : [] , 'year' : [] , 'runtime' : [] , 'overview' : [] , 'tagline' : [] , 'jw_id' : [] , 'rt_score' : [] }) ## JustWatch genre list jw = JustWatch(country = "US") full_genres = jw.get_genres() ## accept new movies keepgoing = False add_movies = input("\nDo you want to add movies to the database? [y or n] ") if add_movies == 'y': keepgoing = True while keepgoing: netflix_id = None ## no dependence on netflix IDs anymore netflix_rating = None ## not using netflix as rating basis anymore new_title = input("\nWhat is the name of the movie to add? ") new_id = tryFloat(input("What is the MovieLens ID of the movie? "), get = True) ## check if the movie is already in the DB if new_id != '' and len(movies_db[(movies_db.movielens_id == new_id)]): print('This movie seems to already exist in the DB. Skipping...')
def test_get_title(self): the_matrix_title_id = '10' just_watch = JustWatch() titles = just_watch.get_title(the_matrix_title_id) self.assertIsNotNone(titles) self.assertGreater(len(titles), 0)
def getProviderName(provider_id): just_watch = JustWatch(country='ES') provider_details = just_watch.get_providers() for provider in provider_details: if provider['id'] == provider_id: return provider['clear_name']
def test_search_title_id(self): just_watch = JustWatch() title_ids = just_watch.search_title_id(query='the matrix') self.assertIn('The Matrix', title_ids.keys())
def test_get_providers(self): just_watch = JustWatch(country='US') prov = just_watch.get_providers() self.assertIsNotNone(prov)
#!/usr/bin/env python3 from justwatch import JustWatch from flask import Flask, request, jsonify from os import environ from discord_interactions import verify_key_decorator, InteractionType, InteractionResponseType from discord import Embed jw = JustWatch(country="AU") providers = {p["id"]: p for p in jw.get_providers()} app = Flask(__name__) PUBKEY = environ["JWBOT_PUBKEY"] @app.route("/", methods=["POST"]) @verify_key_decorator(PUBKEY) def route(): if not "type" in request.json: return jsonify({}) if request.json["type"] == InteractionType.PING: return jsonify({"type": InteractionResponseType.PONG}) elif request.json["type"] == InteractionType.APPLICATION_COMMAND: if request.json["data"]["name"] == "watch": kwargs = { d["name"]: d["value"] for d in request.json["data"]["options"] } filtered_count = 0 embeds = [] for count, embed in watch(**kwargs):
from justwatch import JustWatch just_watch = JustWatch(country='US') results = just_watch.search_for_item(query='the matrix') just_watch = JustWatch(genres=['act', 'scf', 'hrr']) results_by_genres = just_watch.search_for_item() just_watch = JustWatch() results_by_providers = just_watch.search_for_item(providers=['nfx', 'stn']) """ This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit. The Intent Schema, Custom Slots, and Sample Utterances for this skill, as well as testing instructions are located at http://amzn.to/1LzFrj6 For additional samples, visit the Alexa Skills Kit Getting Started guide at http://amzn.to/1LGWsLG """ from __future__ import print_function # --------------- Helpers that build all of the responses ---------------------- def build_speechlet_response(title, output, reprompt_text, should_end_session): return {
def test_get_genres(self): just_watch = JustWatch(country='US') genres = just_watch.get_genres() self.assertIsNotNone(genres) self.assertGreater(len(genres), 2)