-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from monkey-patch-sdk/demo/only-food
Demo/only food
- Loading branch information
Showing
9 changed files
with
136 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import json | ||
import os | ||
|
||
from apify_client import ApifyClient | ||
|
||
# Initialize the ApifyClient with your API token | ||
APIFY_KEY = os.getenv("APIFY_API_KEY") | ||
client = ApifyClient(APIFY_KEY) | ||
|
||
|
||
def yelp_scraper(url: str): | ||
# Prepare the Actor input | ||
run_input = { | ||
"debugLog": False, | ||
"directUrls": [url], | ||
"maxImages": 0, | ||
"proxy": {"useApifyProxy": True, "apifyProxyGroups": ["RESIDENTIAL"]}, | ||
"reviewLimit": 20, | ||
"reviewsLanguage": "ALL", | ||
"scrapeReviewerName": False, | ||
"scrapeReviewerUrl": False, | ||
"searchLimit": 1, | ||
} | ||
|
||
# Run the Actor and wait for it to finish | ||
run = client.actor("yin/yelp-scraper").call(run_input=run_input) | ||
|
||
# Fetch and print Actor results from the run's dataset (if there are any) | ||
items = client.dataset(run["defaultDatasetId"]).get_items_as_bytes() | ||
items = json.loads(items) | ||
|
||
return items |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,6 @@ flake8==6.1.0 | |
black==23.10.0 | ||
mypy==1.6.1 | ||
beautifulsoup4==4.12.2 | ||
apify_client | ||
zenrows | ||
monkey-patch.py |