Python wiki page scrape

i want to scrape out movies titles only from the wiki page pls help me out

my code:

url = ''
page = requests.get(url)
soup = BeautifulSoup(page.content,'html.parser')
movies = soup.find('table',{'class':'wikitable sortable'})

structure :

Hello. :wave:

Looking at the structure I can identify one element that separates the title from the rest of the content, and that is the <i> element, I’m not sure how filtering work in BeautifulSoup, but I would filter the content to only return the content that’s inside of <i><a>{your_title}</a></i>.

Hope that helps. :+1:

1 Like

i did this :
titles = movies.find_all('i')

but i cant get it in text however when i just do print(titles)
it works out perfectly giving the stuff in <i></i>
well i’m new to this too not sure how it works
thnks any ways