✨ Add date/time flag to command and update functions
This commit is contained in:
parent
b5c6c84a5d
commit
21d27f8068
5 changed files with 13 additions and 10 deletions
|
|
@ -30,7 +30,7 @@ func Fetch(ctx context.Context, url string) (*ytd.ExtractedInfo, error) {
|
|||
return infos[0], nil
|
||||
}
|
||||
|
||||
func GetLog(ctx context.Context, url string) (models.Log, error) {
|
||||
func GetLog(ctx context.Context, url string, now time.Time) (models.Log, error) {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return models.Log{}, context.Cause(ctx)
|
||||
|
|
@ -42,8 +42,8 @@ func GetLog(ctx context.Context, url string) (models.Log, error) {
|
|||
if err != nil {
|
||||
return models.Log{}, err
|
||||
}
|
||||
now := time.Now()
|
||||
ent.Date = now
|
||||
// TODO Get published date
|
||||
|
||||
metas := &ent.Fields
|
||||
*metas = metas.Set("id", getID(now, info))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue