You can crunch those integrals, or you can reason that the approximation must be exact for $f = 1, x, x^2, x^3$ and get a linear system for the weights:
Write the approximation as
$$\int_{0}^{1}p_3(x)\,dx = \sum_{i = 1}^{4}w_if(x_i)$$
where $x_1 = 0$, $x_2 = 1/3$, $x_3 = 2/3$, $x_4 = 1$ and the $w_i$ are to be determined. The approximation must be exact for $f = 1, x, x^2, x^3$, so that gives the system of equations
$$
\begin{bmatrix}
1 & 1 & 1 & 1 \\
x_1 & x_2 & x_3 & x_4 \\
x_1^2 & x_2^2 & x_3^2 & x_4^2 \\
x_1^3 & x_2^3 & x_3^3 & x_4^3 \\
\end{bmatrix}
\begin{bmatrix}
w_1 \\
w_2 \\
w_3 \\
w_4 \\
\end{bmatrix}
=
\begin{bmatrix}
1 \\
1/2 \\
1/3 \\
1/4 \\
\end{bmatrix}
$$
which you can solve to find the $w_i$. Both your approach and this approach can generate the weights for any choice of distinct nodes; there is nothing special about equally spaced nodes.
Edit on why it should be exact on $1, x, x^2, x^3$:
The integration method is based on calculating the interpolation polynomial $p_3(x)$ and integrating it. When you interpolate $4$ points from a function $f$ that is a polynomial of degree $3$ or less, the interpolation polynomial $p_3$ matches $f$ identically (by uniqueness of the interpolating polynomial).
One way to see why exactness makes the approximation good is to consider the approximation on a small interval $[-h, h]$:
$$\int_{-h}^{h}f(x)\,dx \approx 2h\sum_{i = 1}^{N}w_if(x_ih).$$
Define the error in the approximation for a function $f$ as
$$E(f) := \int_{-h}^{h}f(x)\,dx - 2h\sum_{i = 1}^{N}w_if(x_ih)$$
Note that $E$ is a linear map. Writing $f$ as a Taylor series around $0$ gives
\begin{align}
E(f) &= E\left(\sum_{n = 0}^{\infty}\frac{f^{(n)}(0)}{n!}x^n\right) \\
&= \sum_{n = 0}^{\infty}\frac{f^{(n)}(0)}{n!}E(x^n)
\end{align}
You can verify that $E(x^n) = O(h^{n + 1})$. Hence if $k$ is the smallest integer for which $E(x^k) \neq 0$, then the error is
$$E(f) = \frac{f^{(k)}(0)}{k!}E(x^k) + O(h^{k + 2}) = O(h^{k + 1}).$$
So exactness on polynomials increases the accuracy of the approximation on all (smooth enough) functions.