Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
43 lines (37 loc) · 1.65 KB

File metadata and controls

43 lines (37 loc) · 1.65 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 通过HTTP请求和XML实现获取电视节目
# API:http://www.webxml.com.cn/webservices/ChinaTVprogramWebService.asmx
import requests
from xml.etree import ElementTree as ET
def print_city():
city = requests.get('http://www.webxml.com.cn/webservices/ChinaTVprogramWebService.asmx/getAreaDataSet')
root = ET.XML(city.text)
areaID, Area = [], []
for id in root.iter('areaID'):
areaID.append(id.text)
for node in root.iter('Area'):
Area.append(node.text)
for i in range(len(areaID)):
print('频道ID: {} -> {}'.format(areaID[i], Area[i]))
def select_dianshitai(iD):
dianshitai = requests.get('http://www.webxml.com.cn/webservices/ChinaTVprogramWebService.asmx/getTVchannelDataSet?'
'theTVstationID={}'.format(iD))
root = ET.XML(dianshitai.text)
tvChannelID, tvChannel = [], []
for tvID in root.iter('tvChannelID'):
tvChannelID.append(tvID.text)
for tvCH in root.iter('tvChannel'):
tvChannel.append(tvCH.text)
for i in range(len(tvChannelID)):
print('频道号: {} -> {}'.format(tvChannelID[i], tvChannel[i]))
# def select_pindao():
# pindao = requests.get('http://www.webxml.com.cn/webservices/ChinaTVprogramWebService.asmx/getTVchannelString?'
# 'theTVstationID=10')
# print(pindao.text)
def tv_list():
final = requests.get('http://www.webxml.com.cn/webservices/ChinaTVprogramWebService.asmx/getTVprogramDateSet?'
'theTVchannelID=1&theDate=2017-05-11&userID=')
print(final.text)
if __name__ == '__main__':
print_city()
iD = input('请输入ID: ')
select_dianshitai(iD)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.