Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build passing #37

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e3af4bc
Update http.go
abzcoding Aug 19, 2020
144e418
Update main.go
abzcoding Aug 19, 2020
8575ef8
Update http.go
abzcoding Aug 19, 2020
64314c8
Update http.go
abzcoding Aug 19, 2020
4eea90b
Update http.go
abzcoding Aug 19, 2020
9accef4
Update main.go
abzcoding Aug 19, 2020
37964d7
Update http.go
abzcoding Aug 19, 2020
2a1c3d6
Update http.go
abzcoding Aug 19, 2020
1115cd8
Update http.go
abzcoding Aug 19, 2020
7fb70cd
Update README.md
abzcoding Aug 19, 2020
0d1561a
Merge pull request #1 from abzcoding/socks5-proxy
abzcoding Aug 19, 2020
5ed3d64
Update README.md
abzcoding Aug 19, 2020
81d344f
Update README.md
abzcoding Aug 19, 2020
bcc3af9
Update README.md
abzcoding Aug 19, 2020
24607c6
Update README.md
abzcoding Aug 19, 2020
f0a12d8
Update http.go
abzcoding Aug 19, 2020
756bfcb
Update http_test.go
abzcoding Aug 19, 2020
b42e4fa
Update joiner.go
abzcoding Aug 19, 2020
089aeb7
Update main.go
abzcoding Aug 19, 2020
fe6883d
Update state.go
abzcoding Aug 19, 2020
75d2ad7
Merge pull request #3 from abzcoding/performance
abzcoding Aug 19, 2020
327fc8b
Update Makefile
abzcoding Aug 30, 2020
b5c791b
Update main.go
abzcoding Aug 30, 2020
4dcdf00
Merge pull request #4 from abzcoding/file-list
abzcoding Aug 30, 2020
69c59b2
Update README.md
abzcoding Aug 30, 2020
44e2abc
Update README.md
abzcoding Aug 30, 2020
9aade6b
added bandwidth limiting to hget
Sep 10, 2020
5d3852b
Merge pull request #5 from abzcoding/bw-limit
abzcoding Sep 10, 2020
326db66
Update README.md
abzcoding Sep 10, 2020
0208775
Update .travis.yml
abzcoding Sep 10, 2020
dd774a7
Update README.md
abzcoding Sep 10, 2020
ceb836b
fixed build issue
abzcoding Jun 15, 2021
fae557f
Update README.md
abzcoding Jun 21, 2021
7d0c6fb
Update README.md
abzcoding Jun 21, 2021
c22b586
Update README.md
abzcoding Jun 21, 2021
264c222
removed unused returns
abzcoding Jun 21, 2021
c2f9688
cleaned up the code a bit
abzcoding Jun 21, 2021
f94c9e3
cleaned up the code a bit
abzcoding Jun 21, 2021
f6e4d04
cleaned up the code a bit
abzcoding Jun 21, 2021
7953a7a
Update README.md
abzcoding Jun 21, 2021
ff8e088
Update README.md
abzcoding Dec 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
sudo: false
language: go
go:
- 1.6.2
- 1.15.1
- tip
script:
- make clean install
- go test
- go test
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ deps:
go get -d github.com/fatih/color
go get -d gopkg.in/cheggaaa/pb.v1
go get -d github.com/mattn/go-isatty
go get -d github.com/imkira/go-task
go get -d github.com/fujiwara/shapeio
go get -d github.com/alecthomas/units

clean:
@echo "====> Remove installed binary"
rm -f bin/hget

install: deps
build: deps
@echo "====> Build hget in ./bin "
go build -ldflags "-X main.GitCommit=\"$(COMMIT)\"" -o bin/hget

install: build
@echo "====> Installing hget in /usr/local/bin/hget"
chmod +x ./bin/hget
sudo mv ./bin/hget /usr/local/bin/hget
56 changes: 43 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,58 @@
# hget
This project is my personal project to learn golang to build something useful.
[![Build Status](https://travis-ci.com/abzcoding/hget.svg?branch=master)](https://travis-ci.com/abzcoding/hget)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/abzcoding/hget/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/abzcoding/hget/?branch=master)
[![Maintainability](https://api.codeclimate.com/v1/badges/936e2aacab5946478295/maintainability)](https://codeclimate.com/github/abzcoding/hget/maintainability)
[![Codebeat](https://codebeat.co/badges/ea357ae8-4d84-4599-bff7-cffc4f28fd67)](https://codebeat.co/projects/github-com-abzcoding-hget-master)

# hget
![](https://i.gyazo.com/641166ab79e196e35d1a0ef3f9befd80.png)

### Features
- Fast (multithreading & stuff)
- Ability to interrupt/resume (task mangement)
- Support for proxies( socks5 or http)
- Bandwidth limiting
- You can give it a file that contains list of urls to download

### Install

**Build Status**: [![Build Status](https://travis-ci.org/huydx/hget.svg?branch=master)](https://travis-ci.org/huydx/hget)

## Install

```
$ go get -d github.com/huydx/hget
$ cd $GOPATH/src/github.com/huydx/hget
```bash
$ go get -d github.com/abzcoding/hget
$ cd $GOPATH/src/github.com/abzcoding/hget
$ make clean install
```

Binary file will be built at ./bin/hget, you can copy to /usr/bin or /usr/local/bin and even `alias wget hget` to replace wget totally :P

## Usage
### Usage

```bash
hget [-n parallel] [-skip-tls false] [-rate bwRate] [-proxy proxy_server] [-file filename] [URL] # to download url, with n connections, and not skip tls certificate
hget tasks # get interrupted tasks
hget resume [TaskName | URL] # to resume task
hget -proxy "127.0.0.1:12345" URL # to download using socks5 proxy
hget -proxy "http://sample-proxy.com:8080" URL # to download using http proxy
hget -file sample.txt # to download a list of urls
hget -n 4 -rate 100KB URL # to download using 4 threads & limited to 100KB per second
```

### Help
```
hget [Url] [-n parallel] [-skip-tls false] //to download url, with n connections, and not skip tls certificate
hget tasks //get interrupted tasks
hget resume [TaskName | URL] //to resume task
[I] ➜ hget -h
Usage of hget:
-file string
filepath that contains links in each line
-n int
connection (default 16)
-proxy string
proxy for downloading, ex
-proxy '127.0.0.1:12345' for socks5 proxy
-proxy 'http://proxy.com:8080' for http proxy
-rate string
bandwidth limit to use while downloading, ex
-rate 10kB
-rate 10MiB
-skip-tls
skip verify certificate for https (default true)
```

To interrupt any on-downloading process, just ctrl-c or ctrl-d at the middle of the download, hget will safely save your data and you will be able to resume later
Expand Down
15 changes: 15 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module github.com/abzcoding/hget

go 1.16

require (
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15
github.com/fatih/color v1.12.0
github.com/fujiwara/shapeio v1.0.0
github.com/imkira/go-task v1.0.0
github.com/mattn/go-colorable v0.1.8
github.com/mattn/go-isatty v0.0.13
github.com/mattn/go-runewidth v0.0.13 // indirect
golang.org/x/net v0.0.0-20210614182718-04defd469f4e
gopkg.in/cheggaaa/pb.v1 v1.0.28
)
43 changes: 43 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15 h1:AUNCr9CiJuwrRYS3XieqF+Z9B9gNxo/eANAJCF2eiN4=
github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc=
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fujiwara/shapeio v1.0.0 h1:xG5D9oNqCSUUbryZ/jQV3cqe1v2suEjwPIcEg1gKM8M=
github.com/fujiwara/shapeio v1.0.0/go.mod h1:LmEmu6L/8jetyj1oewewFb7bZCNRwE7wLCUNzDLaLVA=
github.com/imkira/go-task v1.0.0 h1:r8RN5nLcmVpYf/UB28d1w4XApVxDntWLAsiExNIptsY=
github.com/imkira/go-task v1.0.0/go.mod h1:xU9xcPxKeBOQTwx8ILmT8xLxrm/SFmyBhPO8SlCRyRI=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE=
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk=
gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Loading