docs: use a better import to reflect the new changes
This commit is contained in:
@@ -118,7 +118,7 @@ Deep SerpApi is a dedicated search engine designed for large language models (LL
|
|||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from scrapling import Fetcher
|
from scrapling.fetchers import Fetcher
|
||||||
|
|
||||||
fetcher = Fetcher(auto_match=False)
|
fetcher = Fetcher(auto_match=False)
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ Fetchers are interfaces built on top of other libraries with added features that
|
|||||||
### Features
|
### Features
|
||||||
You might be slightly confused by now so let me clear things up. All fetcher-type classes are imported in the same way
|
You might be slightly confused by now so let me clear things up. All fetcher-type classes are imported in the same way
|
||||||
```python
|
```python
|
||||||
from scrapling import Fetcher, StealthyFetcher, PlayWrightFetcher
|
from scrapling.fetchers import Fetcher, StealthyFetcher, PlayWrightFetcher
|
||||||
```
|
```
|
||||||
All of them can take these initialization arguments: `auto_match`, `huge_tree`, `keep_comments`, `keep_cdata`, `storage`, and `storage_args`, which are the same ones you give to the `Adaptor` class.
|
All of them can take these initialization arguments: `auto_match`, `huge_tree`, `keep_comments`, `keep_cdata`, `storage`, and `storage_args`, which are the same ones you give to the `Adaptor` class.
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ You can route all traffic (HTTP and HTTPS) to a proxy for any of these methods i
|
|||||||
```
|
```
|
||||||
For Async requests, you will just replace the import like below:
|
For Async requests, you will just replace the import like below:
|
||||||
```python
|
```python
|
||||||
>> from scrapling import AsyncFetcher
|
>> from scrapling.fetchers import AsyncFetcher
|
||||||
>> page = await AsyncFetcher().get('https://httpbin.org/get', stealthy_headers=True, follow_redirects=True)
|
>> page = await AsyncFetcher().get('https://httpbin.org/get', stealthy_headers=True, follow_redirects=True)
|
||||||
>> page = await AsyncFetcher().post('https://httpbin.org/post', data={'key': 'value'}, proxy='http://username:password@localhost:8030')
|
>> page = await AsyncFetcher().post('https://httpbin.org/post', data={'key': 'value'}, proxy='http://username:password@localhost:8030')
|
||||||
>> page = await AsyncFetcher().put('https://httpbin.org/put', data={'key': 'value'})
|
>> page = await AsyncFetcher().put('https://httpbin.org/put', data={'key': 'value'})
|
||||||
@@ -486,7 +486,7 @@ When website owners implement structural changes like
|
|||||||
The selector will no longer function and your code needs maintenance. That's where Scrapling's auto-matching feature comes into play.
|
The selector will no longer function and your code needs maintenance. That's where Scrapling's auto-matching feature comes into play.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from scrapling import Adaptor
|
from scrapling.parser import Adaptor
|
||||||
# Before the change
|
# Before the change
|
||||||
page = Adaptor(page_source, url='example.com')
|
page = Adaptor(page_source, url='example.com')
|
||||||
element = page.css('#p1' auto_save=True)
|
element = page.css('#p1' auto_save=True)
|
||||||
@@ -504,7 +504,7 @@ To solve this issue, I will use [The Web Archive](https://archive.org/)'s [Wayba
|
|||||||
If I want to extract the Questions button from the old design I can use a selector like this `#hmenus > div:nth-child(1) > ul > li:nth-child(1) > a` This selector is too specific because it was generated by Google Chrome.
|
If I want to extract the Questions button from the old design I can use a selector like this `#hmenus > div:nth-child(1) > ul > li:nth-child(1) > a` This selector is too specific because it was generated by Google Chrome.
|
||||||
Now let's test the same selector in both versions
|
Now let's test the same selector in both versions
|
||||||
```python
|
```python
|
||||||
>> from scrapling import Fetcher
|
>> from scrapling.fetchers import Fetcher
|
||||||
>> selector = '#hmenus > div:nth-child(1) > ul > li:nth-child(1) > a'
|
>> selector = '#hmenus > div:nth-child(1) > ul > li:nth-child(1) > a'
|
||||||
>> old_url = "https://web.archive.org/web/20100102003420/http://stackoverflow.com/"
|
>> old_url = "https://web.archive.org/web/20100102003420/http://stackoverflow.com/"
|
||||||
>> new_url = "https://stackoverflow.com/"
|
>> new_url = "https://stackoverflow.com/"
|
||||||
@@ -565,7 +565,7 @@ Note: The filtering process always starts from the first filter it finds in the
|
|||||||
Examples to clear any confusion :)
|
Examples to clear any confusion :)
|
||||||
|
|
||||||
```python
|
```python
|
||||||
>> from scrapling import Fetcher
|
>> from scrapling.fetchers import Fetcher
|
||||||
>> page = Fetcher().get('https://quotes.toscrape.com/')
|
>> page = Fetcher().get('https://quotes.toscrape.com/')
|
||||||
# Find all elements with tag name `div`.
|
# Find all elements with tag name `div`.
|
||||||
>> page.find_all('div')
|
>> page.find_all('div')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
### All current types can be imported alone like below
|
### All current types can be imported alone like below
|
||||||
```python
|
```python
|
||||||
>>> from scrapling import TextHandler, AttributesHandler
|
>>> from scrapling.core.custom_types import TextHandler, AttributesHandler
|
||||||
|
|
||||||
>>> somestring = TextHandler('{}')
|
>>> somestring = TextHandler('{}')
|
||||||
>>> somestring.json()
|
>>> somestring.json()
|
||||||
|
|||||||
Reference in New Issue
Block a user