[PYTHON] [Automatic recording] Automatic continuous playback of Ito Juku streaming [Selenium]


I don't like to consume giga when I want to watch Ito Juku streaming outside, so I wrote it for myself at once. I'm recording when I'm sleeping.

    1. Please reduce the streaming video size
  1. Please continue recording at the same position using recording software such as Bandicam. (The next video will be played in js with the same initial position and small size. All you have to do is fix the recording software and move it.) __3. Use it for yourself by the course purchaser. Streaming viewing rights are for the individual who purchased it. (Of course ...) __
  2. Please google for a detailed explanation of Selenium. If you can use F12 with Chrome, you can use it.

OS:Windows10 Google Chrome version: 85.0.4183.121 (Official Build) (64-bit) Python:3.70 Selenium Webdriver: Latest at the time of writing this article chromedriver.exe: latest at the time of writing this article


from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
import time

opt = webdriver.ChromeOptions()
browser = webdriver.Chrome(options=opt)


elem_mypage = browser.find_element_by_xpath('//*[@id="bk814"]/div/div/div[2]/div/span/a').click()

elem_email = browser.find_element_by_name('login_email')
elem_password = browser.find_element_by_name('login_pass')
elem_login_btn = browser.find_element_by_id('log').click()


elem_kouza_btn = browser.find_element_by_id('gnavi__jukou').click()
elem_juko_btn = browser.find_element_by_xpath('//*[@id="gnavi__jukou"]/div/div/div[1]/a').click()

WebDriverWait(browser, 3).until(lambda d: len(d.window_handles) > 1)

#Change part 1
#Please change the course you want to record the characters here.
#This is a manual change, as recordings that long are not possible anyway.
elem_kiso_minpo = browser.find_element_by_link_text('20 Basic Power Completion Master Civil Code [Hirabayashi]').click()
#find_element(:partial_link_text, "Login").click

#Change part 2
#Please match the name of img here to the course you want to record.
elem_detail = browser.find_element_by_name('Image00049510').click()
#Change part 3
#Since the name name of img is basically a serial number, every 3600 seconds (1 hour)+It is shaped like a loop.
for num in range(59, 81):
    image_num = 'Image000000' + str(num)
    elem_minpo_kiso_kougi_btn =  browser.find_element_by_name(image_num).click()
    elem_minpo_kiso_kougi_btn =  browser.find_element_by_xpath('/html/body/table/tbody/tr[2]/td[2]/table[3]/tbody/tr/td[3]/p/a/img').click()
#1 hour recording
    elem_modoru = browser.find_element_by_link_text('≪To category selection').click()


Recommended Posts

[Automatic recording] Automatic continuous playback of Ito Juku streaming [Selenium]
Automatic operation of Chrome with Python + Selenium + pandas