This get2json
command-line tool mainly output the header information as Json format when input URLs.
get
command: Be able to output header information by inputting one or multiple URLs.
Sample URLs for input
http://www.bbc.co.uk/iplayer
http://checkip.amazonaws.com
https://www.bbc.co.uk/missing/thing
https://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Juvenile_Ragdoll.jpg/220px-Juvenile_Ragdoll.jpg
https://site.mockito.org/
Required
- Install docker
Step1: Pull docker image(borischen0203/get2json)
docker pull borischen0203/get2json
Step2: Run docker image as below command
docker run -it --rm borischen0203/get2json get
or
docker run -v <file path>:<file path> -it --rm borischen0203/get2json get <file path>
# Display the output header info when input URLs list
$ docker run -it --rm borischen0203/get2json get
$ Please enter URLs:
$ http://www.bbc.co.uk/iplayer
$ http://checkip.amazonaws.com
$ q #<--type[q + enter key] to quit input and run
$ Result:
{
"Url": "http://www.bbc.co.uk/iplayer",
"Status-Code": 301,
"Content-Length": 169
}
{
"Url": "http://checkip.amazonaws.com",
"Status-Code": 200,
"Content-Length": 15
}
# Display the output header info by input file path
$ docker run -v /Users/boris/Desktop/input.txt:/Users/boris/Desktop/input.txt -it --rm get2json get /Users/boris/Desktop/input.txt
$ Result:
{
"Url": "http://www.bbc.co.uk/iplayer",
"Status-Code": 301,
"Content-Length": 169
}
{
"Url": "http://checkip.amazonaws.com",
"Status-Code": 200,
"Content-Length": 15
}
Required
- Install go(version >= 1.7)
- Install
make
cli(https://formulae.brew.sh/formula/make)
brew install make
Step1: Clone the repo
git clone https://github.com/borischen0203/Get2Json.git
Step2: Use make
to execute makefile run test and build
make all
Step3: Execute build file with get command
./bin/get2json get
or
./bin/get2json get <file path>
# Display the output header info when input URLs list
$ ./bin/get2json get
$ Please enter URLs:
$ http://www.bbc.co.uk/iplayer
$ http://checkip.amazonaws.com
$ q #<--type[q + enter key] to quit input and run
$ Result:
{
"Url": "http://www.bbc.co.uk/iplayer",
"Status-Code": 301,
"Content-Length": 169
}
{
"Url": "http://checkip.amazonaws.com",
"Status-Code": 200,
"Content-Length": 15
}
# Display the output header info by file path
$ ./bin/get2json get /Users/boris/Desktop/input.txt
$ Result:
{
"Url": "http://www.bbc.co.uk/iplayer",
"Status-Code": 301,
"Content-Length": 169
}
{
"Url": "http://checkip.amazonaws.com",
"Status-Code": 200,
"Content-Length": 15
}
- Golang
- Cobra
- Docker
- make
- Github actions
- shell
- go Concurrency(WaitGroup)
- Be able to input file path.
- Be able to output json file.