スクレイピングのソース
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time from bs4 import BeautifulSoup import pandas as pd import datetime #IDとパスワード TandD = {'ID':'(ID)','PASS':'(PASS)'} browser = webdriver.PhantomJS() browser.get("https://ondotori.webstorage.jp/system/login/") TandDID = browser.find_element_by_id('lid') TandDPASS = browser.find_element_by_id('lpd') time.sleep(1) TandDID.send_keys(TandD['ID']) TandDPASS.send_keys(TandD['PASS']) TandDPASS.send_keys(Keys.ENTER) time.sleep(2) html= BeautifulSoup(browser.page_source.encode('utf-8'),'html.parser') table = html.findAll('td',class_ = 'upper') todaydetail = datetime.datetime.today().strftime("%Y/%m/%d %H:%M:%S") df = pd.DataFrame([[todaydetail,table[5].string,table[10].string,table[15].string]],columns = ['date','風呂1','風呂2','風呂3']) df.to_csv('temp.csv') browser.close()
table[]の数は要素を調査して各自入れちゃってください。