When Africa BJ starts broadcasting, I'm going to make a program that executes a specific code.
If you look at the BJ station website, there is a live class only when broadcasting.
So I crawl the BJ broadcasting station's homepage every certain period and if there is a live class, a specific code
I want to do it, but I'm stuck in comparison, so I'm looking for help Below are some of the sources
url2 = 'http://bj.afreecatv.com/devil0108'
driver = webdriver.Chrome()
driver.implicitly_wait(3)
driver.get(url2)
html = driver.page_source
soup = BeautifulSoup(html, 'html.parser')
r = soup.select('.live')
if r == '<span class="live">LIVE</span>':
driver.close()
print ("Live")
else:
driver.close()
print ("Not Live")
I opened the home with selenium in JavaScript and saved the live class in r and printed it out.
<span class="live">LIVE</span>
was displayed like this
So if r is <span class="live">LIVE</span>
, I want to execute the code below.
I don't know if the comparison was wrong, but it just came out that it wasn't on live.
I'm looking for help because I can't try the if part with "
Try it as below.
The r can be none, so I'll have to take the code for that code.
ifr.text == 'LIVE': driver.close() print ("Live")
else: driver.close() print ("not live")
© 2024 OneMinuteCode. All rights reserved.