Extracting keyword-related data from Wikipedia

import wikipedia from random import sample import re keyword = 'Facebook' print(wikipedia.summary(keyword, sentences=2)) """ Facebook is an American for-profit corporation and an online social media and social networking service based in Menlo Park, California. The Facebook website was launched on February 4, 2004, by Mark Zuckerberg, along with fellow Harvard College students and roommates, Eduardo Saverin, Andrew McCollum, Dustin Moskovitz and Chris Hughes. """ regex = re.compile(r"(?:=+ Facebook companies =+\n)(.*?)(?:\n\n)", re.DOTALL) page_content = wikipedia.page(keyword).content print(regex.findall(page_content)[0].split('\n')) """ ['Facebook, Inc.', 'Facebook Payments, Inc.', 'Atlas', 'Instagram LLC', 'Onavo', 'Moves', 'Oculus', 'WhatsApp, Inc.', 'Masquerade', 'CrowdTangle'] """ print(wikipedia.search(keyword)) """ ['Facebook', 'Facebook Platform', 'List of Facebook features', 'Facebook Messenger', 'Criticism of Facebook', 'Facebook Credits', 'History of Facebook', 'Censorship of Facebook', 'Facebook Beacon', 'Facebook Paper'] """ print(sample(wikipedia.page(keyword).links, 30)) """ ['Telus', 'T-Systems', 'Lava International', 'Apache Thrift', 'TechCrunch', 'Domain name', 'Parade float', 'Oculus Rift', 'The Chronicle of Higher Education', 'Like button', 'Ted Ullyot', 'JSTOR', 'Webfinger', 'Incyte', 'Sanmina Corporation', 'Web directory', 'AlphaBay', 'Facebook Slingshot', 'History of Facebook', 'Tata Teleservices', 'Bridge (interpersonal)', 'Bitmessage', 'Cognitive dissonance', 'Oral contract', 'Art history', 'Austin', 'Social network change detection', 'Plain text', 'Ziff Davis', 'ExtremeTech'] """