Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to Mob scraper #1198

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions recipe_scrapers/mob.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json

from ._abstract import AbstractScraper
from ._exceptions import StaticValueException
from ._grouping_utils import IngredientGroup


Expand All @@ -17,9 +16,6 @@ def __init__(self, *args, **kwargs):
def host(cls):
return "mob.co.uk"

def site_name(self):
raise StaticValueException(return_value="Mob")

def author(self):
chefs = self.recipe_json.get("chefs", [])
return " & ".join([chef["title"] for chef in chefs]) if chefs else "Mob Team"
Expand Down Expand Up @@ -88,4 +84,4 @@ def description(self):
return self.recipe_json.get("summary", "")

def ratings(self):
return self.recipe_json.get("averageRating", "")
return round(float(self.recipe_json.get("averageRating", "0")), 2)
17 changes: 3 additions & 14 deletions tests/test_data/mob.co.uk/mob_1.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"author": "Mob Team",
"author": "Seema Pankhania",
"canonical_url": "https://www.mob.co.uk/recipes/chilli-cheese-paratha",
"site_name": "Mob",
"host": "mob.co.uk",
Expand Down Expand Up @@ -54,17 +54,6 @@
"description": "This Indian snack is oozing with molten cheese and chilli garlicky goodness. They will be demolished in seconds, I can promise you that. Seema x",
"total_time": 30,
"cuisine": "Indian",
"ratings": "4.647",
"nutrients": {
"servingSize": "4"
},
"image": "https://files.mob-cdn.co.uk/recipes/9K8A6392-2.jpg",
"keywords": [
"chilli cheese paratha",
"indian cheese paratha",
"indian paratha recipe",
"cheese paratha recipe",
"chilli cheese paratha recipe",
"cheesy paratha recipe"
]
"ratings": 4.65,
"image": "https://files.mob-cdn.co.uk/recipes/2023/11/Chilli-Cheese-Paratha.jpg"
}
7 changes: 4 additions & 3 deletions tests/test_data/mob.co.uk/mob_1.testhtml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/test_data/mob.co.uk/mob_2.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"author": "Christina Soteriou",
"canonical_url": "mob.co.uk",
"canonical_url": "https://www.mob.co.uk/recipes/speedy-udon-miso-noodle-soup",
"site_name": "Mob",
"host": "mob.co.uk",
"language": "en",
Expand Down Expand Up @@ -34,6 +34,6 @@
"description": "This noodle soup is a testament to a well-stocked cupboard. All you need is a handful of long life staples to throw this nutritious and delicious meal together.",
"total_time": 15,
"cuisine": "Asian-Inspired",
"ratings": "4.125",
"ratings": 4.47,
"image": "https://files.mob-cdn.co.uk/recipes/2023/09/Speedy-Udon-Miso-Noodle-Soup.jpg"
}
6 changes: 3 additions & 3 deletions tests/test_data/mob.co.uk/mob_2.testhtml

Large diffs are not rendered by default.

Loading