docs: Add "Run on Apify" button - #1127
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates several code examples to enhance the Apify integration by adding “Run on Apify” buttons and streamlining example code. Key changes include:
- Reformatting import statements to use multi-line grouping.
- Removing standalone asyncio.run invocation blocks from most examples.
- Adjusting crawler initialization parameters in selected examples.
- Updating documentation in CONTRIBUTING.md for clarity and consistency.
Reviewed Changes
Copilot reviewed 132 out of 135 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docs/examples/code_examples/crawl_website_with_relative_links_all_links.py | Reformatted imports and removed the asyncio.run(main()) block. |
| docs/examples/code_examples/crawl_specific_links_on_website_pw.py | Removed the asyncio.run(main()) block. |
| docs/examples/code_examples/crawl_specific_links_on_website_bs.py | Reformatted imports and removed the asyncio.run(main()) block. |
| docs/examples/code_examples/crawl_multiple_urls_pw.py | Removed the asyncio.run(main()) block. |
| docs/examples/code_examples/crawl_multiple_urls_bs.py | Reformatted imports and removed the asyncio.run(main()) block. |
| docs/examples/code_examples/crawl_all_links_on_website_pw.py | Removed the asyncio.run(main()) block. |
| docs/examples/code_examples/crawl_all_links_on_website_bs.py | Reformatted imports and removed the asyncio.run(main()) block. |
| docs/examples/code_examples/configure_json_logging.py | Removed the asyncio.run(main()) block. |
| docs/examples/code_examples/capture_screenshot_using_playwright.py | Removed the asyncio.run(main()) block. |
| docs/examples/code_examples/beautifulsoup_crawler_stop.py | Reformatted imports and removed the asyncio.run(main()) block. |
| docs/examples/code_examples/beautifulsoup_crawler_keep_alive.py | Removed the asyncio.run(main()) block. |
| docs/examples/code_examples/beautifulsoup_crawler.py | Removed the asyncio.run(main()) block and reformatted imports. |
| docs/examples/code_examples/add_data_to_dataset_pw.py | Removed the asyncio.run(main()) block. |
| docs/examples/code_examples/add_data_to_dataset_bs.py | Reformatted imports and removed the asyncio.run(main()) block. |
| docs/examples/code_examples/adaptive_playwright_crawler.py | Increased the max_requests_per_crawl value and removed the asyncio.run(main()) block. |
| docs/deployment/code_examples/apify/crawler_as_actor_example.py | Reformatted imports and lowered the max_requests_per_crawl value. |
| CONTRIBUTING.md | Updated guidelines and instructions for API documentation and local documentation setup. |
Files not reviewed (3)
- docs/examples/add_data_to_dataset.mdx: Language not supported
- docs/examples/beautifulsoup_crawler.mdx: Language not supported
- docs/examples/capture_screenshot_using_playwright.mdx: Language not supported
Comments suppressed due to low confidence (2)
docs/examples/code_examples/adaptive_playwright_crawler.py:16
- The max_requests_per_crawl value was increased from 5 to 10; please confirm that this change is intentional as it may impact crawler concurrency and resource usage.
max_requests_per_crawl=10, playwright_crawler_specific_kwargs={'headless': False}
docs/deployment/code_examples/apify/crawler_as_actor_example.py:12
- The max_requests_per_crawl value was decreased from 50 to 10; please verify that this adjustment aligns with the expected behavior for Actor-based execution.
crawler = BeautifulSoupCrawler(max_requests_per_crawl=10)
vdusek
marked this pull request as ready for review
April 2, 2025 16:19
Pijukatel
approved these changes
Apr 3, 2025
Pijukatel
left a comment
Collaborator
There was a problem hiding this comment.
Nice, just 2 tiny details.
This was referenced Apr 3, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
asyncio.runcalls to reduce noise (the example code runner on Apify executes the main coroutine).crawler.runor some explicit interactions with storages). Initialization examples do not include these buttons.max_requests_per_crawlto10everywhere (I believe 10 is enough to demonstrate what the sample does).Example
Issues
Testing
Checklist