The only reason it can't is that the Lichess Boards API makes you authenticate as a user and doesn't give you access to a game that you're not playing, which is a shame. I think the reason is to prevent people from surreptitiously setting up a separate program that will anonymously observe their game, run it through Stockfish, and tell them what to play.
If the player you want to spectate will set you up an API key, then yes it can do that.
If the player you want to spectate will set you up an API key, then yes it can do that.