shot-scraper is a free command line tool to take automated website screenshots. It allows you to take screenshots of websites right from the command line in different ways. You can take a full-page website screenshot. And while taking a screenshot, you can specify a frame width and height in case you want to take screenshot of a website in mobile view. It comes with various other options that you can supply in the CLI to take screenshot of a website.
With shot-scraper, you can take screenshots of static as well dynamic websites. It lets you set a delay for taking screenshot after a page has been loaded successfully. But the best part is that it will also let you take screenshot of websites that require authentication. You just need to use a credentials file during the screenshot process and then it will take care of the rest. Other than this, there is an option to scrape a webpage by injecting JavaScript in it.
You may have used some other screenshot tools to take bulk webpage screenshots, but this one here is very powerful. You can deploy it on a server and automate webpage screenshots in easy way. It saves the screenshots as PNG images but you can also save them in PDF format as well if you like. As a developer, if you are familiar with GitHub actions then you can deploy it there as well to take screenshots and save them in GitHub repositories.
Installing and using shot-scraper to take webpage screenshots
shot-scrape needs Python installed in order to work. Besides that, you will need some other dependencies but those are automatically installed here. I will suggest you to install and use it in a Python Virtual environment.
So, go to a blank folder and then open a CMD or PowerShell window in it. Type the following command to initiate a virtual environment in it.
python -m venv .
Now, it is time to activate the environment. Use the command below to activate it.
./Scripts/activate
Now, you are ready to install shot-scraper. Run the following commands one after other in the terminal and then wait for it to finish.
pip install shot-scraper
shot-scraper install
After the installation process finishes, you can start using the tool. The very basic command to take a website screenshot is this.
shot-scraper Website -o NameOfImage
Taking Screenshot with custom height and width.
shot-scraper Website -o NameofImage --width Width --height Height
If you want to take a screenshot after some time, that is you want to delay then you run this command. It will wait for the specified seconds when the time runs out, it will simply take the screenshot and will save the final file.
shot-scraper Website --wait Milliseconds
Next good option is saving the website screenshot in PDF format. To do that, you just need to run the command in this way. It will take screenshot of the website and will save it as PDF. This is as simple as that.
shot-scraper pdf Website
Apart from screenshot generation, there are additional scraping options are available in this tool. You can discover them on the GitHub. Or, you can also go through the official documentation to learn about the more command line options in more details.
Closing thoughts:
Even though, you can use Chrome itself to take website screenshots, it is not really a viable option to be used as programmatically. There are many tools to do it, there are not so many tools to do it efficiently and in bulk. I am really amazed by shot-scraper’s ability to quickly take full page website screenshots and the extra CLI options and functionalities that it offers make it easy to be used by individuals as well as programmers. So, if you often have to website screenshots then you can give it a try and let me know what you think about it.