commit 078ed59c2cb52176a4de18f2aa91f44f7cda87f0 Author: Phyks (Lucas Verney) Date: Mon Feb 26 20:48:57 2018 +0100 Initial commit diff --git a/.db.py.swp b/.db.py.swp new file mode 100644 index 0000000..3434ac2 Binary files /dev/null and b/.db.py.swp differ diff --git a/db.py b/db.py new file mode 100644 index 0000000..ccc17a5 --- /dev/null +++ b/db.py @@ -0,0 +1,12 @@ +from peewee import * + +db = SqliteDatabase('people.db') + + +class Person(Model): + name = CharField() + birthday = DateField() + is_relative = BooleanField() + + class Meta: + database = db diff --git a/main.py b/main.py new file mode 100644 index 0000000..adb7c35 --- /dev/null +++ b/main.py @@ -0,0 +1,33 @@ +from __future__ import absolute_import, print_function, unicode_literals +import json +import sys + +from weboob.core.ouiboube import WebNip +from weboob.tools.json import WeboobEncoder + +BACKENDS = ['750g', 'allrecipes', 'cuisineaz', 'marmiton', 'supertoinette'] + + +def __main__(url, modules_path=None): + webnip = WebNip(modules_path=modules_path) + + backends = [ + webnip.load_backend( + module, + module, + params={} + ) + for module in BACKENDS + ] + + for backend in backends: + browser = backend.browser + if url.startswith(browser.BASEURL): + browser.location(url) + recipe = browser.page.get_recipe() + print(json.dumps(recipe, cls=WeboobEncoder)) + break + + +if __name__ == "__main__": + __main__(sys.argv[1])