脚本代码【军事理论】

发布于 2019-10-04  260 次阅读


以下是第二代的代码

  • 首先要使用pip 安装 selenium
  • 需要下载chromedriver,并且将其添加到PATH中
  • 第二代码只需要在main函数中修改login的用户名与密码就可以了
from selenium import webdriver
import time
from selenium.webdriver import ActionChains
driver = webdriver.Chrome()
orange_url = []
def login(user,passwd):
    global driver
    driver.get("https://passport2.chaoxing.com/login?fid=183&refer=http://i.mooc.chaoxing.com/space/index.shtml")
    driver.find_element_by_xpath('//*[@id="unameId"]').send_keys(user)
    driver.find_element_by_xpath('//*[@id="passwordId"]').send_keys(passwd)
    codes = input("Please input the verify codes:")
    driver.find_element_by_xpath('//*[@id="numcode"]').send_keys(codes)
    driver.find_element_by_xpath('//*[@id="form"]/table/tbody/tr[7]/td[2]/label/input').click()
    iframe = driver.find_element_by_xpath('//*[@id="frame_content"]')
    driver.switch_to_frame(iframe)
    driver.find_element_by_xpath('/html/body/div/div[2]/div[2]/ul/li[1]/div[2]/h3/a').click()
    driver.switch_to_window(driver.window_handles[0])
    driver.close()
    driver.switch_to_window(driver.window_handles[0])

def detect_finshed():
    global driver
    class_attribute = driver.find_element_by_id('ext-gen1039').get_attribute('class')
    return class_attribute

def change_frame():
    global driver
    iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
    driver.switch_to_frame(iframe)
    time.sleep(4)
    d = driver.find_element_by_id('ext-gen1039').get_attribute('class')
    if "finished" in d:
        print("当前视频章节已完成")
    else:
        iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
        time.sleep(4)
        driver.switch_to_frame(iframe_2)
        # video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
        # driver.execute_script("return arguments[0].play()", video)
        t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':', 1)
        t1 = int(t1[0]) * 60 + int(t1[-1])
        t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':', 1)
        t2 = int(t2[0]) * 60 + int(t2[-1])
        print("剩余时间为:%d s" % (t2 - t1))
        time.sleep(t2 - t1 + 5)

def find_all_orange():
    list = driver.find_elements_by_class_name('orange')
    return list


def main():
    login("用户名", "我是密码")
    url_private = driver.current_url
    orange_list = find_all_orange()
    for i in orange_list:
        try:
            orange_url.append(i.find_element_by_xpath("./../../span[2]/a").get_attribute('href'))
        except:
            orange_url.append(i.find_element_by_xpath("./../../span[3]/a").get_attribute('href'))
    for url in orange_url:
        driver.get(url)
        driver.switch_to_window(driver.window_handles[-1])
        time.sleep(3)
        title = driver.find_element_by_xpath('//*[@id="mainid"]/h1').text
        driver.find_element_by_xpath('//*[@id="mainid"]/h1').click()
        print(title,end="")
        iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
        driver.switch_to_frame(iframe)
        d = driver.find_element_by_id('ext-gen1039').get_attribute('class')
        if "finished" in d:
            print("当前视频章节已完成")
            continue
        iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
        time.sleep(4)
        driver.switch_to_frame(iframe_2)
        video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
        driver.execute_script("return arguments[0].play()", video)
        t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':', 1)
        t1 = int(t1[0]) * 60 + int(t1[-1])
        t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':', 1)
        t2 = int(t2[0]) * 60 + int(t2[-1])
        print("剩余时间为:%d s" % (t2 - t1))
        time.sleep(t2 - t1 + 5)

if __name__ == '__main__':
    main()

以下是第一代代码

  • 第一代代码有点过于繁琐,建议使用第二代
from selenium import webdriver
import time
from selenium.webdriver import ActionChains
driver = webdriver.Chrome()
def login(user,passwd):
    global driver
    driver.get("https://passport2.chaoxing.com/login?fid=183&refer=http://i.mooc.chaoxing.com/space/index.shtml")
    driver.find_element_by_xpath('//*[@id="unameId"]').send_keys(user)
    driver.find_element_by_xpath('//*[@id="passwordId"]').send_keys(passwd)
    codes = input("Please input the verify codes:")
    driver.find_element_by_xpath('//*[@id="numcode"]').send_keys(codes)
    driver.find_element_by_xpath('//*[@id="form"]/table/tbody/tr[7]/td[2]/label/input').click()
def session_2(url_private):
    driver.get(url_private)
    try:
        if driver.find_element_by_xpath('/html/body/div[5]/div[1]/div[2]/div[3]/div[2]/div[1]/h3/span[2]/em').text == "1":
            driver.find_element_by_xpath('/html/body/div[5]/div[1]/div[2]/div[3]/div[2]/div[1]/h3').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333378"]/h3[1]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333378"]/h3[1]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333378"]/h3[2]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333378"]/h3[2]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333378"]/h3[3]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333378"]/h3[3]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333378"]/h3[4]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333378"]/h3[4]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333378"]/h3[5]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333378"]/h3[5]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333378"]/h3[6]/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333378"]/h3[6]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333378"]/h3[7]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333378"]/h3[7]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333378"]/h3[8]/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333378"]/h3[8]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333378"]/h3[9]/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333378"]/h3[9]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333378"]/h3[10]/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333378"]/h3[10]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333378"]/h3[11]/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333378"]/h3[11]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333383"]/h3[1]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333383"]/h3[1]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333383"]/h3[2]/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333383"]/h3[2]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333383"]/h3[3]/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333383"]/h3[3]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333390"]/h3[1]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333390"]/h3[1]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333390"]/h3[2]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333390"]/h3[2]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333390"]/h3[3]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333390"]/h3[3]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333390"]/h3[4]/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333390"]/h3[4]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333390"]/h3[5]/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333390"]/h3[5]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333390"]/h3[6]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333390"]/h3[6]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333390"]/h3[7]/span[1]/em').text == "3":
            driver.find_element_by_xpath('//*[@id="164333390"]/h3[7]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333390"]/h3[8]/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333390"]/h3[8]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333390"]/h3[9]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333390"]/h3[9]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333392"]/h3[1]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333392"]/h3[1]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333392"]/h3[2]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333392"]/h3[2]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333392"]/h3[3]/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333392"]/h3[3]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('/html/body/div[5]/div[1]/div[2]/div[3]/div[2]/div[6]/h3/span[2]/em').text == "2":
            driver.find_element_by_xpath('/html/body/div[5]/div[1]/div[2]/div[3]/div[2]/div[6]/h3/span[3]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
    except:
        return


def session_3(url_private):
    driver.get(url_private)
    try:
        if driver.find_element_by_xpath('//*[@id="164333370"]/h3/span[1]/em').text == "1":
            driver.find_element_by_xpath('//*[@id="164333370"]/h3/span[2]').click()
            driver.switch_to_window(driver.window_handles[-1])
            time.sleep(3)
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333375"]/h3[1]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333375"]/h3[1]/span[2]').click()
            time.sleep(3)
            driver.switch_to_window(driver.window_handles[-1])
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333375"]/h3[2]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333375"]/h3[2]/span[2]').click()
            driver.switch_to_window(driver.window_handles[-1])
            time.sleep(3)
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333380"]/h3[1]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333380"]/h3[1]/span[2]').click()
            driver.switch_to_window(driver.window_handles[-1])
            time.sleep(3)
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333380"]/h3[2]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333380"]/h3[2]/span[2]').click()
            driver.switch_to_window(driver.window_handles[-1])
            time.sleep(3)
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333380"]/h3[3]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333380"]/h3[3]/span[2]').click()
            driver.switch_to_window(driver.window_handles[-1])
            time.sleep(3)
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333380"]/h3[4]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333380"]/h3[4]/span[2]').click()
            driver.switch_to_window(driver.window_handles[-1])
            time.sleep(3)
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
        if driver.find_element_by_xpath('//*[@id="164333380"]/h3[5]/span[1]/em').text == "2":
            driver.find_element_by_xpath('//*[@id="164333380"]/h3[5]/span[2]').click()
            driver.switch_to_window(driver.window_handles[-1])
            time.sleep(3)
            print(driver.find_element_by_xpath('//*[@id="mainid"]/h1').text)
            iframe = driver.find_element_by_xpath('//*[@id="iframe"]')
            driver.switch_to_frame(iframe)
            iframe_2 = driver.find_element_by_xpath('//*[@id="ext-gen1039"]/iframe')
            driver.switch_to_frame(iframe_2)
            video = driver.find_element_by_xpath('//*[@id="video_html5_api"]')
            driver.execute_script("return arguments[0].play()", video)
            print(driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text)
            t1 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[2]/span[2]').text.split(':',1)
            t1 = int(t1[0]) * 60 + int(t1[-1])
            t2 = driver.find_element_by_xpath('//*[@id="video"]/div[4]/div[4]/span[2]').text.split(':',1)
            t2 = int(t2[0]) * 60 + int(t2[-1])
            print("剩余时间为:%d s"%(t2-t1))
            time.sleep(t2-t1)
            driver.get(url_private)
    except:
        return
login("用户名","密码")
Jiarong_url = "https://mooc1-2.chaoxing.com/mycourse/studentcourse?courseId=204737661&clazzid=9472922&cpi=96490735&enc=fdfd1b7bdb7c59459d68bd7ce2e684a7"
Edmund_url = "https://mooc1-2.chaoxing.com/mycourse/studentcourse?courseId=204737661&clazzid=9472922&enc=e61cf88d2e1f0203a6a46ce531c557a0"
Huang_url = "https://mooc1-2.chaoxing.com/mycourse/studentcourse?courseId=204737661&clazzid=9472922&cpi=96490779&enc=15e42a72078537818723d6765b489395"
session_2(Jiarong_url)
session_3(Jiarong_url)

你知道雪为什么是白色的吗?因为她忘记了原来的颜色