scraper

package
v0.0.0-...-81a70f6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUsersToFetchFromDatabase

func AddUsersToFetchFromDatabase(db *gorm.DB)

AddUsersToFetchFromDatabase adds to cache all users from database that are not yet fetched

func ExtractAnimeStats

func ExtractAnimeStats(elem *goquery.Selection) *core.AnimeStats

ExtractAnimeStats gets anime stats from single user's profile page

func ExtractBasicInfo

func ExtractBasicInfo(elem *goquery.Selection) *core.BasicInfo

ExtractBasicInfo gets basic info about the user

func ExtractFriendNames

func ExtractFriendNames(elem *goquery.Selection) []string

ExtractFriendNames gets friends names from single page

func ExtractMangaStats

func ExtractMangaStats(elem *goquery.Selection) *core.MangaStats

ExtractMangaStats gets manga stats from single user's profile page

func GetOrCreateUser

func GetOrCreateUser(username string, db *gorm.DB) *core.User

GetOrCreateUser returns User object - if it's a new user, saves it to database and cache first

func GetUser

func GetUser(username string, db *gorm.DB, finished chan bool, relationsChannel chan []core.Relation)

GetUser obtains stats for single user and their friends

func GetUsersToFetchFromCache

func GetUsersToFetchFromCache(limit int) []*core.User

GetUsersToFetchFromCache returns next batch of users to download

func PopulateCache

func PopulateCache(db *gorm.DB)

PopulateCache fetches all users from database into cache

Types

type CacheStats

type CacheStats struct {
	Fetched int
	ToFetch int
}

CacheStats contains information about current scraping process, to be displayed in the command line

func GetStatsFromCache

func GetStatsFromCache() *CacheStats

GetStatsFromCache returns information about current scraping process

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a wrapper over http.Client

func (*Client) Get

func (c *Client) Get(url string) *goquery.Document

Get sends GET request and converts response into goquery.Document

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL