There is a really nice formula which is valid for |q| < 1, and it involves the dirichlet convolution of arithmetic functions. First, let's denote $\frac{1}{n}$ to mean the arithmetic function that takes a natural number $k$ to $\frac{1}{k}$.
Suppose we have two arithmetic functions: $a,b$
If $a=\frac{1}{n}*b$, then we have the following formula which is valid for all $q<1$:
$$ \frac{1}{(1-q)^{b(1)}(1-q^{2})^{b(2)}(1-q^{3})^{b(3)}...}=e^{((a(1)q+a(2)q^{2}+a(3)q^{3}+...))}
$$
For your problem, we should consider the following arithmetic sequence for $a$:
$a(3k)= \frac{(-1)^{k}}{k}$
and $a(n)=0$ when $n$ is not divisible by $3$.
From this, we calculate $b(3)=-1$, $b(6)=1$, and $0$ everywhere else.
Given these arithmetic functions, let's set $q=\frac{1}{p}$ where $p$ is prime. Plugging all of this into our formula gives us
$$ (1-\frac{1}{p^{3}})(\frac{1}{1-\frac{1}{p^{6}}})=e^{(\frac{-1}{p^{3}}+\frac{1}{2p^{6}}-\frac{1}{3p^{9}}+...))}$$
Each prime number gives us a local factor. Now we just need to multiply all of the local factors together and take the log of both sides and we should derive your first identity. You should be able to easily generalize this construction to obtain your second identity.