Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this to fetch a price from Marketwatch #2

Closed
a3igner opened this issue Mar 31, 2020 · 1 comment
Closed

How to use this to fetch a price from Marketwatch #2

a3igner opened this issue Mar 31, 2020 · 1 comment

Comments

@a3igner
Copy link

a3igner commented Mar 31, 2020

I want to fetch the price of this

https://www.marketwatch.com/investing/future/sp%20500%20futures

seems selector is bg-quote and data-last-raw

but i can't get it to work. can you show me how its done?

tx

@moos
Copy link
Owner

moos commented Apr 18, 2020

So from the browser's console, this selector works:

> $$('div.intraday__data span.value')[0].innerHTML
"2,869.00"

But when I run quget from the command-line:

 quget.cmd https://www.marketwatch.com/investing/future/sp%20500%20futures "body"

I get " As you were browsing www.marketwatch.com something about your browser made us think you were a bot." So it thinks I'm a bot and asks for a CAPTCHA. You can use the --request-options to modify the headers, e.g.:

 quget.cmd https://www.marketwatch.com/investing/future/sp%20500%20futures --request-options "headers:{\"User-Agent\":\"Mozilla Chrome/80.0.3987.149 Safari/537.36\"}" "div.intraday__data span.value"
2,869.00

@moos moos closed this as completed Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants