HP C9017 Photosensor wire colors
simulate this circuit &ndash; Schematic created using CircuitLab
Figure 1. The component contains an infrared LED and a phototransistor. The case outline is in grey.
We can see from your photos that the green wire is attached to a trace that goes to both sides of the opto device. This is almost certainly a common ground.

I want to know the circuit (GND, VCC, output) to connect it with Raspberry Pi, ...

We've got the green. Now you need to figure out the blue and yellow.

... there is a problem if I connect it with raspberry pi without a resistor?

There certainly is. If you do that to an LED you will have no current limit. Infrared diodes have a forward voltage of 1.4 V or so. To limit the current to 10 mA (a reasonable choice) you need $$ R = \frac {V_{CC} - V_f}I = \frac {3.3 - 1.4}{0.01} $$ which you can work out. That resistor will do to protect the transistor while you test it too.
Connect green to your Pi ground. Try connecting the yellow to the +3.3 V supply via the resistor. Then look into the slots using your phone camera to detect the infrared to see if either side lights. If it does then yellow is your LED. If not try powering up the black in the same way.