42 lines
702 B
Go
42 lines
702 B
Go
package kemono
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"git.kmsign.ru/royalcat/tstor/daemons/kemono/client"
|
|
)
|
|
|
|
type Daemon struct {
|
|
client client.ClientWithResponsesInterface
|
|
}
|
|
|
|
type creator struct {
|
|
Service string
|
|
CreatorID string
|
|
}
|
|
|
|
func NewDaemon(server string) (*Daemon, error) {
|
|
cl, err := client.NewClientWithResponses(server)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &Daemon{
|
|
client: cl,
|
|
}, nil
|
|
|
|
}
|
|
|
|
func (d *Daemon) scrapCreator(ctx context.Context, creator creator) error {
|
|
resp, err := d.client.GetServiceUserCreatorIdWithResponse(ctx, creator.Service, creator.CreatorID, nil)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, post := range *resp.JSON200 {
|
|
fmt.Println(post)
|
|
}
|
|
|
|
return nil
|
|
}
|