Lọc dữ liệu từ wikipedia

Làm sao để lọc được dữ liệu từ wikipedia ạ. Vd: đầu vào viietnam thì đầu ra là “Vietnam, officially the Socialist Republic of Vietnam, is a country in Southeast Asia and the easternmost country on the Indochinese Peninsula. With an estimated 96.2 million inhabitants as of 2019, it is the 15th most populous country in the world. Vietnam shares its land borders with China to the north, and Laos and Cambodia to the west. It shares its maritime borders with Thailand through the Gulf of Thailand, and the Philippines, Indonesia and Malaysia through the South China Sea. Its capital city is Hanoi, and its most populous city is Ho Chi Minh City, also known by its former name of Saigon.” ạ. Em cảm ơn ạ

google: wikipedia search api
ra ngay link này đầu tiên, có cả code mẫu luôn (php, js, python), chỉ việc parse html to text là xong (nếu không biết phần in đậm thì search tiếp
https://www.mediawiki.org/wiki/API:Search

5 Likes

Các trang trên Wikipedia được viết bằng wikitext chứ không phải là HTML bình thường, thành ra là phải thêm bước parse wikitext thành HTML, cũng có sẵn API luôn. Cào trực tiếp thì cũng được thôi nhưng mà có thêm mấy cái không liên quan đến nội dung chính của trang.

https://m.mediawiki.org/wiki/API:Parsing_wikitext

5 Likes
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?