Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArchiveWalker ¶
type ArchiveWalker interface { // Walk walks throu the content of io.Reader Walk(reader io.Reader, walker ArchiveWalkerFunc) }
ArchiveWalker unarchive zip archives
type Cacher ¶
type Cacher interface { // Cache caches the content provided by the reader Cache(reader io.Reader) }
Cacher caches any content
type Downloader ¶
type Downloader interface { // Download downloads the content provided by url Download(url string) (io.ReadCloser, error) }
Downloader downloads a content from URL
type Extractor ¶
type Extractor interface { // Extract extracts a links/anchors from a io.Reader Extract(reader io.Reader) ([]string, error) }
Extractor extracts a content of the page
type HTTPDownloader ¶
HTTPDownloader downloads
func (HTTPDownloader) Download ¶
func (downloader HTTPDownloader) Download(url string) (io.ReadCloser, error)
type LinkExtractor ¶
type LinkExtractor struct { // FileExt are the file extension FileExt string // Logger logs information Logger Logger }
LinkExtractor extract <a href="*.zip"> links
type Logger ¶
type Logger interface { Println(v ...interface{}) Printf(format string, v ...interface{}) }
Logger logs messages
type RedisCacher ¶
type RedisCacher struct { Key string Client RedisClient Logger Logger }
RedisCacher caches content into redis
func (*RedisCacher) Cache ¶
func (cacher *RedisCacher) Cache(reader io.Reader)
Cache caches the content of io.Reader
type RedisClient ¶
type RedisClient interface { LPush(key string, values ...interface{}) *redis.IntCmd LIndex(key string, index int64) *redis.StringCmd LLen(key string) *redis.IntCmd }
RedisClient connects to Redis
type Scraper ¶
type Scraper struct { Downloader Downloader Extractor Extractor ArchiveWalker ArchiveWalker Cacher Cacher MaxConn int Logger Logger }
Scraper scrapes a web content
type ZIPWalker ¶
type ZIPWalker struct { // FileExt specifies the file extetnsion FileExt string // Logger logs information Logger Logger }
ZIPWalker unzip *.zip files
func (*ZIPWalker) Walk ¶
func (walker *ZIPWalker) Walk(reader io.Reader, walk ArchiveWalkerFunc)
Walk unzips a *.zip files
The original implementation can be found in my blog http://blog.ralch.com/tutorial/golang-working-with-zip/
ZIP algorithm is using random access so unforthunately we need to read the whole file before we unzip it
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
|
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter |