I was watching https://m.youtube.com/watch?v=efBdnK1q504&list=PLj7p5OoL6vGykv4JM5MpY3I5j6mkLyKQU&index=8&t=0s video.
Now I would wonder what if special integrating factor had been a function of $x$ and $y$ other than some exponential function of $x$ and $y$. Then how should we get that? Suppose we have this differential $$(2y^3\sec y + 2\tan y)dx + \left(3xy^2\sec y + \dfrac{3y^2 \sec y}{x}+ x\right)dy= 0$$ What is the perfect procedure to find its integrating factor.
$$(2y^3\sec y + 2\tan y)dx + \left(3xy^2\sec y + \dfrac{3y^2 \sec y}{x}+ x\right)dy= 0$$ $$\left(\frac{2y^3}{\cos(y)} + \frac{2\sin(y)}{\cos(y)}\right)dx + \left(\frac{3xy^2}{\cos(y)} + \dfrac{3y^2}{x\cos(y)}+ x\right)dy= 0$$ Reducing to the common denominator $x\cos(y)$ leads to : $$\left(2xy^3 + 2x\sin(y)\right)dx + \left(3x^2y^2 + 3y^2+ x^2\cos(y)\right)dy= 0$$ Which is obviously exact: $$d\left(x^2y^3+y^3 + x^2\sin(y)\right)=0$$ So, the integrating factor for the ODE in it's initial form was $x\cos(y)$ .
And the final result is : $$x^2y^3+y^3 + x^2\sin(y)=c$$
A much more tedious method was to look for an integrating factor on the form $f(x)g(y)$ .
NOTE AFTER THE OP's COMMENT :
For the general ODE : $M(x,y)dx+N(x,y)dy=0$ if the integrating factor if function of $y$ only, then the I.F. is $f(y)=\exp\left( \int \frac{N_x-M_y}{M}dy\right)$. If the I.F. is function of $x$ only then it is $g(x)=\exp\left( \int \frac{N_x-M_y}{N}dy\right)$. The formula is different for each form of I.F.
Using such ready-made formula is a short-cut possible only if the formula exists, that is if someone already solved the related kind of ODEs. As far as I know there is no ready-made formula for the general case. So, if no formula is available in the case we are considering, we have to solve it by ourselves without the help of a ready-made formula.
In case of academic exercises, generally the I.F. can be found by simple inspection, without arduous calculus. The ODE considered in your question is such an example of simple academic case.