https://github.com/kkdai/photomgr
A photo download package for gomobile in Golang
https://github.com/kkdai/photomgr
golang photos ptt
Last synced: 5 months ago
JSON representation
A photo download package for gomobile in Golang
- Host: GitHub
- URL: https://github.com/kkdai/photomgr
- Owner: kkdai
- License: mit
- Created: 2015-11-20T04:45:29.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2025-02-11T06:37:53.000Z (8 months ago)
- Last Synced: 2025-04-19T20:17:10.225Z (6 months ago)
- Topics: golang, photos, ptt
- Language: Go
- Size: 268 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
photomgr: A photo crawler manager for gomobile usage in Golang
======================
[](https://raw.githubusercontent.com/kkdai/photomgr/master/LICENSE) [](https://godoc.org/github.com/kkdai/photomgr)[](https://github.com/kkdai/photomgr/actions/workflows/go.yml)A photomgr is a Go package to browse some info (such as PTT/CK101.. more) and download image if any default image in that article. This tool help you to download those photos for your backup, all the photos still own by original creator.
Install
--------------go get github.com/kkdai/photomgr
Usage
---------------------refer `cmd/ptt_cli` or `cmd/ck101_cli` for more detail.
```go
ptt := NewPTT()//Set path for download image
ptt.BaseDir = "YOURPATH"pageIndex := 0
totalPostCount := ptt.ParsePttPageByIndex(pageIndex)
//iterator this sample
for i := 0; i < totalPostCount ; i_++ {
title := p.GetPostTitleByIndex(i)
likeCount := p.GetPostStarByIndex(i)
fmt.Printf("%d:[%dā ]%s\n", i, likeCount, title)
//download image
url := p.GetPostUrlByIndex(i)
p.Crawler(url, 25)
}```
If you want to run it directly, just run
### PTT CLI
```
go install github.com/kkdai/photomgr/cmd/ptt_cli
```### CK101 CLI
```
go install github.com/kkdai/photomgr/cmd/ck101_cli
```Refer [iloveptt](https://github.com/kkdai/iloveptt) for detail commands.
Gomobile supported
--------------To let your package support [gomobile](https://godoc.org/golang.org/x/mobile/cmd/gomobile), need note as follow:
- Only support `string`, `int` (no slice and array)
- Need a constructor for your structure such as `NewYOUROBJ() *YOUROBJ`.
How to build this package in iOS using Gomobile
---------------Here is howto to teach you how to use this in iOS.
```
//Get gomobile and init it
//It might take some time
go get golang.org/x/mobile/cmd/gomobile
gomobile init//Get this package and build package for iOS
go get github.com/kkdai/photomgr
gomobile bind -target=ios github.com/kkdai/photomgr//It will generate a photomgr.framework in your cd $GOPATH/src/github.com/kkdai/photomgr
//Drag photomgr.framework in your xcode project
```
for more detail, check my iOS project [PhotoViewer](https://github.com/kkdai/PhotoViewer)TODO
---------------- [x] PTT
- [x] gomobile refine
- [x] download image
- [x] CK101
- [x] broad travaeral
- [x] download image
- [ ] Timliao
- [ ] broad travaeral
- [ ] download image
- [ ] Gigacircle
- [ ] broad travaeral
- [ ] download imageContribute
---------------Please open up an issue on GitHub before you put a lot efforts on pull request.
The code submitting to PR must be filtered with `gofmt`Project52
---------------It is one of my [project 52](https://github.com/kkdai/project52).
License
---------------This package is licensed under MIT license. See LICENSE for details.
[](https://bitdeli.com/free "Bitdeli Badge")