https://github.com/aprilahijriyan/selenium-fetch
A simple module that lets you access the fetch API with selenium!
https://github.com/aprilahijriyan/selenium-fetch
cloudflare fetch selenium undetected-chromedriver
Last synced: 7 months ago
JSON representation
A simple module that lets you access the fetch API with selenium!
- Host: GitHub
- URL: https://github.com/aprilahijriyan/selenium-fetch
- Owner: aprilahijriyan
- License: mit
- Created: 2023-03-09T17:08:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-09T23:46:51.000Z (over 2 years ago)
- Last Synced: 2025-02-28T23:52:18.960Z (7 months ago)
- Topics: cloudflare, fetch, selenium, undetected-chromedriver
- Language: Python
- Homepage:
- Size: 26.4 KB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# selenium-fetch
A simple module that lets you access the `fetch` API with selenium!
> _Why do I make this? just annoyed with cloudflare. It works best with [undetected-chromedriver](https://github.com/ultrafunkamsterdam/undetected-chromedriver)._
## Installation
```
pip install selenium-fetch undetected-chromedriver
```## Example
```python
from undetected_chromedriver import Chrome
from selenium_fetch import fetch, Options, get_browser_user_agentLOGIN_PAGE_URL = "https://smekdong.com/login"
LOGIN_API_URL = "https://smekdong.com/api/login"
driver = Chrome(headless=False)
driver.get(LOGIN_PAGE_URL)
post_data = {
'username': 'blaabla',
'password': 'xxxx'
}
headers = {
"user-agent": get_browser_user_agent(driver),
'origin': 'https://smekdong.com',
'referer': 'https://smekdong.com/',
}
options = Options(method="POST", headers=headers, body=post_data)
response = fetch(driver, LOGIN_API_URL, options)
print("Response:", response)
```