package readlist import ( "fmt" "time" "github.com/go-shiori/go-readability" ) // ReadLaterItem represents a saved link with its reader mode content type ReadLaterItem struct { ID string `json:"id" gorm:"primaryKey"` URL string `json:"url" gorm:"not null"` Title string `json:"title" gorm:"not null"` Content string `json:"content" gorm:"type:text"` Description string `json:"description"` Image string `json:"image"` Status string `json:"status" gorm:"default:unread"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` LastModified time.Time `json:"lastModified"` ReadAt *time.Time `json:"readAt"` ArchivedAt *time.Time `json:"archivedAt"` } // ParseURL fetches the URL and extracts readable content func (r *ReadLaterItem) ParseURL() error { article, err := readability.FromURL(r.URL, 30*time.Second) if err != nil { return fmt.Errorf("failed to parse URL: %w", err) } r.Title = article.Title r.Content = article.Content r.Description = article.Excerpt return nil }