With the rapid increase of users, Scratch, as a popular online social and programming platform, has accumulated massive project resources and complex relations across its social and programming learning network. However, it is challenging to utilize the network information for providing Scratch users with personalized services, despite there are already some useful network representation learning models. In this paper, a network representation learning model with preference-based generative adversarial nets for Scratch (ScratchGAN) is proposed to resolve this problem. In ScratchGAN, we first design a node-vector initialization approach to preserve structure information and side information of Scratch network. Then, considering to learn the fine-grained user preference information of network, we propose a novel Scratch adversarial learning model which includes a Scratch generative adversarial net and a user preference difference constraint component. The former aims to capture user preferences through a new generating strategy based on the delivery nature of preference. The latter attempts to embed users' detailed preference differences according to their interaction behaviors. ScratchGAN can mine user preferences while preserving network structure information and side information. Extensive experiments on the Scratch network show that ScratchGAN outperforms other state-of-the-art models in link prediction and recommendation tasks.