[問題] 請問會自動更新的網頁資料要怎麼抓?

看板Python作者 (我一直都在)時間10年前 (2015/08/20 00:05), 編輯推噓0(002)
留言2則, 1人參與, 最新討論串1/2 (看更多)
想要紀錄台灣每日發電/用電量 在台電的網頁 http://www.taipower.com.tw/loadGraph/loadGraph/load_areas.html 會用圖形方式顯示每個時間的用電狀況 用python3寫程式如下 #!/usr/bin/python # -*- coding: UTF-8 -*- # 在檔案開始的位置 用註解方式宣告此程式檔案的編碼方式 # Python: 3.4.1 # Platform: windows 8.1 # Program: # History: 2015.8.19 # 使用網路資源 import requests from bs4 import BeautifulSoup url = 'http://www.taipower.com.tw/loadGraph/loadGraph/load_areas.html' res = requests.get(url) soup = BeautifulSoup(res.content , 'html.parser') 所抓回的資料中卻沒有包含網頁圖表中的數值 >"<?? 且內容好少, 如下 >>> soup <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="" rel="nofollow">http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <meta content="no-cache" http-equiv="Pragma"> <meta content="-1" http-equiv="Expires"> <title>用電曲線圖(依區域別)</title> <script src="js/jquery-1.8.2.js"></script> <script src="js/flash/swfobject.js" type="text/javascript"></script> <script src="js/amcharts.js" type="text/javascript"></script> <script src="js/amfallback.js" type="text/javascript"></script> <script src="js/datafunc.js" type="text/javascript"></script> <!--–[if lt IE 7.]--> <script defer src="js/pngfix.js" type="text/javascript"></script> </meta></meta></head></html> 請問怎麼樣才能把每個時間的用電量資料擷取下來? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.169.210.4 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1440000312.A.D14.html

08/20 00:18, , 1F
這個page是去抓loadareas.csv裡面的資料來畫的
08/20 00:18, 1F

08/20 00:19, , 2F
請自己開browser dev tool看抓下來的資料
08/20 00:19, 2F
文章代碼(AID): #1LrAauqK (Python)
文章代碼(AID): #1LrAauqK (Python)