diff --git a/README.md b/README.md index ad7b151..78fc16e 100644 --- a/README.md +++ b/README.md @@ -7,18 +7,10 @@ localizations. Relies on data from [Justwatch.com](https://www.justwatch.com/). -## Installation - -``` -pip install -r requirements.txt -``` - ## Usage -``` -python3 main.py -``` +Just serve `index.html` with a webserver with [CORS headers enabled](https://developer.mozilla.org/fr/docs/Web/HTTP/CORS). ## License diff --git a/index.html b/index.html new file mode 100644 index 0000000..a08d63c --- /dev/null +++ b/index.html @@ -0,0 +1,146 @@ + + + + + Multiwatch + + + + + +
+

Multiwatch

+

Back

+ +

{{ error }}

+ +
+

Search

+ +
+

+ + +

+

+ +

+
+
+
+ +
+
+

{{ availableLocales[locale] }}

+ +

None

+
+
+
+
+ + + diff --git a/main.py b/main.py deleted file mode 100644 index f7eebcc..0000000 --- a/main.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python3 -import logging -import sys - -import requests - -from urllib.parse import urlencode - -logging.basicConfig(level=logging.WARNING) - -LOCALES = { - 'fr_FR': 'France', - 'en_AU': 'Australia', - 'en_CA': 'Canada', - 'de_DE': 'Germany', - 'pl_PL': 'Poland', - 'en_SG': 'Singapore', - 'en_UK': 'United Kingdom', -} - -query = input('Movie/Show title? ') - -req = requests.get( - 'https://apis.justwatch.com/content/titles/fr_FR/popular', - params={ - 'language': 'fr', - 'body': '{"page_size":5,"page":1,"query":"%s","content_types":["show","movie"]}' % query - } -) -logging.info(req.url) - -i = 0 -list = [] - -if not 'items' in req.json() or not req.json()['items']: - print('NOT FOUND') - sys.exit() - -for item in req.json()['items']: - list.append((item['object_type'], item['id'])) - print('%s. %s - %s' % ( - i, item['title'], - 'https://images.justwatch.com%s' % ( - item['poster'].replace(r'{profile}', 's276') - ) - )) - i += 1 - -print() -title_nb = None -while title_nb not in range(len(list)): - title_nb = input('Choice? ') - try: - title_nb = int(title_nb) - except ValueError: - pass -print() - -print('Available from these flatrate services:') -for locale, locale_name in LOCALES.items(): - print('> %s:' % locale_name) - url = ( - 'https://apis.justwatch.com/content/titles/%s/%s/locale/%s?language=fr' - % (list[title_nb][0], list[title_nb][1], locale) - ) - logging.info(url) - req = requests.get(url) - offers = {} - if not req.json().get('offers', []): - print(' None') - print() - continue - - for offer in req.json().get('offers', []): - if offer['monetization_type'] != 'flatrate': - continue - offers[offer['urls']['standard_web']] = {} - - for url, offer in offers.items(): - print(' * %s' % url) - print() diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index f229360..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -requests