docs: update docs to add file downloading examples

This commit is contained in:
Karim shoair
2025-11-10 03:02:41 +02:00
parent ff19dd5bf5
commit 026161c8f8
4 changed files with 33 additions and 2 deletions
+11
View File
@@ -131,6 +131,17 @@ page = DynamicFetcher.fetch(
)
```
### Downloading Files
```python
page = DynamicFetcher.fetch('https://raw.githubusercontent.com/D4Vinci/Scrapling/main/images/poster.png')
with open(file='poster.png', mode='wb') as f:
f.write(page.body)
```
The `body` attribute of the `Response` object is a `bytes` object containing the response body in case of Non-HTML responses.
### Browser Automation
This is where your knowledge about [Playwright's Page API](https://playwright.dev/python/docs/api/class-page) comes into play. The function you pass here takes the page object from Playwright's API, performs the desired action, and then the fetcher continues.