AI are trained with real data, if chatGPT is giving you a code snippet it means that you could have done 3 more clicks and get the answer from stack overflow or reddit. So why are you amazed by a chatbot scraping the web ?