+++ /dev/null
-;;; org-chef-24kitchen.el --- org-chef 24kitchen fetching. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2019 Calvin Beck, Folkert van der Beek
-
-;; Author: Folkert van der Beek <folkertvanderbeekNOSPAMgmail.com>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2019
-
-;; Copyright 2019 Folkert van der Beek
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from 24kitchen.nl.
-
-;;; Code:
-
-(require 'org-chef-utils)
-(require 'dom)
-
-(defun org-chef-24kitchen-extract-name (dom)
- "Get the name of a recipe from an 24kitchen DOM."
- (dom-text (dom-children (dom-by-class dom "^page-title$"))))
-
-(defun org-chef-24kitchen-extract-ingredients (dom)
- "Get the ingredients for a recipe from an 24kitchen DOM."
- (org-chef-remove-empty-strings (mapcar #'(lambda (node) (string-trim (replace-regexp-in-string "[[:space:]\n]+" " " (dom-texts node)))) (dom-by-class dom "^recipe-component$"))))
-
-(defun org-chef-24kitchen-extract-servings (dom)
- "Get the number of servings for a recipe from an 24kitchen DOM."
- (string-trim (dom-text (dom-by-class dom "^portion-amount$"))))
-
-(defun org-chef-24kitchen-extract-cook-time (dom)
- "Get the amount of cook-time for a recipe from an 24kitchen DOM."
- (string-trim (dom-text (dom-by-class dom "^cooking-time$"))))
-
-(defun org-chef-24kitchen-extract-ready-in (dom)
- "Get the total amount of time for a recipe from an 24kitchen DOM."
- (string-trim (dom-text (dom-by-class dom "^total-time$"))))
-
-(defun org-chef-24kitchen-extract-directions (dom)
- "Get the directions for a recipe from an 24kitchen DOM."
- (org-chef-remove-empty-strings (mapcar #'(lambda (node) (string-trim (dom-text node))) (dom-children (cdr (dom-by-class dom "^recipe-body$"))))))
-
-(defun org-chef-24kitchen-fetch (url)
- "Given an 24kitchen.nl URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
-
- `((name . ,(org-chef-24kitchen-extract-name dom))
- (ingredients . ,(org-chef-24kitchen-extract-ingredients dom))
- (servings . ,(org-chef-24kitchen-extract-servings dom))
- (prep-time . "")
- (cook-time . ,(org-chef-24kitchen-extract-cook-time dom))
- (ready-in . ,(org-chef-24kitchen-extract-ready-in dom))
- (directions . ,(org-chef-24kitchen-extract-directions dom))
- (source-url . ,url)))))
-
-(provide 'org-chef-24kitchen)
-;;; org-chef-24kitchen.el ends here
+++ /dev/null
-;;; org-chef-all-recipes.el --- org-chef allrecipes fetching. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from allrecipes.com.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-all-recipes-extract-name (dom)
- "Get the name of a recipe from an allrecipes DOM."
- (dom-text (car (dom-by-class dom "^recipe-summary__h1$"))))
-
-
-(defun org-chef-all-recipes-extract-ingredients (dom)
- "Get the ingredients for a recipe from an allrecipes DOM."
- (mapcar #'(lambda (n) (string-trim (dom-text n))) (dom-elements dom 'itemprop "^recipeIngredient$")))
-
-
-(defun org-chef-all-recipes-extract-servings (dom)
- "Get the number of servings for a recipe from an allrecipes DOM."
- (dom-attr (car (dom-by-id dom "metaRecipeServings")) 'content))
-
-
-(defun org-chef-all-recipes-extract-prep-time (dom)
- "Get the amount of prep-time for a recipe from an allrecipes DOM."
- (dom-texts (car (dom-elements dom 'itemprop "^prepTime$"))))
-
-
-(defun org-chef-all-recipes-extract-cook-time (dom)
- "Get the amount of cook-time for a recipe from an allrecipes DOM."
- (dom-texts (car (dom-elements dom 'itemprop "^cookTime$"))))
-
-
-(defun org-chef-all-recipes-extract-ready-in (dom)
- "Get the total amount of time for a recipe from an allrecipes DOM."
- (dom-texts (car (dom-elements dom 'itemprop "^totalTime$"))))
-
-
-(defun org-chef-all-recipes-extract-directions (dom)
- "Get the directions for a recipe from an allrecipes DOM."
- (org-chef-remove-empty-strings (mapcar #'(lambda (n) (string-trim (dom-text n))) (dom-by-class dom "^recipe-directions__list--item$"))))
-
-
-(defun org-chef-all-recipes-fetch (url)
- "Given an allrecipes.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
-
- `((name . ,(org-chef-all-recipes-extract-name dom))
- (ingredients . ,(org-chef-all-recipes-extract-ingredients dom))
- (servings . ,(org-chef-all-recipes-extract-servings dom))
- (prep-time . ,(org-chef-all-recipes-extract-prep-time dom))
- (cook-time . ,(org-chef-all-recipes-extract-cook-time dom))
- (ready-in . ,(org-chef-all-recipes-extract-ready-in dom))
- (directions . ,(org-chef-all-recipes-extract-directions dom))
- (source-url . ,url)))))
-
-
-(provide 'org-chef-all-recipes)
-;;; org-chef-all-recipes.el ends here
+++ /dev/null
-;;; org-chef-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-\f
-;;;### (autoloads nil "org-chef" "org-chef.el" (23994 46439 580564
-;;;;;; 163000))
-;;; Generated autoloads from org-chef.el
-
-(autoload 'org-chef-insert-recipe "org-chef" "\
-Prompt for a recipe URL, and then insert the recipe at point.
-
-\(fn URL)" t nil)
-
-;;;***
-\f
-;;;### (autoloads nil nil ("org-chef-24kitchen.el" "org-chef-all-recipes.el"
-;;;;;; "org-chef-chef-koch.el" "org-chef-cultures-for-health.el"
-;;;;;; "org-chef-fine-cooking.el" "org-chef-genius-kitchen.el" "org-chef-marmiton.el"
-;;;;;; "org-chef-martha-stewart.el" "org-chef-nytimes.el" "org-chef-pkg.el"
-;;;;;; "org-chef-reluctant-gourmet.el" "org-chef-saveur.el" "org-chef-serious-eats.el"
-;;;;;; "org-chef-simply-recipes.el" "org-chef-steamy-kitchen.el"
-;;;;;; "org-chef-taste.el" "org-chef-utils.el" "org-chef-wordpress.el"
-;;;;;; "org-chef-xiachufang.el") (23994 46439 598811 226000))
-
-;;;***
-\f
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; org-chef-autoloads.el ends here
+++ /dev/null
-;;; org-chef-chef-koch.el --- Functions for fetching recipes from chefkoch.de. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from chefkoch.de.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-chef-koch-extract-name (dom)
- "Get the name of a recipe from a chefkoch DOM."
- (dom-text (dom-by-tag (dom-by-class dom "recipe-header") 'h1)))
-
-
-(defun org-chef-chef-koch-ingredient-to-string (dom)
- (let ((amount (replace-regexp-in-string "[ \\t\\n\\r]+" " " (string-trim (dom-texts (car (dom-by-tag dom 'td))))))
- (name (string-trim (dom-texts (cadr (dom-by-tag dom 'td))))))
- (format "%s %s" amount name)))
-
-
-(defun org-chef-chef-koch-extract-ingredients (dom)
- "Get the ingredients for a recipe from a chefkoch DOM."
- (mapcar #'org-chef-chef-koch-ingredient-to-string (dom-by-tag (dom-by-class dom "ingredients") 'tr)))
-
-
-(defun org-chef-chef-koch-extract-servings (dom)
- "Get the number of servings for a recipe from a chefkoch DOM."
- (dom-attr (dom-elements dom 'name "^portionen$") 'value))
-
-
-(defun org-chef-chef-koch-extract-prep-time (dom)
- "Get the amount of prep-time for a recipe from a chefkoch DOM."
- (let ((str (replace-regexp-in-string "\n" " " (dom-texts (dom-by-id dom "^preparation-info$")))))
- (string-match "Arbeitszeit:[[:space:]]+ca. \\(?1:[^\.]*\\)\." str)
- (match-string 1 str)))
-
-
-(defun org-chef-chef-koch-extract-cook-time (dom)
- "Get the amount of cook-time for a recipe from a chefkoch DOM."
- (let ((str (replace-regexp-in-string "\n" " " (dom-texts (dom-by-id dom "^preparation-info$")))))
- (string-match "Koch-/Backzeit:[[:space:]]+ca. \\(?1:[^\.]*\\)\." str)
- (match-string 1 str)))
-
-
-(defun org-chef-chef-koch-extract-ready-in (dom)
- "Get the total amount of time for a recipe from a chefkoch DOM."
- "")
-
-
-(defun org-chef-chef-koch-extract-directions (dom)
- "Get the directions for a recipe from a chefkoch DOM."
- (with-temp-buffer
- (insert (string-trim (dom-text (car (dom-by-tag (nth 3 (dom-by-tag dom 'article)) 'div)))))
- (delete-trailing-whitespace)
- (split-string (buffer-string) "\n")))
-
-
-(defun org-chef-chef-koch-from-dom (dom)
- "Given a chefkoch.de DOM, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions"
- (let* ((prep-time (org-chef-chef-koch-extract-prep-time dom))
- (cook-time (org-chef-chef-koch-extract-cook-time dom))
- (total-time (org-chef-chef-koch-extract-ready-in dom)))
-
- `((ingredients . ,(org-chef-chef-koch-extract-ingredients dom))
- (name . ,(org-chef-chef-koch-extract-name dom))
- (servings . ,(org-chef-chef-koch-extract-servings dom))
- (prep-time . ,prep-time)
- (cook-time . ,cook-time)
- (ready-in . ,total-time)
- (directions . ,(org-chef-chef-koch-extract-directions dom)))))
-
-
-(defun org-chef-chef-koch-fetch (url)
- "Given a chefkoch.de URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
- (cons `(source-url . ,url) (org-chef-chef-koch-from-dom dom)))))
-
-
-(provide 'org-chef-chef-koch)
-;;; org-chef-chef-koch.el ends here
+++ /dev/null
-;;; org-chef-cultures-for-health.el --- Functions for fetching recipes from culturesforhealth.com. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbes@ualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from culturesforhealth.com.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-cultures-for-health-extract-name (dom)
- "Get the name of a recipe from an culturesforhealth DOM."
- (dom-text (car (dom-elements dom 'itemprop "^name$"))))
-
-
-(defun org-chef-cultures-for-health-extract-ingredients (dom)
- "Get the ingredients for a recipe from an culturesforhealth DOM."
- (mapcar 'dom-texts (dom-elements dom 'itemprop "^ingredients$")))
-
-
-(defun org-chef-cultures-for-health-extract-directions (dom)
- "Get the directions for a recipe from an culturesforhealth DOM."
- (mapcar #'dom-texts (org-chef-dom-children (cadr (org-chef-dom-children (car (dom-elements dom 'itemprop "^recipeInstructions$")))))))
-
-
-(defun org-chef-cultures-for-health-from-dom (dom)
- "Given a culturesforhealth.com DOM, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions"
- `((ingredients . ,(org-chef-cultures-for-health-extract-ingredients dom))
- (name . ,(org-chef-cultures-for-health-extract-name dom)
- )
- (servings . nil)
- (prep-time . nil)
- (cook-time . nil)
- (ready-in . nil)
- (directions . ,(org-chef-cultures-for-health-extract-directions dom))))
-
-
-(defun org-chef-cultures-for-health-fetch (url)
- "Given a culturesforhealth.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
- (cons `(source-url . ,url) (org-chef-cultures-for-health-from-dom dom)))))
-
-
-(provide 'org-chef-cultures-for-health)
-;;; org-chef-cultures-for-health.el ends here
+++ /dev/null
-;;; org-chef-fine-cooking.el --- Functions for fetching recipes from finecooking.com. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2019 Calvin Beck, Erik Hetzner
-
-;; Author: Erik Hetzner <eghNOSPAMe6h.org>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2019
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from finecooking.com.
-
-;;; Code:
-
-(require 'org-chef-utils)
-(require 'dom)
-
-(defun org-chef-fine-cooking-extract-name (dom)
- "Get the name of a recipe from an finecooking DOM."
- (dom-text (dom-by-class dom "^recipe__title")))
-
-(defun org-chef-fine-cooking-extract-ingredients (dom)
- "Get the ingredients for a recipe from an finecooking DOM."
- (mapcar #'(lambda (n) (string-trim (dom-texts n)))
- (org-chef-dom-children (dom-child-by-tag (dom-by-class dom "^recipe__ingredients$") 'ul))))
-
-(defun org-chef-fine-cooking-extract-servings (dom)
- "Get the number of servings for a recipe from an finecooking DOM."
- (dom-text (dom-child-by-tag (dom-by-class dom "^recipe__yield$") 'p)))
-
-(defun org-chef-fine-cooking-extract-directions (dom)
- "Get the directions for a recipe from an finecooking DOM."
- (mapcar #'(lambda (n) (string-trim (dom-texts n)))
- (org-chef-dom-children (dom-child-by-tag (dom-by-class dom "^recipe__preparation$") 'ul))))
-
-(defun org-chef-fine-cooking-fetch (url)
- "Given a finecooking.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
- `((name . ,(org-chef-fine-cooking-extract-name dom))
- (ingredients . ,(org-chef-fine-cooking-extract-ingredients dom))
- (servings . ,(org-chef-fine-cooking-extract-servings dom))
- (prep-time . nil)
- (cook-time . nil)
- (ready-in . nil)
- (directions . ,(org-chef-fine-cooking-extract-directions dom))
- (source-url . ,url)))))
-
-(provide 'org-chef-fine-cooking)
-;;; org-chef-fine-cooking.el ends here
+++ /dev/null
-;;; org-chef-genius-kitchen.el --- Functions for fetching recipes from geniuskitchen.com. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from geniuskitchen.com.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-genius-kitchen-extract-name (dom)
- "Get the name of a recipe from an geniuskitchen DOM."
- (dom-texts (dom-by-class dom "^recipe-title$")))
-
-
-(defun org-chef-genius-kitchen-extract-ingredients (dom)
- "Get the ingredients for a recipe from an geniuskitchen DOM."
- (mapcar #'dom-texts (dom-by-class dom "^recipe-ingredients__ingredient$")))
-
-
-(defun org-chef-genius-kitchen-extract-servings (dom)
- "Get the number of servings for a recipe from an geniuskitchen DOM."
- (dom-texts (dom-by-class (car (dom-by-class dom "recipe-facts__yield")) "theme-color")))
-
-
-(defun org-chef-genius-kitchen-extract-ready-in (dom)
- "Get the total amount of time for a recipe from an geniuskitchen DOM."
- (dom-texts (cddddr (car (dom-by-class dom "recipe-facts__time")))))
-
-
-(defun org-chef-genius-kitchen-extract-directions (dom)
- "Get the directions for a recipe from an geniuskitchen DOM."
- (let ((directions-list (dom-by-tag (car (dom-by-class dom "recipe-directions__step")) 'li)))
- (org-chef-remove-empty-strings
- (mapcar #'(lambda (n) (string-trim (dom-text n))) directions-list))))
-
-
-(defun org-chef-genius-kitchen-fetch (url)
- "Given a geniuskitchen.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
- `((name . ,(org-chef-genius-kitchen-extract-name dom))
- (ingredients . ,(org-chef-genius-kitchen-extract-ingredients dom))
- (servings . ,(org-chef-genius-kitchen-extract-servings dom))
- (prep-time . nil)
- (cook-time . nil)
- (ready-in . ,(org-chef-genius-kitchen-extract-ready-in dom))
- (directions . ,(org-chef-genius-kitchen-extract-directions dom))
- (source-url . ,url)))))
-
-
-(provide 'org-chef-genius-kitchen)
-;;; org-chef-genius-kitchen.el ends here
+++ /dev/null
-;;; org-chef-marmiton.el --- Functions for fetching recipes from marmiton.org. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck/Sébastien Le Maguer
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>/Sébastien Le Maguer <seb.lemaguerNOSPAMgmail.com>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck/Sébastien Le Maguer
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from marmiton.org.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-marmiton-sanitize (str)
- "Sanitize the STR by removing beginning/trailing spaces extracted from a marmiton dom."
- (replace-regexp-in-string "^[ \r\n]*\\(.*[^ \r\n]\\)[ \r\n]*$" "\\1" str))
-
-(defun org-chef-marmiton-extract-dom-text (dom)
- "Embedded the operation santize of dom-text from a marmiton DOM."
- (org-chef-marmiton-sanitize (dom-texts dom)))
-
-(defun org-chef-marmiton-extract-name (dom)
- "Get the name of a recipe from a marmiton DOM."
- (dom-text (car (dom-elements dom 'class "^main-title $"))))
-
-(defun org-chef-marmiton-extract-current-ingredient (dom)
- "Extract element for the current ingredient from a marmiton DOM."
- (concat
- (org-chef-marmiton-extract-dom-text (dom-elements dom 'class "^recipe-ingredient-qt$"))
- " "
- (org-chef-marmiton-extract-dom-text (dom-elements dom 'class "^ingredient$"))))
-
-(defun org-chef-marmiton-extract-ingredients (dom)
- "Get the ingredients for a recipe from a marmiton DOM."
- (mapcar 'org-chef-marmiton-extract-current-ingredient (dom-elements dom 'class "^recipe-ingredients__list__item$")))
-
-(defun org-chef-marmiton-extract-directions (dom)
- "Get the directions for a recipe from a marmiton DOM."
-
- (mapcar (lambda (x) (org-chef-marmiton-extract-dom-text (cddr x)))
- (dom-elements dom 'class "^recipe-preparation__list__item$")))
-
-(defun org-chef-marmiton-extract-prep-time (dom)
- "Get the preparation time for a recipe from a marmiton DOM."
- (org-chef-marmiton-extract-dom-text
- (dom-elements (dom-elements dom 'class "recipe-infos__timmings__preparation")
- 'class "^recipe-infos__timmings__value$")))
-
-(defun org-chef-marmiton-extract-cook-time (dom)
- "Extract the cooking time for a recipe from a marmiton DOM."
- (org-chef-marmiton-extract-dom-text
- (dom-elements (dom-elements dom 'class "recipe-infos__timmings__cooking")
- 'class "^recipe-infos__timmings__value$")))
-
-
-(defun org-chef-marmiton-extract-servings (dom)
- (dom-text (car (dom-elements dom 'class "^title-2 recipe-infos__quantity__value$"))))
-
-
-
-(defun org-chef-marmiton-from-dom (dom)
- "Given a marmiton.org DOM, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions"
- `((ingredients . ,(org-chef-marmiton-extract-ingredients dom))
- (name . ,(org-chef-marmiton-extract-name dom))
- (servings . ,(org-chef-marmiton-extract-servings dom))
- (prep-time . ,(org-chef-marmiton-extract-prep-time dom))
- (cook-time . ,(org-chef-marmiton-extract-cook-time dom))
- (ready-in . nil)
- (directions . ,(org-chef-marmiton-extract-directions dom))))
-
-
-(defun org-chef-marmiton-fetch (url)
- "Given a marmiton.org URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
- (cons `(source-url . ,url) (org-chef-marmiton-from-dom dom)))))
-
-(provide 'org-chef-marmiton)
-;;; org-chef-marmiton.el ends here
+++ /dev/null
-;;; org-chef-martha-stewart.el --- org-chef marthastewart fetching. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from marthastewart.com.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-martha-stewart-extract-name (dom)
- "Get the name of a recipe from an marthastewart DOM."
- (string-trim (dom-text (car (dom-by-class dom "^page-title$")))))
-
-
-(defun org-chef-martha-stewart-extract-ingredients (dom)
- "Get the ingredients for a recipe from an marthastewart DOM."
- (mapcar #'(lambda (n) (string-trim (dom-text n)))
- (dom-by-class dom "^component-text$")))
-
-
-(defun org-chef-martha-stewart-extract-servings (dom)
- "Get the number of servings for a recipe from an marthastewart DOM."
- (string-trim (dom-text (car (dom-by-class dom "servings-data$")))))
-
-
-(defun org-chef-martha-stewart-extract-prep-time (dom)
- "Get the amount of prep-time for a recipe from an marthastewart DOM."
- (string-trim (dom-text (car (dom-by-class dom "prep-time-data$")))))
-
-
-(defun org-chef-martha-stewart-extract-cook-time (dom)
- "Get the amount of cook-time for a recipe from an marthastewart DOM."
- nil)
-
-
-(defun org-chef-martha-stewart-extract-ready-in (dom)
- "Get the total amount of time for a recipe from an marthastewart DOM."
- (string-trim (dom-text (car (dom-by-class dom "total-time-data$")))))
-
-
-(defun org-chef-martha-stewart-extract-directions (dom)
- "Get the directions for a recipe from an marthastewart DOM."
- (mapcar #'(lambda (n) (string-trim (dom-texts (dom-children n))))
- (dom-by-class dom "^directions-item-text$")))
-
-
-(defun org-chef-martha-stewart-fetch (url)
- "Given an marthastewart.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
-
- `((name . ,(org-chef-martha-stewart-extract-name dom))
- (ingredients . ,(org-chef-martha-stewart-extract-ingredients dom))
- (servings . ,(org-chef-martha-stewart-extract-servings dom))
- (prep-time . ,(org-chef-martha-stewart-extract-prep-time dom))
- (cook-time . ,(org-chef-martha-stewart-extract-cook-time dom))
- (ready-in . ,(org-chef-martha-stewart-extract-ready-in dom))
- (directions . ,(org-chef-martha-stewart-extract-directions dom))
- (source-url . ,url)))))
-
-
-(provide 'org-chef-martha-stewart)
-;;; org-chef-martha-stewart.el ends here
+++ /dev/null
-;;; org-chef-nytimes.el --- Functions for fetching recipes from nytimes.com. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck/Asilata Bapat
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>/Asilata Bapat <asilataNOSPAMalum.mit.edu>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck/Asilata Bapat
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from nytimes.com.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-nytimes-extract-name (dom)
- "Get the name of a recipe from an nytimes DOM."
- (string-trim (dom-text (car (dom-by-class dom "recipe-title")))))
-
-
-(defun org-chef-nytimes-ingredient-to-string (dom)
- "Extract string representation of a single ingredient from an nytimes DOM."
- (replace-regexp-in-string
- " \\([,\.]\\)" "\\1"
- (string-join (org-chef-remove-empty-strings (mapcar 'string-trim (dom-strings dom))) " ")))
-
-(defun org-chef-nytimes-extract-ingredients (dom)
- "Get the ingredients for a recipe from an nytimes DOM."
- (mapcar 'org-chef-nytimes-ingredient-to-string
- (dom-elements dom 'itemprop "recipeIngredient")))
-
-
-(defun org-chef-nytimes-extract-servings (dom)
- "Get the number of servings for a recipe from an nytimes DOM."
- (replace-regexp-in-string " servings" "" (dom-text (car (dom-elements dom 'itemprop "recipeYield")))))
-
-
-(defun org-chef-nytimes-extract-prep-time (dom)
- "Get the amount of prep-time for a recipe from an nytimes DOM."
- "")
-
-
-(defun org-chef-nytimes-extract-cook-time (dom)
- "Get the amount of cook-time for a recipe from an nytimes DOM."
- "")
-
-
-(defun org-chef-nytimes-extract-ready-in (dom)
- "Get the total amount of time for a recipe from an nytimes DOM."
- (dom-texts (dom-by-class (cadr (dom-by-tag (dom-by-class dom "recipe-time-yield") 'li)) "recipe-yield-value")))
-
-
-(defun org-chef-nytimes-extract-directions (dom)
- "Get the directions for a recipe from an nytimes DOM."
- (mapcar 'dom-texts (dom-by-tag (dom-elements dom 'itemprop "recipeInstructions") 'li)))
-
-
-(defun org-chef-nytimes-from-dom (dom)
- "Given an nytimes.com DOM, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions"
- (let* ((prep-time (org-chef-nytimes-extract-prep-time dom))
- (cook-time (org-chef-nytimes-extract-cook-time dom))
- (total-time (org-chef-nytimes-extract-ready-in dom)))
-
- `((ingredients . ,(org-chef-nytimes-extract-ingredients dom))
- (name . ,(org-chef-nytimes-extract-name dom))
- (servings . ,(org-chef-nytimes-extract-servings dom))
- (prep-time . ,prep-time)
- (cook-time . ,cook-time)
- (ready-in . ,total-time)
- (directions . ,(org-chef-nytimes-extract-directions dom)))))
-
-
-(defun org-chef-nytimes-fetch (url)
- "Given an nytimes.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
- (cons `(source-url . ,url) (org-chef-nytimes-from-dom dom)))))
-
-
-(provide 'org-chef-nytimes)
-;;; org-chef-nytimes.el ends here
+++ /dev/null
-(define-package "org-chef" "20191017.2015" "Cookbook and recipe management with org-mode."
- '((org "0")
- (emacs "24"))
- :keywords
- '("convenience" "abbrev" "outlines" "org" "food" "recipes" "cooking")
- :authors
- '(("Calvin Beck" . "hobbesNOSPAMualberta.ca"))
- :maintainer
- '("Calvin Beck" . "hobbesNOSPAMualberta.ca")
- :url "https://github.com/Chobbes/org-chef")
-;; Local Variables:
-;; no-byte-compile: t
-;; End:
+++ /dev/null
-;;; org-chef-reluctant-gourmet.el --- Functions for fetching recipes from reluctantgourmet.com. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from reluctantgourmet.com.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-reluctant-gourmet-extract-name (dom)
- "Get the name of a recipe from an reluctantgourmet DOM."
- (dom-text (car (dom-by-id dom "zlrecipe-title"))))
-
-
-(defun org-chef-reluctant-gourmet-extract-ingredients (dom)
- "Get the ingredients for a recipe from an reluctantgourmet DOM."
- (mapcar #'(lambda (n) (string-trim (dom-text n))) (dom-by-class dom "^ingredient$")))
-
-
-(defun org-chef-reluctant-gourmet-extract-servings (dom)
- "Get the number of servings for a recipe from an reluctantgourmet DOM."
- (dom-texts (car (dom-elements dom 'itemprop "^recipeYield$"))))
-
-
-(defun org-chef-reluctant-gourmet-extract-prep-time (dom)
- "Get the amount of prep-time for a recipe from an reluctantgourmet DOM."
- (dom-texts (car (dom-elements dom 'itemprop "^prepTime$"))))
-
-
-(defun org-chef-reluctant-gourmet-extract-cook-time (dom)
- "Get the amount of cook-time for a recipe from an reluctantgourmet DOM."
- (dom-texts (car (dom-elements dom 'itemprop "^cookTime$"))))
-
-
-(defun org-chef-reluctant-gourmet-extract-ready-in (dom)
- "Get the total amount of time for a recipe from an reluctantgourmet DOM."
- (dom-texts (car (dom-elements dom 'itemprop "^totalTime$"))))
-
-
-(defun org-chef-reluctant-gourmet-extract-directions (dom)
- "Get the directions for a recipe from an reluctantgourmet DOM."
- (mapcar #'dom-text (seq-filter (lambda (x) (not (stringp x)))
- (dom-elements dom 'itemprop "^recipeInstructions$"))))
-
-
-(defun org-chef-reluctant-gourmet-from-dom (dom)
- "Given a reluctantgourmet.com DOM, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions"
- (let* ((prep-time (org-chef-reluctant-gourmet-extract-prep-time dom))
- (cook-time (org-chef-reluctant-gourmet-extract-cook-time dom))
- (total-time (org-chef-reluctant-gourmet-extract-ready-in dom)))
-
- `((ingredients . ,(org-chef-reluctant-gourmet-extract-ingredients dom))
- (name . ,(org-chef-reluctant-gourmet-extract-name dom))
- (servings . ,(org-chef-reluctant-gourmet-extract-servings dom))
- (prep-time . ,prep-time)
- (cook-time . ,cook-time)
- (ready-in . ,total-time)
- (directions . ,(org-chef-reluctant-gourmet-extract-directions dom)))))
-
-
-(defun org-chef-reluctant-gourmet-fetch (url)
- "Given a reluctantgourmet.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
- (cons `(source-url . ,url) (org-chef-reluctant-gourmet-from-dom dom)))))
-
-
-(provide 'org-chef-reluctant-gourmet)
-;;; org-chef-reluctant-gourmet.el ends here
+++ /dev/null
-;;; org-chef-saveur.el --- Functions for fetching recipes from saveur.com. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck/Derek Ellis
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>/Derek Ellis <derek.ellisNOSPAMgmail.com>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck/Derek Ellis
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from saveur.com.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
- (defun org-chef-saveur-chomp (str)
- "Chomp leading and tailing whitespace from STR."
- (replace-regexp-in-string (rx (or (: bos (* (any " \t\n")))
- (: (* (any " \t\n")) eos)))
- ""
- str))
-
-
-(defun org-chef-saveur-extract-name (dom)
- "Get the name of a recipe from an saveur DOM."
- (string-trim (dom-text (car (dom-by-class dom "page-title")))))
-
-
-(defun org-chef-saveur-extract-ingredients (dom)
- "Get the ingredients for a recipe from an saveur DOM."
- (remove ""
- (mapcar 'org-chef-saveur-chomp
- (split-string
- (replace-regexp-in-string " ⁄ " "/"
- (string-join (mapcar #'dom-texts (dom-by-class dom "^ingredients$")))) "\n" ))))
-
-
-(defun org-chef-saveur-extract-servings (dom)
- "Get the number of servings for a recipe from an saveur DOM."
- (replace-regexp-in-string "serves " ""
- (dom-text (dom-by-tag (dom-by-class dom "yield") 'span))))
-
-
-(defun org-chef-saveur-extract-prep-time (dom)
- "Get the amount of prep-time for a recipe from an saveur DOM."
- (org-chef-saveur-chomp
- (dom-text (dom-by-class dom "^prep-time$"))))
-
-
-(defun org-chef-saveur-extract-cook-time (dom)
- "Get the amount of cook-time for a recipe from an saveur DOM."
- (org-chef-saveur-chomp
- (dom-text (dom-by-class dom "^cook-time$"))))
-
-
-(defun org-chef-saveur-extract-ready-in (dom)
- "Get the total amount of time for a recipe from an saveur DOM."
- (string-trim (dom-texts (dom-by-class (cadr (dom-by-tag (dom-by-class dom "recipe-time-yield") 'li)) "recipe-yield-value"))))
-
-
-(defun org-chef-saveur-extract-directions (dom)
- "Get the directions for a recipe from an saveur DOM."
- (remove ""
- (mapcar 'org-chef-saveur-chomp
- (split-string
- (replace-regexp-in-string " ⁄ " "/"
- (dom-texts
- (dom-by-class dom "^instructions "))) "\n \n " ))))
-
-(defun org-chef-saveur-from-dom (dom)
- "Given an saveur.com DOM, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions"
- (let* ((prep-time (org-chef-saveur-extract-prep-time dom))
- (cook-time (org-chef-saveur-extract-cook-time dom))
- (total-time (org-chef-saveur-extract-ready-in dom)))
-
- `((ingredients . ,(org-chef-saveur-extract-ingredients dom))
- (name . ,(org-chef-saveur-extract-name dom))
- (servings . ,(org-chef-saveur-extract-servings dom))
- (prep-time . ,prep-time)
- (cook-time . ,cook-time)
- (ready-in . ,total-time)
- (directions . ,(org-chef-saveur-extract-directions dom)))))
-
-
-(defun org-chef-saveur-fetch (url)
- "Given an saveur.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
- (cons `(source-url . ,url) (org-chef-saveur-from-dom dom)))))
-
-
-(provide 'org-chef-saveur)
-;;; org-chef-saveur.el ends here
+++ /dev/null
-;;; org-chef-serious-eats.el --- org-chef seriouseats fetching. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from seriouseats.com.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-serious-eats-extract-name (dom)
- "Get the name of a recipe from an seriouseats DOM."
- (dom-text (car (dom-elements dom 'class "recipe-title"))))
-
-
-(defun org-chef-serious-eats-extract-ingredients (dom)
- "Get the ingredients for a recipe from an seriouseats DOM."
- (mapcar 'dom-texts (dom-elements dom 'class "^ingredient$")))
-
-
-(defun org-chef-serious-eats-extract-servings (dom)
- "Get the number of servings for a recipe from an seriouseats DOM."
- (dom-text (car (dom-elements dom 'itemprop "^recipeYield$"))))
-
-
-(defun org-chef-serious-eats-extract-prep-time (dom)
- "Get the amount of prep-time for a recipe from an seriouseats DOM."
- (dom-text (car (dom-by-class
- (cadr
- (org-chef-dom-children
- (car (dom-by-class dom "^recipe-about$"))))
- "info"))))
-
-
-(defun org-chef-serious-eats-extract-cook-time (dom)
- "Get the amount of cook-time for a recipe from an seriouseats DOM."
- nil)
-
-
-(defun org-chef-serious-eats-extract-ready-in (dom)
- "Get the total amount of time for a recipe from an seriouseats DOM."
- (dom-text (car (dom-by-class
- (caddr
- (org-chef-dom-children
- (car (dom-by-class dom "^recipe-about$"))))
- "info"))))
-
-
-(defun org-chef-serious-eats-extract-directions (dom)
- "Get the directions for a recipe from an seriouseats DOM."
- (mapcar #'(lambda (n) (string-trim (dom-texts (dom-children n))))
- (dom-by-class dom "^recipe-procedure-text$")))
-
-
-(defun org-chef-serious-eats-fetch (url)
- "Given an seriouseats.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
-
- `((name . ,(org-chef-serious-eats-extract-name dom))
- (ingredients . ,(org-chef-serious-eats-extract-ingredients dom))
- (servings . ,(org-chef-serious-eats-extract-servings dom))
- (prep-time . ,(org-chef-serious-eats-extract-prep-time dom))
- (cook-time . ,(org-chef-serious-eats-extract-cook-time dom))
- (ready-in . ,(org-chef-serious-eats-extract-ready-in dom))
- (directions . ,(org-chef-serious-eats-extract-directions dom))
- (source-url . ,url)))))
-
-(provide 'org-chef-serious-eats)
-;;; org-chef-serious-eats.el ends here
+++ /dev/null
-;;; org-chef-simply-recipes.el --- Functions for fetching recipes from simplyrecipes.com. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from simplyrecipes.com.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-simply-recipes-extract-name (dom)
- "Get the name of a recipe from an simplyrecipes DOM."
- (dom-text (car (dom-by-class dom "entry-title"))))
-
-
-(defun org-chef-simply-recipes-extract-ingredients (dom)
- "Get the ingredients for a recipe from an simplyrecipes DOM."
- (mapcar 'dom-text (dom-by-class dom "^ingredient$")))
-
-
-(defun org-chef-simply-recipes-extract-servings (dom)
- "Get the number of servings for a recipe from an simplyrecipes DOM."
- (let ((servings (dom-text (car (dom-by-class dom "^yield*")))))
- (when servings
- (substring servings 7))))
-
-
-(defun org-chef-simply-recipes-extract-prep-time (dom)
- "Get the amount of prep-time for a recipe from an simplyrecipes DOM."
- (dom-text (car (dom-by-class dom "preptime"))))
-
-
-(defun org-chef-simply-recipes-extract-cook-time (dom)
- "Get the amount of cook-time for a recipe from an simplyrecipes DOM."
- (let ((cook-time (dom-by-class dom "cooktime"))
- (other-time (dom-by-class dom "othertime")))
- (dom-text (car (if (null cook-time) other-time cook-time)))))
-
-
-(defun org-chef-simply-recipes-extract-directions (dom)
- "Get the directions for a recipe from an simplyrecipes DOM."
- (mapcar #'dom-text (seq-filter (lambda (x) (not (stringp x)))
- (dom-children (car (dom-elements dom 'itemprop "^recipeInstructions$"))))))
-
-
-(defun org-chef-simply-recipes-from-dom (dom)
- "Given a simplyrecipes.com DOM, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions"
- (let* ((prep-time (org-chef-simply-recipes-extract-prep-time dom))
- (cook-time (org-chef-simply-recipes-extract-cook-time dom)))
-
- `((ingredients . ,(org-chef-simply-recipes-extract-ingredients dom))
- (name . ,(org-chef-simply-recipes-extract-name dom)
- )
- (servings . ,(org-chef-simply-recipes-extract-servings dom))
- (prep-time . ,prep-time)
- (cook-time . ,cook-time)
- (ready-in . nil)
- (directions . ,(org-chef-simply-recipes-extract-directions dom)))))
-
-
-(defun org-chef-simply-recipes-fetch (url)
- "Given a simplyrecipes.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
- (cons `(source-url . ,url) (org-chef-simply-recipes-from-dom dom)))))
-
-
-(provide 'org-chef-simply-recipes)
-;;; org-chef-simply-recipes.el ends here
+++ /dev/null
-;;; org-chef-steamy-kitchen.el --- org-chef steamykitchen fetching. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from steamykitchen.com.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-steamy-kitchen-extract-name (dom)
- "Get the name of a recipe from an steamykitchen DOM."
- (dom-text (car (dom-elements dom 'itemprop "^name$"))))
-
-
-(defun org-chef-steamy-kitchen-extract-ingredients (dom)
- "Get the ingredients for a recipe from an steamykitchen DOM."
- (mapcar 'dom-texts (dom-elements dom 'itemprop "^ingredients$")))
-
-
-(defun org-chef-steamy-kitchen-extract-servings (dom)
- "Get the number of servings for a recipe from an steamykitchen DOM."
- (dom-text (car (dom-elements dom 'itemprop "^recipeYield$"))))
-
-
-(defun org-chef-steamy-kitchen-extract-prep-time (dom)
- "Get the amount of prep-time for a recipe from an steamykitchen DOM."
- (dom-text (dom-parent dom (car (dom-elements dom 'itemprop "^prepTime$")))))
-
-
-(defun org-chef-steamy-kitchen-extract-cook-time (dom)
- "Get the amount of cook-time for a recipe from an steamykitchen DOM."
- (dom-text (dom-parent dom (car (dom-elements dom 'itemprop "^cookTime$")))))
-
-
-(defun org-chef-steamy-kitchen-extract-ready-in (dom)
- "Get the total amount of time for a recipe from an steamykitchen DOM."
- nil)
-
-
-(defun org-chef-steamy-kitchen-extract-directions (dom)
- "Get the directions for a recipe from an steamykitchen DOM."
- (mapcar #'(lambda (n) (string-trim (dom-texts n)))
- (org-chef-dom-children (car (dom-by-class dom "^instructions$")))))
-
-
-(defun org-chef-steamy-kitchen-fetch (url)
- "Given an steamykitchen.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
-
- `((name . ,(org-chef-steamy-kitchen-extract-name dom))
- (ingredients . ,(org-chef-steamy-kitchen-extract-ingredients dom))
- (servings . ,(org-chef-steamy-kitchen-extract-servings dom))
- (prep-time . ,(org-chef-steamy-kitchen-extract-prep-time dom))
- (cook-time . ,(org-chef-steamy-kitchen-extract-cook-time dom))
- (ready-in . ,(org-chef-steamy-kitchen-extract-ready-in dom))
- (directions . ,(org-chef-steamy-kitchen-extract-directions dom))
- (source-url . ,url)))))
-
-
-(provide 'org-chef-steamy-kitchen)
-;;; org-chef-steamy-kitchen.el ends here
+++ /dev/null
-;;; org-chef-taste.el --- org-chef taste.com.au fetching -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2019 Calvin Beck, Peter Hardy
-
-;; Author: Peter Hardy <peterNOSPAMhardy.dropbear.id.au>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2019
-
-;; Copyright 2019 Peter Hardy
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from taste.com.au.
-
-;;; Code:
-
-(require 'org-chef-utils)
-(require 'cl-seq)
-(require 'dom)
-
-(defun org-chef-taste-extract-cooking-infos (dom info)
- "Get INFO from recipe-cooking-infos in a taste.com.au DOM."
- (let ((i (cl-position info (mapcar #'(lambda (n) (string-trim (dom-text n))) (dom-by-tag (dom-by-class dom "^recipe-cooking-infos$") 'li)) :test 'equal)))
- (if i
- (dom-text (nth i (dom-by-tag (dom-by-class dom "^recipe-cooking-infos$") 'b)))
- "")))
-
-(defun org-chef-taste-extract-name (dom)
- "Get the name of a recipe from a taste.com.au DOM."
- (dom-text (dom-by-tag dom 'h1)))
-
-(defun org-chef-taste-extract-ingredients (dom)
- "Get the ingredients for a recipe from a taste.com.au DOM."
- (mapcar #'(lambda (n) (string-trim (dom-texts n)))
- (dom-by-class dom "^ingredient-description$")))
-
-(defun org-chef-taste-extract-servings (dom)
- "Get the servings for a recipe from a taste.com.au DOM."
- (let ((servings (org-chef-taste-extract-cooking-infos dom "Servings")))
- (if (string-equal servings "")
- (org-chef-taste-extract-cooking-infos dom "Makes")
- servings)))
-
-(defun org-chef-taste-extract-prep-time (dom)
- "Get the prep time for a recipe from a taste.com.au DOM."
- (org-chef-taste-extract-cooking-infos dom "Prep"))
-
-(defun org-chef-taste-extract-cook-time (dom)
- "Get the prep time for a recipe from a taste.com.au DOM."
- (org-chef-taste-extract-cooking-infos dom "Cook"))
-
-(defun org-chef-taste-extract-directions (dom)
- "Get the directions for a recipe from a taste.com.au DOM."
- (mapcar #'(lambda (n) (string-trim (dom-texts n)))
- (dom-by-class dom "^recipe-method-step-content$")))
-
-(defun org-chef-taste-fetch (url)
- "Given a taste.com.au URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
-
- `((name . ,(org-chef-taste-extract-name dom))
- (ingredients . ,(org-chef-taste-extract-ingredients dom))
- (servings . ,(org-chef-taste-extract-servings dom))
- (prep-time . ,(org-chef-taste-extract-prep-time dom))
- (cook-time . ,(org-chef-taste-extract-cook-time dom))
- (ready-in . "")
- (directions . ,(org-chef-taste-extract-directions dom))
- (source-url . ,url)))))
-
-(provide 'org-chef-taste)
-;;; org-chef-taste.el ends here
+++ /dev/null
-;;; org-chef-utils.el --- Utilities for org-chef. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Utility functions for org-chef.
-
-;;; Code:
-
-(require 'cl-macs)
-
-(defun org-chef-remove-empty-strings (lst)
- "Filter out any empty strings in a list of strings (LST)."
- (seq-filter (lambda (x) (/= (length x) 0)) lst))
-
-
-(defun org-chef-dom-children (dom)
- "Get the child nodes of the DOM, remove strings."
- (seq-filter (lambda (x) (not (stringp x)))
- (dom-children dom)))
-
-
-(defun org-chef-insert-org-list (lst &optional bullet)
- "Insert LST as an ‘org-mode’ plain list.
-
-The optional argument BULLET specifies which type of bullet point
-should be used."
- (mapcar (lambda (x) (progn (insert (format "%s " (string-trim x)))
- (org-cycle)
- (org-delete-backward-char 1)
- (org-ctrl-c-minus)
- (if bullet (org-cycle-list-bullet bullet))
- (org-return)))
- lst))
-
-
-(defun org-chef-url-retrieve-synchronously (url)
- "Fetch URL using url-retrieve-synchronously.
-
-This is a wrapper for url-retrieve-synchronously, which primarily serves to implement workarounds."
-
- (let ((gnutls-algorithm-priority
- (if org-chef-fetch-workaround
- "NORMAL:-VERS-TLS1.3"
- gnutls-algorithm-priority)))
-
- (url-retrieve-synchronously url)))
-
-
-(provide 'org-chef-utils)
-;;; org-chef-utils.el ends here
+++ /dev/null
-;;; org-chef-wordpress.el --- org-chef wordpress fetching. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from wordpress sites.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-
-(defun org-chef-wordpress-extract-name (dom)
- "Get the name of a recipe from an wordpress DOM."
- (dom-text (car (dom-by-class dom "^wprm-recipe-name"))))
-
-
-(defun org-chef-wordpress-extract-ingredients (dom)
- "Get the ingredients for a recipe from an wordpress DOM."
- (mapcar #'(lambda (n) (string-trim (dom-texts n))) (dom-by-class dom "^wprm-recipe-ingredient$")))
-
-
-(defun org-chef-wordpress-extract-servings (dom)
- "Get the number of servings for a recipe from an wordpress DOM."
- (dom-texts (car (dom-by-class dom "wprm-recipe-servings$"))))
-
-
-(defun org-chef-wordpress-extract-prep-time (dom)
- "Get the amount of prep-time for a recipe from an wordpress DOM."
- (dom-texts (car (dom-by-class dom "^wprm-recipe-time$"))))
-
-
-(defun org-chef-wordpress-extract-cook-time (dom)
- "Get the amount of cook-time for a recipe from an wordpress DOM."
- (dom-texts (cadr (dom-by-class dom "^wprm-recipe-time$"))))
-
-
-(defun org-chef-wordpress-extract-ready-in (dom)
- "Get the total amount of time for a recipe from an wordpress DOM."
- (dom-texts (caddr (dom-by-class dom "^wprm-recipe-time$"))))
-
-
-(defun org-chef-wordpress-extract-directions (dom)
- "Get the directions for a recipe from an wordpress DOM."
- (org-chef-remove-empty-strings (mapcar #'(lambda (n) (string-trim (dom-texts n))) (dom-by-class dom "^wprm-recipe-instruction$"))))
-
-
-(defun org-chef-is-wordpress-p (dom)
- "Check if a DOM corresponds to a wordpress website."
- (dom-by-class dom "^wprm-recipe-container$"))
-
-
-(defun org-chef-wordpress-fetch (url)
- "Given an wordpress URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url
-
-If this is not a wordpress site, then return nil."
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
-
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
- (if (org-chef-is-wordpress-p dom)
- `((name . ,(org-chef-wordpress-extract-name dom))
- (ingredients . ,(org-chef-wordpress-extract-ingredients dom))
- (servings . ,(org-chef-wordpress-extract-servings dom))
- (prep-time . ,(org-chef-wordpress-extract-prep-time dom))
- (cook-time . ,(org-chef-wordpress-extract-cook-time dom))
- (ready-in . ,(org-chef-wordpress-extract-ready-in dom))
- (directions . ,(org-chef-wordpress-extract-directions dom))
- (source-url . ,url))
- nil))))
-
-
-(provide 'org-chef-wordpress)
-;;; org-chef-wordpress.el ends here
+++ /dev/null
-;;; org-chef-xiachufang.el --- Functions for fetching recipes from xiachufang.com. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck/Sébastien Le Maguer
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>/Sébastien Le Maguer <seb.lemaguerNOSPAMgmail.com>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-
-;; Copyright 2019 Yiu Fung Cheong
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; Functions for fetching information from xiachufang.com.
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'dom)
-
-(defun org-chef-xiachufang-sanitize (str)
- "Sanitize the STR by removing beginning/trailing spaces extracted from a marmiton dom."
- (replace-regexp-in-string "^[ \r\n]*\\(.*[^ \r\n]\\)[ \r\n]*$" "\\1" str))
-
-(defun org-chef-xiachufang-extract-name (dom)
- "Get the name of a recipe from a xiachufang DOM."
- (org-chef-xiachufang-sanitize (dom-text (car (dom-elements dom 'class "^page-title$")))))
-
-
-(defun org-chef-xiachufang-extract-ingredients (dom)
- "Get the ingredients for a recipe from a xiachufang DOM."
- (mapcar #'(lambda (n)
- (replace-regexp-in-string "\n" " " (org-chef-xiachufang-sanitize (dom-texts n))))
- (dom-elements dom 'itemprop "^recipeIngredient$")))
-
-
-(defun org-chef-xiachufang-extract-directions (dom)
- "Get the directions for a recipe from a xiachufang DOM."
- (mapcar #'(lambda (n)
- (replace-regexp-in-string "\n" " " (org-chef-xiachufang-sanitize (dom-texts n))))
- (dom-elements dom 'itemprop "^recipeInstructions$")))
-
-
-(defun org-chef-xiachufang-extract-prep-time (dom)
- "Get the preparation time for a recipe from a xiachufang DOM."
- "")
-
-
-(defun org-chef-xiachufang-extract-cook-time (dom)
- "Extract the cooking time for a recipe from a xiachufang DOM."
- "")
-
-
-(defun org-chef-xiachufang-extract-servings (dom)
- "")
-
-
-(defun org-chef-xiachufang-from-dom (dom)
- "Given a xiachufang.com DOM, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions"
- `((ingredients . ,(org-chef-xiachufang-extract-ingredients dom))
- (name . ,(org-chef-xiachufang-extract-name dom))
- (servings . ,(org-chef-xiachufang-extract-servings dom))
- (prep-time . ,(org-chef-xiachufang-extract-prep-time dom))
- (cook-time . ,(org-chef-xiachufang-extract-cook-time dom))
- (ready-in . nil)
- (directions . ,(org-chef-xiachufang-extract-directions dom))))
-
-
-(defun org-chef-xiachufang-fetch (url)
- "Given a xiachufang.com URL, retrieve the recipe information.
-
-This returns an alist with the following keys:
-
-- name
-- ingredients
-- servings
-- prep-time
-- cook-time
-- ready-in
-- directions
-- source-url"
- (with-current-buffer (org-chef-url-retrieve-synchronously url)
- (let ((dom (libxml-parse-html-region (point-min) (point-max))))
- (cons `(source-url . ,url) (org-chef-xiachufang-from-dom dom)))))
-
-
-(provide 'org-chef-xiachufang)
-;;; org-chef-xiachufang.el ends here
+++ /dev/null
-;;; org-chef.el --- Cookbook and recipe management with org-mode. -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2018 Calvin Beck
-
-;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
-;; URL: https://github.com/Chobbes/org-chef
-;; Created: 2018
-;; Version: 0.1.3
-;; Keywords: convenience, abbrev, outlines, org, food, recipes, cooking
-;; Package-Requires: ((org "0") (emacs "24"))
-
-;; Copyright 2018 Calvin Beck
-
-;; Permission is hereby granted, free of charge, to any person
-;; obtaining a copy of this software and associated documentation
-;; files (the "Software"), to deal in the Software without
-;; restriction, including without limitation the rights to use, copy,
-;; modify, merge, publish, distribute, sublicense, and/or sell copies
-;; of the Software, and to permit persons to whom the Software is
-;; furnished to do so, subject to the following conditions:
-
-;; The above copyright notice and this permission notice shall be
-;; included in all copies or substantial portions of the Software.
-
-;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-;; SOFTWARE.
-
-;;; Commentary:
-
-;; org-chef is a package for managing recipes in org-mode. One of the
-;; main features is that it can automatically extract recipes from
-;; websites like allrecipes.com
-
-;;; Code:
-
-
-(require 'org-chef-utils)
-(require 'org-chef-24kitchen)
-(require 'org-chef-all-recipes)
-(require 'org-chef-genius-kitchen)
-(require 'org-chef-simply-recipes)
-(require 'org-chef-martha-stewart)
-(require 'org-chef-cultures-for-health)
-(require 'org-chef-marmiton)
-(require 'org-chef-serious-eats)
-(require 'org-chef-reluctant-gourmet)
-(require 'org-chef-chef-koch)
-(require 'org-chef-steamy-kitchen)
-(require 'org-chef-nytimes)
-(require 'org-chef-saveur)
-(require 'org-chef-xiachufang)
-(require 'org-chef-wordpress)
-(require 'org-chef-taste)
-
-
-(defvar org-chef-fetch-workaround
- (and
- ;; Note: For build sans gnutls, `libgnutls-version' is -1.
- (>= libgnutls-version 30603)
- (version<= emacs-version "26.2")
- 't)
- "Inspired by https://github.com/magit/ghub/blob/7d59937d7782d0062216130a4d059b45e8396f82/ghub.el#L452
-
-See https://github.com/magit/ghub/issues/81 and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341
-for more information.")
-
-(defun org-chef-recipe-insert-org (recipe)
- "Insert a RECIPE as an ‘org-mode’ heading."
- (org-insert-heading)
- (insert (cdr (assoc 'name recipe)))
- (org-return)
- (org-set-property "source-url" (cdr (assoc 'source-url recipe)))
- (org-set-property "servings" (cdr (assoc 'servings recipe)))
- (org-set-property "prep-time" (format "%s" (cdr (assoc 'prep-time recipe))))
- (org-set-property "cook-time" (format "%s" (cdr (assoc 'cook-time recipe))))
- (org-set-property "ready-in" (format "%s" (cdr (assoc 'ready-in recipe))))
- (org-insert-subheading t)
- (insert "Ingredients")
- (org-return)
- (org-return)
- (org-chef-insert-org-list (cdr (assoc 'ingredients recipe)))
- (org-return)
- (org-return)
- (org-insert-heading)
- (insert "Directions")
- (org-return)
- (org-return)
- (org-chef-insert-org-list (cdr (assoc 'directions recipe)) "1."))
-
-
-(defun org-chef-recipe-org-string (recipe)
- "Get an ‘org-mode’ heading string for a RECIPE."
- (with-temp-buffer (org-mode)
- (org-chef-recipe-insert-org recipe)
- (buffer-string)))
-
-
-(defun org-chef-match-url (BASE URL)
- "Match URL against a BASE url."
- (not (null (string-match-p (regexp-quote BASE) URL))))
-
-
-(defun org-chef-fetch-recipe-specific-url (URL)
- "Look up a recipe based on a specific URL."
- (cond
- ((org-chef-match-url "24kitchen.nl" URL) (org-chef-24kitchen-fetch URL))
- ((org-chef-match-url "allrecipes.com" URL) (org-chef-all-recipes-fetch URL))
- ((org-chef-match-url "geniuskitchen.com" URL) (org-chef-genius-kitchen-fetch URL))
- ((org-chef-match-url "simplyrecipes.com" URL) (org-chef-simply-recipes-fetch URL))
- ((org-chef-match-url "marthastewart.com" URL) (org-chef-martha-stewart-fetch URL))
- ((org-chef-match-url "culturesforhealth.com" URL) (org-chef-cultures-for-health-fetch URL))
- ((org-chef-match-url "marmiton.org" URL) (org-chef-marmiton-fetch URL))
- ((org-chef-match-url "seriouseats.com" URL) (org-chef-serious-eats-fetch URL))
- ((org-chef-match-url "reluctantgourmet.com" URL) (org-chef-reluctant-gourmet-fetch URL))
- ((org-chef-match-url "chefkoch.de" URL) (org-chef-chef-koch-fetch URL))
- ((org-chef-match-url "steamykitchen.com" URL) (org-chef-steamy-kitchen-fetch URL))
- ((org-chef-match-url "nytimes.com" URL) (org-chef-nytimes-fetch URL))
- ((org-chef-match-url "saveur.com" URL) (org-chef-saveur-fetch URL))
- ((org-chef-match-url "xiachufang.com" URL) (org-chef-xiachufang-fetch URL))
- ((org-chef-match-url "finecooking.com" URL) (org-chef-fine-cooking-fetch URL))
- ((org-chef-match-url "taste.com.au" URL) (org-chef-taste-fetch URL))
- (t nil)))
-
-
-(defun org-chef-fetch-recipe (URL)
- "Look up a recipe at a URL."
- (let ((fetched-recipe (org-chef-fetch-recipe-specific-url URL)))
- (if fetched-recipe
- fetched-recipe
- (org-chef-wordpress-fetch URL))))
-
-
-;;;###autoload
-(defun org-chef-insert-recipe (URL)
- "Prompt for a recipe URL, and then insert the recipe at point."
- (interactive "sRecipe URL: ")
- (org-chef-recipe-insert-org (org-chef-fetch-recipe URL)))
-
-
-(defun org-chef-get-recipe-from-url ()
- "Prompt for a recipe URL, and return the ‘org-mode’ string."
- (let ((URL (read-string "Recipe URL: ")))
- (org-chef-recipe-org-string (org-chef-fetch-recipe URL))))
-
-
-(provide 'org-chef)
-;;; org-chef.el ends here
--- /dev/null
+;;; org-chef-24kitchen.el --- org-chef 24kitchen fetching. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Calvin Beck, Folkert van der Beek
+
+;; Author: Folkert van der Beek <folkertvanderbeekNOSPAMgmail.com>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2019
+
+;; Copyright 2019 Folkert van der Beek
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from 24kitchen.nl.
+
+;;; Code:
+
+(require 'org-chef-utils)
+(require 'dom)
+
+(defun org-chef-24kitchen-extract-name (dom)
+ "Get the name of a recipe from an 24kitchen DOM."
+ (dom-text (dom-children (dom-by-class dom "^page-title$"))))
+
+(defun org-chef-24kitchen-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an 24kitchen DOM."
+ (org-chef-remove-empty-strings (mapcar #'(lambda (node) (string-trim (replace-regexp-in-string "[[:space:]\n]+" " " (dom-texts node)))) (dom-by-class dom "^recipe-component$"))))
+
+(defun org-chef-24kitchen-extract-servings (dom)
+ "Get the number of servings for a recipe from an 24kitchen DOM."
+ (string-trim (dom-text (dom-by-class dom "^portion-amount$"))))
+
+(defun org-chef-24kitchen-extract-cook-time (dom)
+ "Get the amount of cook-time for a recipe from an 24kitchen DOM."
+ (string-trim (dom-text (dom-by-class dom "^cooking-time$"))))
+
+(defun org-chef-24kitchen-extract-ready-in (dom)
+ "Get the total amount of time for a recipe from an 24kitchen DOM."
+ (string-trim (dom-text (dom-by-class dom "^total-time$"))))
+
+(defun org-chef-24kitchen-extract-directions (dom)
+ "Get the directions for a recipe from an 24kitchen DOM."
+ (org-chef-remove-empty-strings (mapcar #'(lambda (node) (string-trim (dom-text node))) (dom-children (cdr (dom-by-class dom "^recipe-body$"))))))
+
+(defun org-chef-24kitchen-fetch (url)
+ "Given an 24kitchen.nl URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+
+ `((name . ,(org-chef-24kitchen-extract-name dom))
+ (ingredients . ,(org-chef-24kitchen-extract-ingredients dom))
+ (servings . ,(org-chef-24kitchen-extract-servings dom))
+ (prep-time . "")
+ (cook-time . ,(org-chef-24kitchen-extract-cook-time dom))
+ (ready-in . ,(org-chef-24kitchen-extract-ready-in dom))
+ (directions . ,(org-chef-24kitchen-extract-directions dom))
+ (source-url . ,url)))))
+
+(provide 'org-chef-24kitchen)
+;;; org-chef-24kitchen.el ends here
--- /dev/null
+;;; org-chef-all-recipes.el --- org-chef allrecipes fetching. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from allrecipes.com.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-all-recipes-extract-name (dom)
+ "Get the name of a recipe from an allrecipes DOM."
+ (dom-text (car (dom-by-class dom "^recipe-summary__h1$"))))
+
+
+(defun org-chef-all-recipes-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an allrecipes DOM."
+ (mapcar #'(lambda (n) (string-trim (dom-text n))) (dom-elements dom 'itemprop "^recipeIngredient$")))
+
+
+(defun org-chef-all-recipes-extract-servings (dom)
+ "Get the number of servings for a recipe from an allrecipes DOM."
+ (dom-attr (car (dom-by-id dom "metaRecipeServings")) 'content))
+
+
+(defun org-chef-all-recipes-extract-prep-time (dom)
+ "Get the amount of prep-time for a recipe from an allrecipes DOM."
+ (dom-texts (car (dom-elements dom 'itemprop "^prepTime$"))))
+
+
+(defun org-chef-all-recipes-extract-cook-time (dom)
+ "Get the amount of cook-time for a recipe from an allrecipes DOM."
+ (dom-texts (car (dom-elements dom 'itemprop "^cookTime$"))))
+
+
+(defun org-chef-all-recipes-extract-ready-in (dom)
+ "Get the total amount of time for a recipe from an allrecipes DOM."
+ (dom-texts (car (dom-elements dom 'itemprop "^totalTime$"))))
+
+
+(defun org-chef-all-recipes-extract-directions (dom)
+ "Get the directions for a recipe from an allrecipes DOM."
+ (org-chef-remove-empty-strings (mapcar #'(lambda (n) (string-trim (dom-text n))) (dom-by-class dom "^recipe-directions__list--item$"))))
+
+
+(defun org-chef-all-recipes-fetch (url)
+ "Given an allrecipes.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+
+ `((name . ,(org-chef-all-recipes-extract-name dom))
+ (ingredients . ,(org-chef-all-recipes-extract-ingredients dom))
+ (servings . ,(org-chef-all-recipes-extract-servings dom))
+ (prep-time . ,(org-chef-all-recipes-extract-prep-time dom))
+ (cook-time . ,(org-chef-all-recipes-extract-cook-time dom))
+ (ready-in . ,(org-chef-all-recipes-extract-ready-in dom))
+ (directions . ,(org-chef-all-recipes-extract-directions dom))
+ (source-url . ,url)))))
+
+
+(provide 'org-chef-all-recipes)
+;;; org-chef-all-recipes.el ends here
--- /dev/null
+;;; org-chef-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+
+(add-to-list 'load-path (directory-file-name
+ (or (file-name-directory #$) (car load-path))))
+
+\f
+;;;### (autoloads nil "org-chef" "org-chef.el" (0 0 0 0))
+;;; Generated autoloads from org-chef.el
+
+(autoload 'org-chef-insert-recipe "org-chef" "\
+Prompt for a recipe URL, and then insert the recipe at point.
+
+\(fn URL)" t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef" '("org-chef-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-24kitchen" "org-chef-24kitchen.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-24kitchen.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-24kitchen" '("org-chef-24kitchen-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-all-recipes" "org-chef-all-recipes.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-all-recipes.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-all-recipes" '("org-chef-all-recipes-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-chef-koch" "org-chef-chef-koch.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-chef-koch.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-chef-koch" '("org-chef-chef-koch-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-cultures-for-health" "org-chef-cultures-for-health.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-cultures-for-health.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-cultures-for-health" '("org-chef-cultures-for-health-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-fine-cooking" "org-chef-fine-cooking.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-fine-cooking.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-fine-cooking" '("org-chef-fine-cooking-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-genius-kitchen" "org-chef-genius-kitchen.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-genius-kitchen.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-genius-kitchen" '("org-chef-genius-kitchen-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-marmiton" "org-chef-marmiton.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-marmiton.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-marmiton" '("org-chef-marmiton-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-martha-stewart" "org-chef-martha-stewart.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-martha-stewart.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-martha-stewart" '("org-chef-martha-stewart-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-nytimes" "org-chef-nytimes.el" (0
+;;;;;; 0 0 0))
+;;; Generated autoloads from org-chef-nytimes.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-nytimes" '("org-chef-nytimes-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-reluctant-gourmet" "org-chef-reluctant-gourmet.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-reluctant-gourmet.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-reluctant-gourmet" '("org-chef-reluctant-gourmet-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-saveur" "org-chef-saveur.el" (0 0
+;;;;;; 0 0))
+;;; Generated autoloads from org-chef-saveur.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-saveur" '("org-chef-saveur-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-serious-eats" "org-chef-serious-eats.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-serious-eats.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-serious-eats" '("org-chef-serious-eats-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-simply-recipes" "org-chef-simply-recipes.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-simply-recipes.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-simply-recipes" '("org-chef-simply-recipes-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-steamy-kitchen" "org-chef-steamy-kitchen.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-steamy-kitchen.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-steamy-kitchen" '("org-chef-steamy-kitchen-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-taste" "org-chef-taste.el" (0 0 0
+;;;;;; 0))
+;;; Generated autoloads from org-chef-taste.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-taste" '("org-chef-taste-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-utils" "org-chef-utils.el" (0 0 0
+;;;;;; 0))
+;;; Generated autoloads from org-chef-utils.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-utils" '("org-chef-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-wordpress" "org-chef-wordpress.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-wordpress.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-wordpress" '("org-chef-")))
+
+;;;***
+\f
+;;;### (autoloads nil "org-chef-xiachufang" "org-chef-xiachufang.el"
+;;;;;; (0 0 0 0))
+;;; Generated autoloads from org-chef-xiachufang.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-xiachufang" '("org-chef-xiachufang-")))
+
+;;;***
+\f
+;;;### (autoloads nil nil ("org-chef-pkg.el") (0 0 0 0))
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; coding: utf-8
+;; End:
+;;; org-chef-autoloads.el ends here
--- /dev/null
+;;; org-chef-chef-koch.el --- Functions for fetching recipes from chefkoch.de. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from chefkoch.de.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-chef-koch-extract-name (dom)
+ "Get the name of a recipe from a chefkoch DOM."
+ (dom-text (dom-by-tag (dom-by-class dom "recipe-header") 'h1)))
+
+
+(defun org-chef-chef-koch-ingredient-to-string (dom)
+ (let ((amount (replace-regexp-in-string "[ \\t\\n\\r]+" " " (string-trim (dom-texts (car (dom-by-tag dom 'td))))))
+ (name (string-trim (dom-texts (cadr (dom-by-tag dom 'td))))))
+ (format "%s %s" amount name)))
+
+
+(defun org-chef-chef-koch-extract-ingredients (dom)
+ "Get the ingredients for a recipe from a chefkoch DOM."
+ (mapcar #'org-chef-chef-koch-ingredient-to-string (dom-by-tag (dom-by-class dom "ingredients") 'tr)))
+
+
+(defun org-chef-chef-koch-extract-servings (dom)
+ "Get the number of servings for a recipe from a chefkoch DOM."
+ (dom-attr (dom-elements dom 'name "^portionen$") 'value))
+
+
+(defun org-chef-chef-koch-extract-prep-time (dom)
+ "Get the amount of prep-time for a recipe from a chefkoch DOM."
+ (let ((str (replace-regexp-in-string "\n" " " (dom-texts (dom-by-id dom "^preparation-info$")))))
+ (string-match "Arbeitszeit:[[:space:]]+ca. \\(?1:[^\.]*\\)\." str)
+ (match-string 1 str)))
+
+
+(defun org-chef-chef-koch-extract-cook-time (dom)
+ "Get the amount of cook-time for a recipe from a chefkoch DOM."
+ (let ((str (replace-regexp-in-string "\n" " " (dom-texts (dom-by-id dom "^preparation-info$")))))
+ (string-match "Koch-/Backzeit:[[:space:]]+ca. \\(?1:[^\.]*\\)\." str)
+ (match-string 1 str)))
+
+
+(defun org-chef-chef-koch-extract-ready-in (dom)
+ "Get the total amount of time for a recipe from a chefkoch DOM."
+ "")
+
+
+(defun org-chef-chef-koch-extract-directions (dom)
+ "Get the directions for a recipe from a chefkoch DOM."
+ (with-temp-buffer
+ (insert (string-trim (dom-text (car (dom-by-tag (nth 3 (dom-by-tag dom 'article)) 'div)))))
+ (delete-trailing-whitespace)
+ (split-string (buffer-string) "\n")))
+
+
+(defun org-chef-chef-koch-from-dom (dom)
+ "Given a chefkoch.de DOM, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions"
+ (let* ((prep-time (org-chef-chef-koch-extract-prep-time dom))
+ (cook-time (org-chef-chef-koch-extract-cook-time dom))
+ (total-time (org-chef-chef-koch-extract-ready-in dom)))
+
+ `((ingredients . ,(org-chef-chef-koch-extract-ingredients dom))
+ (name . ,(org-chef-chef-koch-extract-name dom))
+ (servings . ,(org-chef-chef-koch-extract-servings dom))
+ (prep-time . ,prep-time)
+ (cook-time . ,cook-time)
+ (ready-in . ,total-time)
+ (directions . ,(org-chef-chef-koch-extract-directions dom)))))
+
+
+(defun org-chef-chef-koch-fetch (url)
+ "Given a chefkoch.de URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+ (cons `(source-url . ,url) (org-chef-chef-koch-from-dom dom)))))
+
+
+(provide 'org-chef-chef-koch)
+;;; org-chef-chef-koch.el ends here
--- /dev/null
+;;; org-chef-cultures-for-health.el --- Functions for fetching recipes from culturesforhealth.com. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from culturesforhealth.com.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-cultures-for-health-extract-name (dom)
+ "Get the name of a recipe from an culturesforhealth DOM."
+ (dom-text (car (dom-elements dom 'itemprop "^name$"))))
+
+
+(defun org-chef-cultures-for-health-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an culturesforhealth DOM."
+ (mapcar 'dom-texts (dom-elements dom 'itemprop "^ingredients$")))
+
+
+(defun org-chef-cultures-for-health-extract-directions (dom)
+ "Get the directions for a recipe from an culturesforhealth DOM."
+ (mapcar #'dom-texts (org-chef-dom-children (cadr (org-chef-dom-children (car (dom-elements dom 'itemprop "^recipeInstructions$")))))))
+
+
+(defun org-chef-cultures-for-health-from-dom (dom)
+ "Given a culturesforhealth.com DOM, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions"
+ `((ingredients . ,(org-chef-cultures-for-health-extract-ingredients dom))
+ (name . ,(org-chef-cultures-for-health-extract-name dom)
+ )
+ (servings . nil)
+ (prep-time . nil)
+ (cook-time . nil)
+ (ready-in . nil)
+ (directions . ,(org-chef-cultures-for-health-extract-directions dom))))
+
+
+(defun org-chef-cultures-for-health-fetch (url)
+ "Given a culturesforhealth.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+ (cons `(source-url . ,url) (org-chef-cultures-for-health-from-dom dom)))))
+
+
+(provide 'org-chef-cultures-for-health)
+;;; org-chef-cultures-for-health.el ends here
--- /dev/null
+;;; org-chef-fine-cooking.el --- Functions for fetching recipes from finecooking.com. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Calvin Beck, Erik Hetzner
+
+;; Author: Erik Hetzner <eghNOSPAMe6h.org>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2019
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from finecooking.com.
+
+;;; Code:
+
+(require 'org-chef-utils)
+(require 'dom)
+
+(defun org-chef-fine-cooking-extract-name (dom)
+ "Get the name of a recipe from an finecooking DOM."
+ (dom-text (dom-by-class dom "^recipe__title")))
+
+(defun org-chef-fine-cooking-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an finecooking DOM."
+ (mapcar #'(lambda (n) (string-trim (dom-texts n)))
+ (org-chef-dom-children (dom-child-by-tag (dom-by-class dom "^recipe__ingredients$") 'ul))))
+
+(defun org-chef-fine-cooking-extract-servings (dom)
+ "Get the number of servings for a recipe from an finecooking DOM."
+ (dom-text (dom-child-by-tag (dom-by-class dom "^recipe__yield$") 'p)))
+
+(defun org-chef-fine-cooking-extract-directions (dom)
+ "Get the directions for a recipe from an finecooking DOM."
+ (mapcar #'(lambda (n) (string-trim (dom-texts n)))
+ (org-chef-dom-children (dom-child-by-tag (dom-by-class dom "^recipe__preparation$") 'ul))))
+
+(defun org-chef-fine-cooking-fetch (url)
+ "Given a finecooking.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+ `((name . ,(org-chef-fine-cooking-extract-name dom))
+ (ingredients . ,(org-chef-fine-cooking-extract-ingredients dom))
+ (servings . ,(org-chef-fine-cooking-extract-servings dom))
+ (prep-time . nil)
+ (cook-time . nil)
+ (ready-in . nil)
+ (directions . ,(org-chef-fine-cooking-extract-directions dom))
+ (source-url . ,url)))))
+
+(provide 'org-chef-fine-cooking)
+;;; org-chef-fine-cooking.el ends here
--- /dev/null
+;;; org-chef-genius-kitchen.el --- Functions for fetching recipes from geniuskitchen.com. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from geniuskitchen.com.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-genius-kitchen-extract-name (dom)
+ "Get the name of a recipe from an geniuskitchen DOM."
+ (dom-texts (dom-by-class dom "^recipe-title$")))
+
+
+(defun org-chef-genius-kitchen-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an geniuskitchen DOM."
+ (mapcar #'dom-texts (dom-by-class dom "^recipe-ingredients__ingredient$")))
+
+
+(defun org-chef-genius-kitchen-extract-servings (dom)
+ "Get the number of servings for a recipe from an geniuskitchen DOM."
+ (dom-texts (dom-by-class (car (dom-by-class dom "recipe-facts__yield")) "theme-color")))
+
+
+(defun org-chef-genius-kitchen-extract-ready-in (dom)
+ "Get the total amount of time for a recipe from an geniuskitchen DOM."
+ (dom-texts (cddddr (car (dom-by-class dom "recipe-facts__time")))))
+
+
+(defun org-chef-genius-kitchen-extract-directions (dom)
+ "Get the directions for a recipe from an geniuskitchen DOM."
+ (let ((directions-list (dom-by-tag (car (dom-by-class dom "recipe-directions__step")) 'li)))
+ (org-chef-remove-empty-strings
+ (mapcar #'(lambda (n) (string-trim (dom-text n))) directions-list))))
+
+
+(defun org-chef-genius-kitchen-fetch (url)
+ "Given a geniuskitchen.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+ `((name . ,(org-chef-genius-kitchen-extract-name dom))
+ (ingredients . ,(org-chef-genius-kitchen-extract-ingredients dom))
+ (servings . ,(org-chef-genius-kitchen-extract-servings dom))
+ (prep-time . nil)
+ (cook-time . nil)
+ (ready-in . ,(org-chef-genius-kitchen-extract-ready-in dom))
+ (directions . ,(org-chef-genius-kitchen-extract-directions dom))
+ (source-url . ,url)))))
+
+
+(provide 'org-chef-genius-kitchen)
+;;; org-chef-genius-kitchen.el ends here
--- /dev/null
+;;; org-chef-marmiton.el --- Functions for fetching recipes from marmiton.org. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck/Sébastien Le Maguer
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>/Sébastien Le Maguer <seb.lemaguerNOSPAMgmail.com>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck/Sébastien Le Maguer
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from marmiton.org.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-marmiton-sanitize (str)
+ "Sanitize the STR by removing beginning/trailing spaces extracted from a marmiton dom."
+ (replace-regexp-in-string "^[ \r\n]*\\(.*[^ \r\n]\\)[ \r\n]*$" "\\1" str))
+
+(defun org-chef-marmiton-extract-dom-text (dom)
+ "Embedded the operation santize of dom-text from a marmiton DOM."
+ (org-chef-marmiton-sanitize (dom-texts dom)))
+
+(defun org-chef-marmiton-extract-name (dom)
+ "Get the name of a recipe from a marmiton DOM."
+ (dom-text (car (dom-elements dom 'class "^main-title $"))))
+
+(defun org-chef-marmiton-extract-current-ingredient (dom)
+ "Extract element for the current ingredient from a marmiton DOM."
+ (concat
+ (org-chef-marmiton-extract-dom-text (dom-elements dom 'class "^recipe-ingredient-qt$"))
+ " "
+ (org-chef-marmiton-extract-dom-text (dom-elements dom 'class "^ingredient$"))))
+
+(defun org-chef-marmiton-extract-ingredients (dom)
+ "Get the ingredients for a recipe from a marmiton DOM."
+ (mapcar 'org-chef-marmiton-extract-current-ingredient (dom-elements dom 'class "^recipe-ingredients__list__item$")))
+
+(defun org-chef-marmiton-extract-directions (dom)
+ "Get the directions for a recipe from a marmiton DOM."
+
+ (mapcar (lambda (x) (org-chef-marmiton-extract-dom-text (cddr x)))
+ (dom-elements dom 'class "^recipe-preparation__list__item$")))
+
+(defun org-chef-marmiton-extract-prep-time (dom)
+ "Get the preparation time for a recipe from a marmiton DOM."
+ (org-chef-marmiton-extract-dom-text
+ (dom-elements (dom-elements dom 'class "recipe-infos__timmings__preparation")
+ 'class "^recipe-infos__timmings__value$")))
+
+(defun org-chef-marmiton-extract-cook-time (dom)
+ "Extract the cooking time for a recipe from a marmiton DOM."
+ (org-chef-marmiton-extract-dom-text
+ (dom-elements (dom-elements dom 'class "recipe-infos__timmings__cooking")
+ 'class "^recipe-infos__timmings__value$")))
+
+
+(defun org-chef-marmiton-extract-servings (dom)
+ (dom-text (car (dom-elements dom 'class "^title-2 recipe-infos__quantity__value$"))))
+
+
+
+(defun org-chef-marmiton-from-dom (dom)
+ "Given a marmiton.org DOM, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions"
+ `((ingredients . ,(org-chef-marmiton-extract-ingredients dom))
+ (name . ,(org-chef-marmiton-extract-name dom))
+ (servings . ,(org-chef-marmiton-extract-servings dom))
+ (prep-time . ,(org-chef-marmiton-extract-prep-time dom))
+ (cook-time . ,(org-chef-marmiton-extract-cook-time dom))
+ (ready-in . nil)
+ (directions . ,(org-chef-marmiton-extract-directions dom))))
+
+
+(defun org-chef-marmiton-fetch (url)
+ "Given a marmiton.org URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+ (cons `(source-url . ,url) (org-chef-marmiton-from-dom dom)))))
+
+(provide 'org-chef-marmiton)
+;;; org-chef-marmiton.el ends here
--- /dev/null
+;;; org-chef-martha-stewart.el --- org-chef marthastewart fetching. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from marthastewart.com.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-martha-stewart-extract-name (dom)
+ "Get the name of a recipe from an marthastewart DOM."
+ (string-trim (dom-text (car (dom-by-class dom "^page-title$")))))
+
+
+(defun org-chef-martha-stewart-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an marthastewart DOM."
+ (mapcar #'(lambda (n) (string-trim (dom-text n)))
+ (dom-by-class dom "^component-text$")))
+
+
+(defun org-chef-martha-stewart-extract-servings (dom)
+ "Get the number of servings for a recipe from an marthastewart DOM."
+ (string-trim (dom-text (car (dom-by-class dom "servings-data$")))))
+
+
+(defun org-chef-martha-stewart-extract-prep-time (dom)
+ "Get the amount of prep-time for a recipe from an marthastewart DOM."
+ (string-trim (dom-text (car (dom-by-class dom "prep-time-data$")))))
+
+
+(defun org-chef-martha-stewart-extract-cook-time (dom)
+ "Get the amount of cook-time for a recipe from an marthastewart DOM."
+ nil)
+
+
+(defun org-chef-martha-stewart-extract-ready-in (dom)
+ "Get the total amount of time for a recipe from an marthastewart DOM."
+ (string-trim (dom-text (car (dom-by-class dom "total-time-data$")))))
+
+
+(defun org-chef-martha-stewart-extract-directions (dom)
+ "Get the directions for a recipe from an marthastewart DOM."
+ (mapcar #'(lambda (n) (string-trim (dom-texts (dom-children n))))
+ (dom-by-class dom "^directions-item-text$")))
+
+
+(defun org-chef-martha-stewart-fetch (url)
+ "Given an marthastewart.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+
+ `((name . ,(org-chef-martha-stewart-extract-name dom))
+ (ingredients . ,(org-chef-martha-stewart-extract-ingredients dom))
+ (servings . ,(org-chef-martha-stewart-extract-servings dom))
+ (prep-time . ,(org-chef-martha-stewart-extract-prep-time dom))
+ (cook-time . ,(org-chef-martha-stewart-extract-cook-time dom))
+ (ready-in . ,(org-chef-martha-stewart-extract-ready-in dom))
+ (directions . ,(org-chef-martha-stewart-extract-directions dom))
+ (source-url . ,url)))))
+
+
+(provide 'org-chef-martha-stewart)
+;;; org-chef-martha-stewart.el ends here
--- /dev/null
+;;; org-chef-nytimes.el --- Functions for fetching recipes from nytimes.com. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck/Asilata Bapat
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>/Asilata Bapat <asilataNOSPAMalum.mit.edu>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck/Asilata Bapat
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from nytimes.com.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-nytimes-extract-name (dom)
+ "Get the name of a recipe from an nytimes DOM."
+ (string-trim (dom-text (car (dom-by-class dom "recipe-title")))))
+
+
+(defun org-chef-nytimes-ingredient-to-string (dom)
+ "Extract string representation of a single ingredient from an nytimes DOM."
+ (replace-regexp-in-string
+ " \\([,\.]\\)" "\\1"
+ (string-join (org-chef-remove-empty-strings (mapcar 'string-trim (dom-strings dom))) " ")))
+
+(defun org-chef-nytimes-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an nytimes DOM."
+ (mapcar 'org-chef-nytimes-ingredient-to-string
+ (dom-elements dom 'itemprop "recipeIngredient")))
+
+
+(defun org-chef-nytimes-extract-servings (dom)
+ "Get the number of servings for a recipe from an nytimes DOM."
+ (replace-regexp-in-string " servings" "" (dom-text (car (dom-elements dom 'itemprop "recipeYield")))))
+
+
+(defun org-chef-nytimes-extract-prep-time (dom)
+ "Get the amount of prep-time for a recipe from an nytimes DOM."
+ "")
+
+
+(defun org-chef-nytimes-extract-cook-time (dom)
+ "Get the amount of cook-time for a recipe from an nytimes DOM."
+ "")
+
+
+(defun org-chef-nytimes-extract-ready-in (dom)
+ "Get the total amount of time for a recipe from an nytimes DOM."
+ (dom-texts (dom-by-class (cadr (dom-by-tag (dom-by-class dom "recipe-time-yield") 'li)) "recipe-yield-value")))
+
+
+(defun org-chef-nytimes-extract-directions (dom)
+ "Get the directions for a recipe from an nytimes DOM."
+ (mapcar 'dom-texts (dom-by-tag (dom-elements dom 'itemprop "recipeInstructions") 'li)))
+
+
+(defun org-chef-nytimes-from-dom (dom)
+ "Given an nytimes.com DOM, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions"
+ (let* ((prep-time (org-chef-nytimes-extract-prep-time dom))
+ (cook-time (org-chef-nytimes-extract-cook-time dom))
+ (total-time (org-chef-nytimes-extract-ready-in dom)))
+
+ `((ingredients . ,(org-chef-nytimes-extract-ingredients dom))
+ (name . ,(org-chef-nytimes-extract-name dom))
+ (servings . ,(org-chef-nytimes-extract-servings dom))
+ (prep-time . ,prep-time)
+ (cook-time . ,cook-time)
+ (ready-in . ,total-time)
+ (directions . ,(org-chef-nytimes-extract-directions dom)))))
+
+
+(defun org-chef-nytimes-fetch (url)
+ "Given an nytimes.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+ (cons `(source-url . ,url) (org-chef-nytimes-from-dom dom)))))
+
+
+(provide 'org-chef-nytimes)
+;;; org-chef-nytimes.el ends here
--- /dev/null
+(define-package "org-chef" "20191201.1435" "Cookbook and recipe management with org-mode."
+ '((org "0")
+ (emacs "24"))
+ :keywords
+ '("convenience" "abbrev" "outlines" "org" "food" "recipes" "cooking")
+ :authors
+ '(("Calvin Beck" . "hobbesNOSPAMualberta.ca"))
+ :maintainer
+ '("Calvin Beck" . "hobbesNOSPAMualberta.ca")
+ :url "https://github.com/Chobbes/org-chef")
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
--- /dev/null
+;;; org-chef-reluctant-gourmet.el --- Functions for fetching recipes from reluctantgourmet.com. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbes@ualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from reluctantgourmet.com.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-reluctant-gourmet-extract-name (dom)
+ "Get the name of a recipe from an reluctantgourmet DOM."
+ (dom-text (car (dom-by-id dom "zlrecipe-title"))))
+
+
+(defun org-chef-reluctant-gourmet-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an reluctantgourmet DOM."
+ (mapcar #'(lambda (n) (string-trim (dom-text n))) (dom-by-class dom "^ingredient$")))
+
+
+(defun org-chef-reluctant-gourmet-extract-servings (dom)
+ "Get the number of servings for a recipe from an reluctantgourmet DOM."
+ (dom-texts (car (dom-elements dom 'itemprop "^recipeYield$"))))
+
+
+(defun org-chef-reluctant-gourmet-extract-prep-time (dom)
+ "Get the amount of prep-time for a recipe from an reluctantgourmet DOM."
+ (dom-texts (car (dom-elements dom 'itemprop "^prepTime$"))))
+
+
+(defun org-chef-reluctant-gourmet-extract-cook-time (dom)
+ "Get the amount of cook-time for a recipe from an reluctantgourmet DOM."
+ (dom-texts (car (dom-elements dom 'itemprop "^cookTime$"))))
+
+
+(defun org-chef-reluctant-gourmet-extract-ready-in (dom)
+ "Get the total amount of time for a recipe from an reluctantgourmet DOM."
+ (dom-texts (car (dom-elements dom 'itemprop "^totalTime$"))))
+
+
+(defun org-chef-reluctant-gourmet-extract-directions (dom)
+ "Get the directions for a recipe from an reluctantgourmet DOM."
+ (mapcar #'dom-text (seq-filter (lambda (x) (not (stringp x)))
+ (dom-elements dom 'itemprop "^recipeInstructions$"))))
+
+
+(defun org-chef-reluctant-gourmet-from-dom (dom)
+ "Given a reluctantgourmet.com DOM, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions"
+ (let* ((prep-time (org-chef-reluctant-gourmet-extract-prep-time dom))
+ (cook-time (org-chef-reluctant-gourmet-extract-cook-time dom))
+ (total-time (org-chef-reluctant-gourmet-extract-ready-in dom)))
+
+ `((ingredients . ,(org-chef-reluctant-gourmet-extract-ingredients dom))
+ (name . ,(org-chef-reluctant-gourmet-extract-name dom))
+ (servings . ,(org-chef-reluctant-gourmet-extract-servings dom))
+ (prep-time . ,prep-time)
+ (cook-time . ,cook-time)
+ (ready-in . ,total-time)
+ (directions . ,(org-chef-reluctant-gourmet-extract-directions dom)))))
+
+
+(defun org-chef-reluctant-gourmet-fetch (url)
+ "Given a reluctantgourmet.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+ (cons `(source-url . ,url) (org-chef-reluctant-gourmet-from-dom dom)))))
+
+
+(provide 'org-chef-reluctant-gourmet)
+;;; org-chef-reluctant-gourmet.el ends here
--- /dev/null
+;;; org-chef-saveur.el --- Functions for fetching recipes from saveur.com. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck/Derek Ellis
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>/Derek Ellis <derek.ellisNOSPAMgmail.com>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck/Derek Ellis
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from saveur.com.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+ (defun org-chef-saveur-chomp (str)
+ "Chomp leading and tailing whitespace from STR."
+ (replace-regexp-in-string (rx (or (: bos (* (any " \t\n")))
+ (: (* (any " \t\n")) eos)))
+ ""
+ str))
+
+
+(defun org-chef-saveur-extract-name (dom)
+ "Get the name of a recipe from an saveur DOM."
+ (string-trim (dom-text (car (dom-by-class dom "page-title")))))
+
+
+(defun org-chef-saveur-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an saveur DOM."
+ (remove ""
+ (mapcar 'org-chef-saveur-chomp
+ (split-string
+ (replace-regexp-in-string " ⁄ " "/"
+ (string-join (mapcar #'dom-texts (dom-by-class dom "^ingredients$")))) "\n" ))))
+
+
+(defun org-chef-saveur-extract-servings (dom)
+ "Get the number of servings for a recipe from an saveur DOM."
+ (replace-regexp-in-string "serves " ""
+ (dom-text (dom-by-tag (dom-by-class dom "yield") 'span))))
+
+
+(defun org-chef-saveur-extract-prep-time (dom)
+ "Get the amount of prep-time for a recipe from an saveur DOM."
+ (org-chef-saveur-chomp
+ (dom-text (dom-by-class dom "^prep-time$"))))
+
+
+(defun org-chef-saveur-extract-cook-time (dom)
+ "Get the amount of cook-time for a recipe from an saveur DOM."
+ (org-chef-saveur-chomp
+ (dom-text (dom-by-class dom "^cook-time$"))))
+
+
+(defun org-chef-saveur-extract-ready-in (dom)
+ "Get the total amount of time for a recipe from an saveur DOM."
+ (string-trim (dom-texts (dom-by-class (cadr (dom-by-tag (dom-by-class dom "recipe-time-yield") 'li)) "recipe-yield-value"))))
+
+
+(defun org-chef-saveur-extract-directions (dom)
+ "Get the directions for a recipe from an saveur DOM."
+ (remove ""
+ (mapcar 'org-chef-saveur-chomp
+ (split-string
+ (replace-regexp-in-string " ⁄ " "/"
+ (dom-texts
+ (dom-by-class dom "^instructions "))) "\n \n " ))))
+
+(defun org-chef-saveur-from-dom (dom)
+ "Given an saveur.com DOM, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions"
+ (let* ((prep-time (org-chef-saveur-extract-prep-time dom))
+ (cook-time (org-chef-saveur-extract-cook-time dom))
+ (total-time (org-chef-saveur-extract-ready-in dom)))
+
+ `((ingredients . ,(org-chef-saveur-extract-ingredients dom))
+ (name . ,(org-chef-saveur-extract-name dom))
+ (servings . ,(org-chef-saveur-extract-servings dom))
+ (prep-time . ,prep-time)
+ (cook-time . ,cook-time)
+ (ready-in . ,total-time)
+ (directions . ,(org-chef-saveur-extract-directions dom)))))
+
+
+(defun org-chef-saveur-fetch (url)
+ "Given an saveur.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+ (cons `(source-url . ,url) (org-chef-saveur-from-dom dom)))))
+
+
+(provide 'org-chef-saveur)
+;;; org-chef-saveur.el ends here
--- /dev/null
+;;; org-chef-serious-eats.el --- org-chef seriouseats fetching. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from seriouseats.com.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-serious-eats-extract-name (dom)
+ "Get the name of a recipe from an seriouseats DOM."
+ (dom-text (car (dom-elements dom 'class "recipe-title"))))
+
+
+(defun org-chef-serious-eats-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an seriouseats DOM."
+ (mapcar 'dom-texts (dom-elements dom 'class "^ingredient$")))
+
+
+(defun org-chef-serious-eats-extract-servings (dom)
+ "Get the number of servings for a recipe from an seriouseats DOM."
+ (dom-text (car (dom-elements dom 'itemprop "^recipeYield$"))))
+
+
+(defun org-chef-serious-eats-extract-prep-time (dom)
+ "Get the amount of prep-time for a recipe from an seriouseats DOM."
+ (dom-text (car (dom-by-class
+ (cadr
+ (org-chef-dom-children
+ (car (dom-by-class dom "^recipe-about$"))))
+ "info"))))
+
+
+(defun org-chef-serious-eats-extract-cook-time (dom)
+ "Get the amount of cook-time for a recipe from an seriouseats DOM."
+ nil)
+
+
+(defun org-chef-serious-eats-extract-ready-in (dom)
+ "Get the total amount of time for a recipe from an seriouseats DOM."
+ (dom-text (car (dom-by-class
+ (caddr
+ (org-chef-dom-children
+ (car (dom-by-class dom "^recipe-about$"))))
+ "info"))))
+
+
+(defun org-chef-serious-eats-extract-directions (dom)
+ "Get the directions for a recipe from an seriouseats DOM."
+ (mapcar #'(lambda (n) (string-trim (dom-texts (dom-children n))))
+ (dom-by-class dom "^recipe-procedure-text$")))
+
+
+(defun org-chef-serious-eats-fetch (url)
+ "Given an seriouseats.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+
+ `((name . ,(org-chef-serious-eats-extract-name dom))
+ (ingredients . ,(org-chef-serious-eats-extract-ingredients dom))
+ (servings . ,(org-chef-serious-eats-extract-servings dom))
+ (prep-time . ,(org-chef-serious-eats-extract-prep-time dom))
+ (cook-time . ,(org-chef-serious-eats-extract-cook-time dom))
+ (ready-in . ,(org-chef-serious-eats-extract-ready-in dom))
+ (directions . ,(org-chef-serious-eats-extract-directions dom))
+ (source-url . ,url)))))
+
+(provide 'org-chef-serious-eats)
+;;; org-chef-serious-eats.el ends here
--- /dev/null
+;;; org-chef-simply-recipes.el --- Functions for fetching recipes from simplyrecipes.com. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from simplyrecipes.com.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-simply-recipes-extract-name (dom)
+ "Get the name of a recipe from an simplyrecipes DOM."
+ (dom-text (car (dom-by-class dom "entry-title"))))
+
+
+(defun org-chef-simply-recipes-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an simplyrecipes DOM."
+ (mapcar 'dom-text (dom-by-class dom "^ingredient$")))
+
+
+(defun org-chef-simply-recipes-extract-servings (dom)
+ "Get the number of servings for a recipe from an simplyrecipes DOM."
+ (let ((servings (dom-text (car (dom-by-class dom "^yield*")))))
+ (when servings
+ (substring servings 7))))
+
+
+(defun org-chef-simply-recipes-extract-prep-time (dom)
+ "Get the amount of prep-time for a recipe from an simplyrecipes DOM."
+ (dom-text (car (dom-by-class dom "preptime"))))
+
+
+(defun org-chef-simply-recipes-extract-cook-time (dom)
+ "Get the amount of cook-time for a recipe from an simplyrecipes DOM."
+ (let ((cook-time (dom-by-class dom "cooktime"))
+ (other-time (dom-by-class dom "othertime")))
+ (dom-text (car (if (null cook-time) other-time cook-time)))))
+
+
+(defun org-chef-simply-recipes-extract-directions (dom)
+ "Get the directions for a recipe from an simplyrecipes DOM."
+ (mapcar #'dom-text (seq-filter (lambda (x) (not (stringp x)))
+ (dom-children (car (dom-elements dom 'itemprop "^recipeInstructions$"))))))
+
+
+(defun org-chef-simply-recipes-from-dom (dom)
+ "Given a simplyrecipes.com DOM, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions"
+ (let* ((prep-time (org-chef-simply-recipes-extract-prep-time dom))
+ (cook-time (org-chef-simply-recipes-extract-cook-time dom)))
+
+ `((ingredients . ,(org-chef-simply-recipes-extract-ingredients dom))
+ (name . ,(org-chef-simply-recipes-extract-name dom)
+ )
+ (servings . ,(org-chef-simply-recipes-extract-servings dom))
+ (prep-time . ,prep-time)
+ (cook-time . ,cook-time)
+ (ready-in . nil)
+ (directions . ,(org-chef-simply-recipes-extract-directions dom)))))
+
+
+(defun org-chef-simply-recipes-fetch (url)
+ "Given a simplyrecipes.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+ (cons `(source-url . ,url) (org-chef-simply-recipes-from-dom dom)))))
+
+
+(provide 'org-chef-simply-recipes)
+;;; org-chef-simply-recipes.el ends here
--- /dev/null
+;;; org-chef-steamy-kitchen.el --- org-chef steamykitchen fetching. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from steamykitchen.com.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-steamy-kitchen-extract-name (dom)
+ "Get the name of a recipe from an steamykitchen DOM."
+ (dom-text (car (dom-elements dom 'itemprop "^name$"))))
+
+
+(defun org-chef-steamy-kitchen-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an steamykitchen DOM."
+ (mapcar 'dom-texts (dom-elements dom 'itemprop "^ingredients$")))
+
+
+(defun org-chef-steamy-kitchen-extract-servings (dom)
+ "Get the number of servings for a recipe from an steamykitchen DOM."
+ (dom-text (car (dom-elements dom 'itemprop "^recipeYield$"))))
+
+
+(defun org-chef-steamy-kitchen-extract-prep-time (dom)
+ "Get the amount of prep-time for a recipe from an steamykitchen DOM."
+ (dom-text (dom-parent dom (car (dom-elements dom 'itemprop "^prepTime$")))))
+
+
+(defun org-chef-steamy-kitchen-extract-cook-time (dom)
+ "Get the amount of cook-time for a recipe from an steamykitchen DOM."
+ (dom-text (dom-parent dom (car (dom-elements dom 'itemprop "^cookTime$")))))
+
+
+(defun org-chef-steamy-kitchen-extract-ready-in (dom)
+ "Get the total amount of time for a recipe from an steamykitchen DOM."
+ nil)
+
+
+(defun org-chef-steamy-kitchen-extract-directions (dom)
+ "Get the directions for a recipe from an steamykitchen DOM."
+ (mapcar #'(lambda (n) (string-trim (dom-texts n)))
+ (org-chef-dom-children (car (dom-by-class dom "^instructions$")))))
+
+
+(defun org-chef-steamy-kitchen-fetch (url)
+ "Given an steamykitchen.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+
+ `((name . ,(org-chef-steamy-kitchen-extract-name dom))
+ (ingredients . ,(org-chef-steamy-kitchen-extract-ingredients dom))
+ (servings . ,(org-chef-steamy-kitchen-extract-servings dom))
+ (prep-time . ,(org-chef-steamy-kitchen-extract-prep-time dom))
+ (cook-time . ,(org-chef-steamy-kitchen-extract-cook-time dom))
+ (ready-in . ,(org-chef-steamy-kitchen-extract-ready-in dom))
+ (directions . ,(org-chef-steamy-kitchen-extract-directions dom))
+ (source-url . ,url)))))
+
+
+(provide 'org-chef-steamy-kitchen)
+;;; org-chef-steamy-kitchen.el ends here
--- /dev/null
+;;; org-chef-taste.el --- org-chef taste.com.au fetching -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Calvin Beck, Peter Hardy
+
+;; Author: Peter Hardy <peterNOSPAMhardy.dropbear.id.au>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2019
+
+;; Copyright 2019 Peter Hardy
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from taste.com.au.
+
+;;; Code:
+
+(require 'org-chef-utils)
+(require 'cl-seq)
+(require 'dom)
+
+(defun org-chef-taste-extract-cooking-infos (dom info)
+ "Get INFO from recipe-cooking-infos in a taste.com.au DOM."
+ (let ((i (cl-position info (mapcar #'(lambda (n) (string-trim (dom-text n))) (dom-by-tag (dom-by-class dom "^recipe-cooking-infos$") 'li)) :test 'equal)))
+ (if i
+ (dom-text (nth i (dom-by-tag (dom-by-class dom "^recipe-cooking-infos$") 'b)))
+ "")))
+
+(defun org-chef-taste-extract-name (dom)
+ "Get the name of a recipe from a taste.com.au DOM."
+ (dom-text (dom-by-tag dom 'h1)))
+
+(defun org-chef-taste-extract-ingredients (dom)
+ "Get the ingredients for a recipe from a taste.com.au DOM."
+ (mapcar #'(lambda (n) (string-trim (dom-texts n)))
+ (dom-by-class dom "^ingredient-description$")))
+
+(defun org-chef-taste-extract-servings (dom)
+ "Get the servings for a recipe from a taste.com.au DOM."
+ (let ((servings (org-chef-taste-extract-cooking-infos dom "Servings")))
+ (if (string-equal servings "")
+ (org-chef-taste-extract-cooking-infos dom "Makes")
+ servings)))
+
+(defun org-chef-taste-extract-prep-time (dom)
+ "Get the prep time for a recipe from a taste.com.au DOM."
+ (org-chef-taste-extract-cooking-infos dom "Prep"))
+
+(defun org-chef-taste-extract-cook-time (dom)
+ "Get the prep time for a recipe from a taste.com.au DOM."
+ (org-chef-taste-extract-cooking-infos dom "Cook"))
+
+(defun org-chef-taste-extract-directions (dom)
+ "Get the directions for a recipe from a taste.com.au DOM."
+ (mapcar #'(lambda (n) (string-trim (dom-texts n)))
+ (dom-by-class dom "^recipe-method-step-content$")))
+
+(defun org-chef-taste-fetch (url)
+ "Given a taste.com.au URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+
+ `((name . ,(org-chef-taste-extract-name dom))
+ (ingredients . ,(org-chef-taste-extract-ingredients dom))
+ (servings . ,(org-chef-taste-extract-servings dom))
+ (prep-time . ,(org-chef-taste-extract-prep-time dom))
+ (cook-time . ,(org-chef-taste-extract-cook-time dom))
+ (ready-in . "")
+ (directions . ,(org-chef-taste-extract-directions dom))
+ (source-url . ,url)))))
+
+(provide 'org-chef-taste)
+;;; org-chef-taste.el ends here
--- /dev/null
+;;; org-chef-utils.el --- Utilities for org-chef. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Utility functions for org-chef.
+
+;;; Code:
+
+(require 'cl-macs)
+(require 'gnutls)
+
+(defun org-chef-remove-empty-strings (lst)
+ "Filter out any empty strings in a list of strings (LST)."
+ (seq-filter (lambda (x) (/= (length x) 0)) lst))
+
+
+(defun org-chef-dom-children (dom)
+ "Get the child nodes of the DOM, remove strings."
+ (seq-filter (lambda (x) (not (stringp x)))
+ (dom-children dom)))
+
+
+(defun org-chef-insert-org-list (lst &optional bullet)
+ "Insert LST as an ‘org-mode’ plain list.
+
+The optional argument BULLET specifies which type of bullet point
+should be used."
+ (mapcar (lambda (x) (progn (insert (format "%s " (string-trim x)))
+ (org-cycle)
+ (org-delete-backward-char 1)
+ (org-ctrl-c-minus)
+ (if bullet (org-cycle-list-bullet bullet))
+ (org-return)))
+ lst))
+
+
+(defun org-chef-url-retrieve-synchronously (url)
+ "Fetch URL using url-retrieve-synchronously.
+
+This is a wrapper for url-retrieve-synchronously, which primarily serves to implement workarounds."
+
+ (let ((gnutls-algorithm-priority
+ (if org-chef-fetch-workaround
+ "NORMAL:-VERS-TLS1.3"
+ gnutls-algorithm-priority)))
+
+ (url-retrieve-synchronously url)))
+
+
+(provide 'org-chef-utils)
+;;; org-chef-utils.el ends here
--- /dev/null
+;;; org-chef-wordpress.el --- org-chef wordpress fetching. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from wordpress sites.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+
+(defun org-chef-wordpress-extract-name (dom)
+ "Get the name of a recipe from an wordpress DOM."
+ (dom-text (car (dom-by-class dom "^wprm-recipe-name"))))
+
+
+(defun org-chef-wordpress-extract-ingredients (dom)
+ "Get the ingredients for a recipe from an wordpress DOM."
+ (mapcar #'(lambda (n) (string-trim (dom-texts n))) (dom-by-class dom "^wprm-recipe-ingredient$")))
+
+
+(defun org-chef-wordpress-extract-servings (dom)
+ "Get the number of servings for a recipe from an wordpress DOM."
+ (dom-texts (car (dom-by-class dom "wprm-recipe-servings$"))))
+
+
+(defun org-chef-wordpress-extract-prep-time (dom)
+ "Get the amount of prep-time for a recipe from an wordpress DOM."
+ (dom-texts (car (dom-by-class dom "^wprm-recipe-time$"))))
+
+
+(defun org-chef-wordpress-extract-cook-time (dom)
+ "Get the amount of cook-time for a recipe from an wordpress DOM."
+ (dom-texts (cadr (dom-by-class dom "^wprm-recipe-time$"))))
+
+
+(defun org-chef-wordpress-extract-ready-in (dom)
+ "Get the total amount of time for a recipe from an wordpress DOM."
+ (dom-texts (caddr (dom-by-class dom "^wprm-recipe-time$"))))
+
+
+(defun org-chef-wordpress-extract-directions (dom)
+ "Get the directions for a recipe from an wordpress DOM."
+ (org-chef-remove-empty-strings (mapcar #'(lambda (n) (string-trim (dom-texts n))) (dom-by-class dom "^wprm-recipe-instruction$"))))
+
+
+(defun org-chef-is-wordpress-p (dom)
+ "Check if a DOM corresponds to a wordpress website."
+ (dom-by-class dom "^wprm-recipe-container$"))
+
+
+(defun org-chef-wordpress-fetch (url)
+ "Given an wordpress URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url
+
+If this is not a wordpress site, then return nil."
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+ (if (org-chef-is-wordpress-p dom)
+ `((name . ,(org-chef-wordpress-extract-name dom))
+ (ingredients . ,(org-chef-wordpress-extract-ingredients dom))
+ (servings . ,(org-chef-wordpress-extract-servings dom))
+ (prep-time . ,(org-chef-wordpress-extract-prep-time dom))
+ (cook-time . ,(org-chef-wordpress-extract-cook-time dom))
+ (ready-in . ,(org-chef-wordpress-extract-ready-in dom))
+ (directions . ,(org-chef-wordpress-extract-directions dom))
+ (source-url . ,url))
+ nil))))
+
+
+(provide 'org-chef-wordpress)
+;;; org-chef-wordpress.el ends here
--- /dev/null
+;;; org-chef-xiachufang.el --- Functions for fetching recipes from xiachufang.com. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck/Sébastien Le Maguer
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>/Sébastien Le Maguer <seb.lemaguerNOSPAMgmail.com>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+
+;; Copyright 2019 Yiu Fung Cheong
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; Functions for fetching information from xiachufang.com.
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'dom)
+
+(defun org-chef-xiachufang-sanitize (str)
+ "Sanitize the STR by removing beginning/trailing spaces extracted from a marmiton dom."
+ (replace-regexp-in-string "^[ \r\n]*\\(.*[^ \r\n]\\)[ \r\n]*$" "\\1" str))
+
+(defun org-chef-xiachufang-extract-name (dom)
+ "Get the name of a recipe from a xiachufang DOM."
+ (org-chef-xiachufang-sanitize (dom-text (car (dom-elements dom 'class "^page-title$")))))
+
+
+(defun org-chef-xiachufang-extract-ingredients (dom)
+ "Get the ingredients for a recipe from a xiachufang DOM."
+ (mapcar #'(lambda (n)
+ (replace-regexp-in-string "\n" " " (org-chef-xiachufang-sanitize (dom-texts n))))
+ (dom-elements dom 'itemprop "^recipeIngredient$")))
+
+
+(defun org-chef-xiachufang-extract-directions (dom)
+ "Get the directions for a recipe from a xiachufang DOM."
+ (mapcar #'(lambda (n)
+ (replace-regexp-in-string "\n" " " (org-chef-xiachufang-sanitize (dom-texts n))))
+ (dom-elements dom 'itemprop "^recipeInstructions$")))
+
+
+(defun org-chef-xiachufang-extract-prep-time (dom)
+ "Get the preparation time for a recipe from a xiachufang DOM."
+ "")
+
+
+(defun org-chef-xiachufang-extract-cook-time (dom)
+ "Extract the cooking time for a recipe from a xiachufang DOM."
+ "")
+
+
+(defun org-chef-xiachufang-extract-servings (dom)
+ "")
+
+
+(defun org-chef-xiachufang-from-dom (dom)
+ "Given a xiachufang.com DOM, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions"
+ `((ingredients . ,(org-chef-xiachufang-extract-ingredients dom))
+ (name . ,(org-chef-xiachufang-extract-name dom))
+ (servings . ,(org-chef-xiachufang-extract-servings dom))
+ (prep-time . ,(org-chef-xiachufang-extract-prep-time dom))
+ (cook-time . ,(org-chef-xiachufang-extract-cook-time dom))
+ (ready-in . nil)
+ (directions . ,(org-chef-xiachufang-extract-directions dom))))
+
+
+(defun org-chef-xiachufang-fetch (url)
+ "Given a xiachufang.com URL, retrieve the recipe information.
+
+This returns an alist with the following keys:
+
+- name
+- ingredients
+- servings
+- prep-time
+- cook-time
+- ready-in
+- directions
+- source-url"
+ (with-current-buffer (org-chef-url-retrieve-synchronously url)
+ (let ((dom (libxml-parse-html-region (point-min) (point-max))))
+ (cons `(source-url . ,url) (org-chef-xiachufang-from-dom dom)))))
+
+
+(provide 'org-chef-xiachufang)
+;;; org-chef-xiachufang.el ends here
--- /dev/null
+;;; org-chef.el --- Cookbook and recipe management with org-mode. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2018 Calvin Beck
+
+;; Author: Calvin Beck <hobbesNOSPAMualberta.ca>
+;; URL: https://github.com/Chobbes/org-chef
+;; Created: 2018
+;; Version: 0.1.3
+;; Keywords: convenience, abbrev, outlines, org, food, recipes, cooking
+;; Package-Requires: ((org "0") (emacs "24"))
+
+;; Copyright 2018 Calvin Beck
+
+;; Permission is hereby granted, free of charge, to any person
+;; obtaining a copy of this software and associated documentation
+;; files (the "Software"), to deal in the Software without
+;; restriction, including without limitation the rights to use, copy,
+;; modify, merge, publish, distribute, sublicense, and/or sell copies
+;; of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+
+;; The above copyright notice and this permission notice shall be
+;; included in all copies or substantial portions of the Software.
+
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+;; SOFTWARE.
+
+;;; Commentary:
+
+;; org-chef is a package for managing recipes in org-mode. One of the
+;; main features is that it can automatically extract recipes from
+;; websites like allrecipes.com
+
+;;; Code:
+
+
+(require 'org-chef-utils)
+(require 'org-chef-24kitchen)
+(require 'org-chef-all-recipes)
+(require 'org-chef-genius-kitchen)
+(require 'org-chef-simply-recipes)
+(require 'org-chef-martha-stewart)
+(require 'org-chef-cultures-for-health)
+(require 'org-chef-marmiton)
+(require 'org-chef-serious-eats)
+(require 'org-chef-reluctant-gourmet)
+(require 'org-chef-chef-koch)
+(require 'org-chef-steamy-kitchen)
+(require 'org-chef-nytimes)
+(require 'org-chef-saveur)
+(require 'org-chef-xiachufang)
+(require 'org-chef-wordpress)
+(require 'org-chef-taste)
+
+
+(defvar org-chef-fetch-workaround
+ (and
+ ;; Note: For build sans gnutls, `libgnutls-version' is -1.
+ (>= libgnutls-version 30603)
+ (version<= emacs-version "26.2")
+ 't)
+ "Inspired by https://github.com/magit/ghub/blob/7d59937d7782d0062216130a4d059b45e8396f82/ghub.el#L452
+
+See https://github.com/magit/ghub/issues/81 and https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341
+for more information.")
+
+(defun org-chef-recipe-insert-org (recipe)
+ "Insert a RECIPE as an ‘org-mode’ heading."
+ (org-insert-heading)
+ (insert (cdr (assoc 'name recipe)))
+ (org-return)
+ (org-set-property "source-url" (cdr (assoc 'source-url recipe)))
+ (org-set-property "servings" (cdr (assoc 'servings recipe)))
+ (org-set-property "prep-time" (format "%s" (cdr (assoc 'prep-time recipe))))
+ (org-set-property "cook-time" (format "%s" (cdr (assoc 'cook-time recipe))))
+ (org-set-property "ready-in" (format "%s" (cdr (assoc 'ready-in recipe))))
+ (org-insert-subheading t)
+ (insert "Ingredients")
+ (org-return)
+ (org-return)
+ (org-chef-insert-org-list (cdr (assoc 'ingredients recipe)))
+ (org-return)
+ (org-return)
+ (org-insert-heading)
+ (insert "Directions")
+ (org-return)
+ (org-return)
+ (org-chef-insert-org-list (cdr (assoc 'directions recipe)) "1."))
+
+
+(defun org-chef-recipe-org-string (recipe)
+ "Get an ‘org-mode’ heading string for a RECIPE."
+ (with-temp-buffer (org-mode)
+ (org-chef-recipe-insert-org recipe)
+ (buffer-string)))
+
+
+(defun org-chef-match-url (BASE URL)
+ "Match URL against a BASE url."
+ (not (null (string-match-p (regexp-quote BASE) URL))))
+
+
+(defun org-chef-fetch-recipe-specific-url (URL)
+ "Look up a recipe based on a specific URL."
+ (cond
+ ((org-chef-match-url "24kitchen.nl" URL) (org-chef-24kitchen-fetch URL))
+ ((org-chef-match-url "allrecipes.com" URL) (org-chef-all-recipes-fetch URL))
+ ((org-chef-match-url "geniuskitchen.com" URL) (org-chef-genius-kitchen-fetch URL))
+ ((org-chef-match-url "simplyrecipes.com" URL) (org-chef-simply-recipes-fetch URL))
+ ((org-chef-match-url "marthastewart.com" URL) (org-chef-martha-stewart-fetch URL))
+ ((org-chef-match-url "culturesforhealth.com" URL) (org-chef-cultures-for-health-fetch URL))
+ ((org-chef-match-url "marmiton.org" URL) (org-chef-marmiton-fetch URL))
+ ((org-chef-match-url "seriouseats.com" URL) (org-chef-serious-eats-fetch URL))
+ ((org-chef-match-url "reluctantgourmet.com" URL) (org-chef-reluctant-gourmet-fetch URL))
+ ((org-chef-match-url "chefkoch.de" URL) (org-chef-chef-koch-fetch URL))
+ ((org-chef-match-url "steamykitchen.com" URL) (org-chef-steamy-kitchen-fetch URL))
+ ((org-chef-match-url "nytimes.com" URL) (org-chef-nytimes-fetch URL))
+ ((org-chef-match-url "saveur.com" URL) (org-chef-saveur-fetch URL))
+ ((org-chef-match-url "xiachufang.com" URL) (org-chef-xiachufang-fetch URL))
+ ((org-chef-match-url "finecooking.com" URL) (org-chef-fine-cooking-fetch URL))
+ ((org-chef-match-url "taste.com.au" URL) (org-chef-taste-fetch URL))
+ (t nil)))
+
+
+(defun org-chef-fetch-recipe (URL)
+ "Look up a recipe at a URL."
+ (let ((fetched-recipe (org-chef-fetch-recipe-specific-url URL)))
+ (if fetched-recipe
+ fetched-recipe
+ (org-chef-wordpress-fetch URL))))
+
+
+;;;###autoload
+(defun org-chef-insert-recipe (URL)
+ "Prompt for a recipe URL, and then insert the recipe at point."
+ (interactive "sRecipe URL: ")
+ (org-chef-recipe-insert-org (org-chef-fetch-recipe URL)))
+
+
+(defun org-chef-get-recipe-from-url ()
+ "Prompt for a recipe URL, and return the ‘org-mode’ string."
+ (let ((URL (read-string "Recipe URL: ")))
+ (org-chef-recipe-org-string (org-chef-fetch-recipe URL))))
+
+
+(provide 'org-chef)
+;;; org-chef.el ends here
--- /dev/null
+org-chef is a package for managing recipes in org-mode. One of the
+main features is that it can automatically extract recipes from
+websites like allrecipes.com