That should be pretty easy. You can re-use the nx-freestance (I’m guessing that you mean this by “invidious plugin”?) internals to get the most relevant instance, and then construct a link to copy to clipboard. The code for that would be
(define-command-global copy-youtube-url-as-invidious-url ()
"Copy the current buffer URL (implied to have YouTube video open) as an Invidious URL."
(if (search "youtube.com" (quri:uri-host (url (current-buffer))))
(let* ((url (url (current-buffer)))
(priority-instance (or nx-freestance-handler:*preferred-invidious-instance*
(first (mapcar #'nx-freestance-handler::invidious-instance-name
(nx-freestance-handler::get-invidious-instances)))))
(invidious-url (quri:copy-uri url :host priority-instance)))
;; Implies you're on bleeding edge master. If not, use
;; `nyxt/document-mode::%copy' instead.
(ffi-buffer-copy (current-buffer) (quri:render-uri invidious-url)))
(echo-warning "You're not on YouTube, I can't copy this URL :(")))