https://github.com/yuis-ice/jseval
Evaluate JavaScript on a URL through headless Chrome browser.
https://github.com/yuis-ice/jseval
browser-automation cli-utilities cmdline command-line commandline-interface data-scraping datascraping eval evaluator headless-browser headless-browsers pupeteer scrapers scrapper scrapping web-browser web-crawling web-scrapping webscrapping website-scraper
Last synced: 3 months ago
JSON representation
Evaluate JavaScript on a URL through headless Chrome browser.
- Host: GitHub
- URL: https://github.com/yuis-ice/jseval
- Owner: yuis-ice
- License: bsd-3-clause
- Created: 2021-06-18T04:34:52.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-06-18T19:17:51.000Z (about 4 years ago)
- Last Synced: 2025-03-25T09:47:33.870Z (3 months ago)
- Topics: browser-automation, cli-utilities, cmdline, command-line, commandline-interface, data-scraping, datascraping, eval, evaluator, headless-browser, headless-browsers, pupeteer, scrapers, scrapper, scrapping, web-browser, web-crawling, web-scrapping, webscrapping, website-scraper
- Language: JavaScript
- Homepage: https://yuis-programming.com/jseval-app
- Size: 2.93 KB
- Stars: 25
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# jseval
Evaluate JavaScript on a URL through headless Chrome browser.
## build
```
docker build -t jseval -f jseval.dockerfile .
```## usage
```
docker run --rm jseval --help
```## quick start
Run:
```
$ docker run --rm jseval --url "https://www.tradingview.com/" --evaluate 'JSON.stringify([document.location.href, document.title])' --headless --output
```stdout would be like:
```
["https://www.tradingview.com/","Free Stock Charts, Stock Quotes and Trade Ideas — TradingView"]
```## examples
- for complicated JS
```sh
docker run jseval \
--url "https://www.tradingview.com/ideas/bitcoin/" \
--evaluate "$(cat <<- EOT
JSON.stringify(
Array.from(
document.querySelectorAll("div.tv-feed-layout__card-item[data-widget-type=\"idea\"] > div > div > a")
)
.map(a => a.href)
.concat(document.location.href)
)
EOT
)" \
--headless \
--output
```## help
```
Usage: jseval [options]Options:
--url set url
--sleep set sleep (default: 0)
--evaluate set script to evaluate
--output output to stdout
--file <file> output to file (default: "")
--headless enables headless (default: false)
--log enables log
-h, --help display help for command
```---
```
todables
just eval js, not console.log as a default
should be like: docker run --rm jseval --url "https://www.tradingview.com/" --evaluate 'console.log(JSON.stringify([document.location.href, document.title]))' --headless --output
should be able to set cookies
```