Nowadays, many interactions between people have moved to the Internet, mainly to social media. Due to the huge amount of data, hackers target social media by carrying out cyber-attacks, especially phishing. It focuses on tricking the victim into clicking a link and then providing private information or installing malware on the victim's computer. Phishing attacks are becoming more and more difficult to recognize every year. Therefore, there is a need to support humans in this difficult task and machine learning can be used for this purpose. The paper analyzes the works on phishing recognition by humans and artificial intelligence. Then, the new AlexPhish algorithm for classifying phishing URLs was presented, along with a proposal for its implementation on social media platforms. It is trained on the “Web page phishing detection” dataset and achieves an accuracy of 94.53%.