  This study investigates the antineutrinos production by $\beta$-decay of
$r$-process nuclei in two astrophysical sites that are capable of producing
gamma-ray bursts (GRBs): binary neutron star mergers (BNSMs) and collapsars,
which are promising sites for heavy element nucleosynthesis. We employ a
simplified method to compute the $\beta$-decay $\bar\nu_e$ energy spectrum and
consider a number of different representative thermodynamic trajectories for
$r$-process simulations, each with four sets of $Y_e$ distribution. The time
evolution of the $\bar\nu_e$ spectrum is derived for both the dynamical ejecta
and the disk wind for BNSMs and collapsar outflow, based on approximated mass
outflow rates. Our results show that the $\bar\nu_e$ has an average energy of
approximately 3 to 9~MeV, with a high energy tail of up to 20 MeV. The
$\bar\nu_e$ flux evolution is primarily determined by the outflow duration, and
can thus remain large for $\mathcal{O}(10)$~s and $\mathcal{O}(100)$~s for
BNSMs and collapsars, respectively. For a single merger or collapsar at 40~Mpc,
the $\bar\nu_e$ flux is $\mathcal{O}(10-100)$~cm$^{-2}$~s$^{-1}$, indicating a
possible detection horizon up to $0.1-1$~Mpc for Hyper-Kamiokande. We also
estimate their contributions to the diffuse $\bar\nu_e$ background, and find
that both sources should only contribute subdominantly to the diffuse
background when compared to that expected from core-collapse supernovae.
