func (p *PTT) GetPostUrlByIndex(postIndex int) string {
	if postIndex >= len(p.storedPostURLList) {
		return ""
	}
	return p.storedPostURLList[postIndex]
}
Get post URL by index in current parsed page
package photomgr
import (
	"fmt"
	"log"
	"net/http"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"sync"
	"github.com/PuerkitoBio/goquery"
)
type PTT struct {
	baseCrawler
	BaseDir string
	storedPostURLList   []string
	storedPostTitleList []string
	storedStarList      []int
}
func NewPTT() *PTT {
	p := new(PTT)
	p.baseAddress = "https://www.ptt.cc"
	p.entryAddress = "https://www.ptt.cc/bbs/Beauty/index.html"
	return p
}
func (p *PTT) GetUrlPhotos(target string) []string {
	var resultSlice []string
	resp := getResponseWithCookie(target)
	doc, err := goquery.NewDocumentFromResponse(resp)
	if err != nil {
		log.Println(err)
		return nil
	}
	doc.Find(".richcontent").Each(func(i int, s *goquery.Selection) {
		imgLink, exist := s.Find("img").Attr("src")
		if exist {
			resultSlice = append(resultSlice, "http:"+imgLink)
		}
	})
	return resultSlice
}
func (p *PTT) Crawler(target string, workerNum int) {
	resp := getResponseWithCookie(target)
	doc, err := goquery.NewDocumentFromResponse(resp)
	if err != nil {
		log.Println(err)
		return
	}
	articleTitle := ""
	doc.Find(".article-metaline").Each(func(i int, s *goquery.Selection) {
		if strings.Contains(s.Find(".article-meta-tag").Text(), "標題") {
			articleTitle = s.Find(".article-meta-value").Text()
		}
	})
	dir := fmt.Sprintf("%v/%v - %v", p.BaseDir, "PTT", articleTitle)
	if exist, _ := exists(dir); exist {
		return
	}
	os.MkdirAll(filepath.FromSlash(dir), 0755)
	linkChan := make(chan string)
	wg := new(sync.WaitGroup)
	for i := 0; i < workerNum; i++ {
		wg.Add(1)
		go p.worker(filepath.FromSlash(dir), linkChan, wg)
	}
	foundImage := false
	doc.Find("a").Each(func(i int, s *goquery.Selection) {
		imgLink, _ := s.Attr("href")
		switch {
		case strings.Contains(imgLink, "https://i.imgur.com/"):
			linkChan <- imgLink
			foundImage = true
		case strings.Contains(imgLink, "http://i.imgur.com/"):
			linkChan <- imgLink
			foundImage = true
		case strings.Contains(imgLink, "https://pbs.twimg.com/"):
			linkChan <- imgLink
			foundImage = true
		case strings.Contains(imgLink, "https://imgur.com/"):
			imgLink = imgLink + ".jpg"
			linkChan <- imgLink
			foundImage = true
		}
	})
	if !foundImage {
		log.Println("Don't have any image in this article.")
	}
	close(linkChan)
	wg.Wait()
}
func (p *PTT) GetCurrentPageResultCount() int {
	return len(p.storedPostTitleList)
}
func (p *PTT) GetPostTitleByIndex(postIndex int) string {
	if postIndex >= len(p.storedPostTitleList) {
		return ""
	}
	return p.storedPostTitleList[postIndex]
}