I think you should follow the same procedure you have done above.
$$
\begin{align*}
\int_{0}^{1}x^{2}f(x)dx & \thickapprox w_{1}f(x_{1})+w_{2}f(x_{2})+w_{3}f(x_{3})
\end{align*}
$$
$$
\begin{align*}
f(x)=1\Longrightarrow w_{1}+w_{2}+w_{3} & =\int_{0}^{1}1.x^{2}dx=1/3\\
f(x)=x\Longrightarrow w_{1}x_{1}+w_{2}x_{2}+w_{3}x_{3} & =\int_{0}^{1}x.x^{2}dx=1/4\\
& \vdots\\
f(x)=x^{5}\Longrightarrow w_{1}x_{1}^{5}+w_{2}x_{2}^{5}+w_{3}x_{3}^{5} & =\int_{0}^{1}x^{5}.x^{2}dx=1/8
\end{align*}
$$
So you have a nonlinear system of equations. You should solve it with a solver.
$$
\begin{align*}
\int_{a}^{b}w(x)f(x)dx & \thickapprox \sum_{j=1}^{n} w_{j}f(x_{j})
\end{align*}\qquad (*)
$$
Additionally as i know in $(*)$ the node points $x_i$ are the zeros of the n-th degree orthogonal polynomial on $[a, b]$ with respect to weight function $w(x)$.
Also after some research on google as i understood there are some packages( for example "ORTHPOL") which can give Gauss quadrature rules for arbitrary weight functions.