I'm learning basic function of Beautifulsoup. I'm wondering which part of code below could be fix to extract number of alt(means numbering of rank list, like 1, 2, 3) on movie rank page. I wrote sample below
import requests
from bs4 import BeautifulSoup
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'}
data = requests.get('https://movie.naver.com/movie/sdb/rank/rmovie.nhn?sel=pnt&date=20200303')
soup = BeautifulSoup(data.text, 'html.parser')
movies = soup.select('#old_content > table > tbody > tr')
print(len(movies))
for movie in movies:
d_tag = movie.select_one('td.ac > alt')
if d_tag is not None:
print (d_tag)
I tried few ways to discover out the answer on line starting with 'd_tag = '
movie.select.one('td.ac > alt') (this work but not only 'number' I need.)
movie.select.one('td.ac > img alt')
movie.select.one('td.ac > img > alt')
movie.select.one('td.ac > img.alt')
this is first time to ask a question on this great community, please excuse if my question is awkward.