AoN - Archives of Nethys:
https://www.aonprd.com/ it's an online collection of the PF1/SF/PF2 rules and content.
The exact code you've tried would help figure out what's going wrong - I don't follow what you have tried.
And I still can't follow what it is you're trying to accomplish - what your overall goal is.