Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
About
People
Publications
Teaching
Resources
Research Blog
Wiki Functions
Recent changes
Help
Licensing
Page
Discussion
Edit
View history
Editing
SERP Tips
From CommunityData
Jump to:
navigation
,
search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Using the JSON data=== The .7z files from SERP include .json files. They're not "pretty printed" -- they're not nicely formatted, they're collapsed into big long strings. Fortunately there are tools out there to pretty print JSON files. To get a sense for the structure, you can copy the .json text into the box on a tool like [https://jsonformatter.org/json-pretty-print the JSON formatter] and hit the pretty print button for a look at the file in a way that respects the structure created by the symbols. This will let you figure out how to navigate the tree down to the data you want. You can use the ''jq'' tool to quickly navigate the .json and dig out just what you care about. For example, if you are a command-line user and wanted only URLS from a Google results JSON, but you don't want the many places where google links to just itself, with jq plus the magic of standard linux commandline tools you can: cat 'Sat Mar 28 2020 19-12-13 GMT-0500 (Central Daylight Time).json' | jq '.linkElements | .[] | .href' | grep -v google.com | tr -d '"' | sort | uniq > newfile.txt This will: #send the text of the .json file into jq #navigate the tree to just the 'linkElements' list of links #then iterate over each item in the list #select only the 'href' trait (i.e. the URL) from each link in the list #filter out all instances of google.com to remove self-linkage #pull out the pesky quotemarks from the list #sort the list #de-duplicate the list of URLs #save all the output into newfile.txt
Summary:
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see
CommunityData:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:
Cancel
Editing help
(opens in new window)
Tools
What links here
Related changes
Special pages
Page information