matteolore/recipe-scrapers
Composer 安装命令:
composer require matteolore/recipe-scrapers
包简介
RecipeScrapers is a PHP library that allows you to scrape and extract recipe information from somes cooking websites.
README 文档
README
RecipeScrapers is a PHP library that allows you to scrape and extract recipe information from somes cooking websites. It provides a simple and unified class to retrieve recipe details such as ingredients, instructions, cooking time, and more. This can be useful for building recipe apps, websites, or data analysis projects.
Installation
You can install RecipeScrapers using Composer:
composer require matteolore/recipe-scrapers
Usage
- First, import
RecipeScrapersclass and create a scraper instance
use RecipeScrapers\RecipeScrapers; $scrapers = new RecipeScrapers();
- Then, call the
getRecipemethod, passing the url parameter, like this
$url = "https://www.example.com/recipe"; $recipe = $scrapers->getRecipe($url); // Returns a Recipe class if the url is correct
- Finally, you can use the Recipe class to access all the available methods, such as
getName,getIngredient, and more...
echo $recipe->getName(); // Returns the recipe name echo $recipe->getIngredients();
Website available
RecipeScrapers currently supports these cooking websites:
Methods available
The Recipe class provides a variety of methods to access different aspects of the scraped recipe data. Here are the available methods:
Recipe class:
getName-> Returns the recipe name.getAuthor-> Returns the author of the recipe.getDescription-> Returns the recipe description.getKeyword-> Returns the keywords associated with the recipe.getIngredients-> Returns an array of all ingredients.getIngredient-> Returns a specific ingredient by its index.getSteps-> Returns an array of all cooking steps.getStep-> Returns a specific cooking step by its index.getRecipeCuisine-> Returns the cuisine of the recipe.getCategory-> Returns the category of the recipe.getTotalTime-> Returns the total time required to prepare and cook the recipe.getCookTime-> Returns the cooking time for the recipe.getPrepTime-> Returns the preparation time for the recipe.getPerformTime-> Returns the performance time for the recipe.getYield-> Returns the yield of the recipe.getRecipeYield-> Returns the recipe yield.getImage-> Returns the URL of the recipe image.getVideo-> Returns a VideoObject class.getDateCreated-> Returns the creation date of the recipe.getDateModified-> Returns the last modification date of the recipe.getDatePublished-> Returns the publication date of the recipe.getSuitableForDiet-> Returns information about dietary suitability.getAggregaterating-> Returns a AggregateRating class.getCookingMethod-> Returns the cooking method used in the recipe.getEstimatedCost-> Returns the estimated cost of the recipe.getNutrition-> Returns nutritional information about the recipe.getTools-> Returns an array of tools required for cooking.getTool-> Returns a specific tool by its index.getSource-> Returns the source of the recipe.getJson-> Returns the raw JSON data of the recipe.getData-> Returns an array containing all the extracted recipe data.
VideoObject class:
getName-> Returns the name of the video.getDescription-> Returns the description of the video.getThumbnailUrl-> Returns the URL of the video's thumbnail image.getContentUrl-> Returns the URL of the video content.getEmbedUrl-> Returns the embed URL for the video.
AggregateRating class:
getRatingValue-> Returns the rating value.getReviewCount-> Returns the total number of reviews.getBestRating-> Returns the best possible rating.getWorstRating-> Returns the worst possible rating.
License
RecipeScrapers is distributed under the GNU General Public License v3.0. See LICENSE for more information.
Happy cooking and coding!
matteolore/recipe-scrapers 适用场景与选型建议
matteolore/recipe-scrapers 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 08 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 matteolore/recipe-scrapers 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 matteolore/recipe-scrapers 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-only
- 更新时间: 2023-08-20