作者kantaco (我一直都在)
看板Python
标题[问题] 请问会自动更新的网页资料要怎麽抓?
时间Thu Aug 20 00:05:01 2015
想要纪录台湾每日发电/用电量
在台电的网页
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"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
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://webptt.com/cn.aspx?n=bbs/Python/M.1440000312.A.D14.html
1F:→ ENEP: 这个page是去抓loadareas.csv里面的资料来画的 08/20 00:18
2F:→ ENEP: 请自己开browser dev tool看抓下来的资料 08/20 00:19