[問題] 請問會自動更新的網頁資料要怎麼抓?
想要紀錄台灣每日發電/用電量
在台電的網頁
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
08/20 00:18, 1F
→
08/20 00:19, , 2F
08/20 00:19, 2F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
Python 近期熱門文章
PTT數位生活區 即時熱門文章