Pyscape: Your Best Friend for Using the Mozscape API
Posted by GeoffKenyon
If you do link building and have to pull a lot of metrics from Open Site Explorer, I would like to introduce you to your new best friend, Pyscape. You might use a Google Doc to take advantage of the Mozscape API, but this is better. I promise.
Pyscape, created by fellow Distiller Ben Estes, enables you to pull link data such as an export of more than 10,000 backlinks or look up Moz metrics for a bulk URL list. And it’s super-fast.
What does Pyscape do?
When you use Pyscape, you must choose one of the following operating modes to run:
- Metrics: This will simply show all the Moz metrics associated with the given URL, subdomain, or domain.
- Bulk-metrics: This will show you the Moz metrics for a bulk URL list.
- Anchor: This will give you all the anchors associated with a URL, subdomain, or domain.
- Top: This will return the top pages on a site.
- Links: This gives you a list of links pointing to a URL, subdomain, or domain.
- Ose-style: This will return an Open Site Explorer formatted list of links for a URL, subdomain, or domain.
It is also worth noting that Pyscape does not cut off your reports at 10,000 URLs, and it can be much faster than using the Open Site Explorer Interface — especially for sites with large link profiles.
Selecting Your Granularity
In addition to telling Pyscape which report you want to run, you need to give it a little more guidance. This is especially important because Pyscape will pick an intelligent set of fields to grab from Mozscape based on the options you specify. Start by telling Pyscape how it should interpret the URL(s) that you input:
- -d (domain): interprets the URL(s) as domains only
- -s (subdomain): interprets the URL(s) as subdomains only
- -p (page): interprets the URL(s) as the specific pages only
Links Mode
If you are in the links operating mode, here are a few more commands you should know:
- -o (one): will return one URL per linking domain in links mode
- -m (many): will return up to 25 pages per linking domain in link mode (this is the default)
Anchor Mode
Finally, there are a couple more directives you should know if you are going to use the anchor mode:
- -f (phrase): will return anchor text phrases
- -t (term): will return term matches (default)
Setting Up Pyscape
So now that we’ve covered what Pyscape will do, let’s look at how we use it. The following steps will take you through setting up Pyscape.
- Go to the Pyscape homepage; download the zip file and then extract it.
- Enter your Mozcape API credentials (free or paid) in the keys.json file. Get your credentials here.
- Download and install Python, version 3.2 or above (download here).
- Go give Pyscape an upvote on inbound.org to say thank you to Ben, or follow him on twitter.
Running Your First Pyscape Report
Ok, now that we’ve got Pyscape installed, I’m going to take you through how to run reports using the command line (It sounds technical but it’s really pretty easy).
- Start up the “Command Prompt” application.
- Next you’ll need to change the directory that the application is operating in to the directory where you have extracted Pyscape. “Enter “CD” followed by the folder path leading to the extracted Pyscape directory and hit enter.
- Now enter your request. Below are some sample requests that show how requests need to be structured.
Entering these commands will give you the data you need to start your analysis in a nice .csv output in lightning-fast time. This Google Doc contains examples of the output data from Pyscape to help you get a feel for which reports will best work for you.
The rest is up to you! If you like the tool, make sure to say thanks to Ben and to vote it up on inbound.org!
Sign up for The Moz Top 10, a semimonthly mailer updating you on the top ten hottest pieces of SEO news, tips, and rad links uncovered by the Moz team. Think of it as your exclusive digest of stuff you don’t have time to hunt down but want to read!
Continue reading →