This is probably quite different from the example you're thinking of, but here's an example where they were using a hamster as a model organism for testing possible COVID-19 treatments for humans:
Kreye, J., Reincke, S. M., Kornau, H. C., Sánchez-Sendin, E., Corman, V. M., Liu, H., ... & Prüss, H. (2020). A therapeutic non-self-reactive SARS-CoV-2 antibody protects from lung pathology in a COVID-19 hamster model. Cell, 183(4), 1058-1069.
Their method for obtaining samples for PCR:
RNA was extracted from homogenized lungs, nasal washes and tracheal swabs
They don't go into detail about the nasal washes and tracheal swabs, but I would presume that the tracheal swabs are performed much like a human nasal swab, except into the mouth, and using a size of swab appropriate for a hamster. Again, they don't provide much information about the nasal wash and I haven't done this myself in a rodent, but I'd suspect it's done a lot like the nasal irrigation some people use for treatment of sinus complaints, they're just collecting the fluid that comes out.
For the lung homogenates, you can assume that they've euthanized or anesthetized the animals first, then removed the lungs.
If your source is referring to pet hamsters I'm guessing they've used something like the tracheal swab or possibly nasal irrigation.