미해결
[2024 개정판] 이것이 진짜 크롤링이다 - 기본편
질문있습니다
tr class="trFieldValue" id="Tr_A010_0"> == $0
라는 태그를 크롤링하고 싶어서 코드를 작성했는데 엑셀파일을 열어보니 텍스트가 없더라구요 ㅠㅠ 혹시 뭐가 문제인지 알수있을까요?
import requests
from bs4 import BeautifulSoup
import openpyxl
fpath = r'C:\pythonex\경쟁률_1.xlsx'
wb = openpyxl.load_workbook(fpath)
ws = wb.active
codes = [
'Sl5KTCVDYXwwOExKclc6L0pmZlRm','Sl5KTjlKclc6L0pmZlRm','Sl5KVyVNOWFhOUpyVzovSmZmVGY=','Sl5KOk0mSnJXOi9KZmZUZg==','Sl5KMDpXJkpyVzovSmZmVGY=','Sl5KYDpXJkpyVzovSmZmVGY=','Sl5KOk4mSnJXOi9KZmZUZg==','Sl5KOjhMSnJXOi9KZmZUZg==','Sl5KVyV8JnJXYXxMSnJXOi9KZmZUZg==','Sl5KYGJyOnxMSnJXOi9KZmZUZg==','Sl5KOkxMJUpyVzovSmZmVGY=','Sl5KTThXclc4OUpyVzovSmZmVGY=','Sl5KVyUvYDhWSnJXOi9KZmZUZg==','Sl5KOjBDSnJXOi9KZmZUZg==','Sl5KOjAmSnJXOi9KZmZUZg==','Sl5KVyUmclc4L0M6YWAmSnJXOi9KZmZUZg==','Sl5KV2FOOiZKclc6L0pmZlRm','Sl5Kclc4Ylc4SnJXOi9KZmZUZg==','Sl5KVyVyV2FiSnJXOi9KZmZUZg==','Sl5KOjBpSnJXOi9KZmZUZg==','Sl5KOmk5SnJXOi9KZmZUZg==','Sl5KJWAmVzh8SnJXOi9KZmZUZg==','Sl5Kclc6Jmk6YnxKclc6L0pmZlRm','Sl5KcldhVlc4TjlKclc6L0pmZlRm','Sl5KV2FOclc4OUpyVzovSmZmVGY=','Sl5KV2FOclc4OUpyVzovSmZmVGY=','Sl5KJS9yVzgmSnJXOi9KZmZUZg==','Sl5KZiVgJldhYkpyVzovSmZmVGY=','Sl5KOENDOHxKclc6L0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KOmJKclc6L0pmZlRm','Sl5KYDpMSnJXOi9KZmZUZg==','Sl5KTCZMSnJXOi9KZmZUZg==','Sl5KOk05SnJXOi9KZmZUZg==','Sl5KYDpXVkpyVzovSmZmVGY=','Sl5KJjlKclc6L0pmZlRm','Sl5KVyUmYTlKclc6L0pmZlRm','Sl5KOmBWSnJXOi9KZmZUZg==','Sl5KOiZiSnJXOi9KZmZUZg==','Sl5KOmFNOUpyVzovSmZmVGY=','Sl5KVzgmQzpKclc6L0pmZlRm','Sl5KOlc6L2AvSnJXOi9KZmZUZg==',
]
row = 2
for code in codes:
url = f"http://ratio.uwayapply.com/{code}"
response = requests.get(url)
html = response.text
soup = BeautifulSoup(html,'html.parser')
ratio = soup.select(".trFieldValue")
print(ratio)
ws[f'D{row}']
row = row + 70
wb.save(fpath)