Active Forums => Programs => Topic started by: SpriggsySpriggs on July 25, 2020, 03:11:06 pm
Title: Grab screenshot of any webpage using online API
Post by: SpriggsySpriggs on July 25, 2020, 03:11:06 pm
You may want to show a screenshot of a website in your programs (for whatever reason). This will allow you to do so: Go to https://screenshotlayer.com/ (https://screenshotlayer.com/) and make a free account. Run the attached exe to see a demo but don't run it 100 times as it has my API key in it.
[ This attachment cannot be displayed inline in 'Print Page' view ]
Use the below code with your API key to grab the screenshot:
Title: Re: Grab screenshot of any webpage using online API
Post by: Richard Frost on July 25, 2020, 03:58:46 pm
_SCREENIMAGE works for me, and it'd be easy to write a program to size/move a box to capture a portion.
Why make it more complicated by calling external programs?
Title: Re: Grab screenshot of any webpage using online API
Post by: FellippeHeitor on July 25, 2020, 04:04:21 pm
To use _SCREENIMAGE to capture a screenshot of a website means you'll have to call an external program - your preferred browser in this case.
With Spriggsy's method you'd be using screenshotlayer.com's API to do that job for ya. If I understood the post above correctly, the exe he's providing is merely the code in the codebox compiled with his API key in it, which allows one to run the example without having to create an account with the website unless they'd want to.
Title: Re: Grab screenshot of any webpage using online API
Post by: SpriggsySpriggs on July 25, 2020, 04:13:11 pm
@Richard Frost Precisely what Fellippe was saying. My exe is just using the code in the post with my API key already in it.
Title: Re: Grab screenshot of any webpage using online API
Post by: FellippeHeitor on July 25, 2020, 04:20:28 pm
BTW, Spriggsy, you may wanna store your key in a more concealed way within your exe. I'm sending you a private message with it - just as a proof of concept.
All literal strings/data within an EXE are stored as literals within the exe itself - the resources section of it.
I'd do something like this to generate a string of sensitive data - and still no warranties it can't be retrieved:
Then when you use that in your code, it'll be stored in a much "safer" way.
Our friends in this forum sure will have even more clever ways to suggest (I'm also looking forward to new ideas on this).
Title: Re: Grab screenshot of any webpage using online API
Post by: SpriggsySpriggs on July 25, 2020, 04:32:04 pm
@FellippeHeitor I wasn't too worried about it. Most of these APIs I won't be using much anyways. They're mostly for proof of concept. I'm not going to be too heartbroken if someone steals them and uses them. I can always make a new account or get a new API key if it gets leaked. No issue.
Title: Re: Grab screenshot of any webpage using online API
Post by: Richard Frost on July 25, 2020, 10:39:54 pm
I've captured screenshots of websites using _SCREENIMAGE after _SCREENHIDE, although of course the browser was already running.
Having read the code, now I see the difference. You capture the image without "going there" with a browser. So you could automate all sorts of things, like getting just the current temperature from a weather site - until the site changes the location on the screen!
Your APIs are very interesting, and advanced.
Title: Re: Grab screenshot of any webpage using online API
Post by: SpriggsySpriggs on July 26, 2020, 02:45:33 pm