webserver interface test script

 1 import urllib.request,json
 2 
 3 
 4 
 5 country=[id,th,vn,in,br,me,ru,na,hk]
 6 url_lst=[
 7 .server.voga360.com/nclient/sjson/playpicture/playPicture.htm?mtypeCode=1,
 8 .server.voga360.com/nclient/sjson/playpicture/playPicture.htm?mtypeCode=2,
 9 .server.voga360.com/nclient/sjson/recommend/recommend.htm?a=recmd_app_home_1,
10 .server.voga360.com/nclient/sjson/recommend/recommend.htm?a=recmd_game_home_1,
11 .server.voga360.com/nclient/sjson/recommend/recommend.htm?a=recmd_app_releases_1,
12 .server.voga360.com/nclient/sjson/recommend/recommend.htm?a=recmd_game_releases_1,
13 .server.voga360.com/nclient/sjson/subject/subjectInfo.htm?subjectInfoId=393,
14 .server.voga360.com/nclient/sjson/subject/subject.htm?mtypeCode=1,
15 .server.voga360.com/nclient/sjson/rank/topRankList.htm?mtypeCode=2&typeCode=0,
16 .server.voga360.com/nclient/sjson/rank/topRankList.htm?mtypeCode=1&typeCode=0,
17 .server.voga360.com/nclient/sjson/rank/topNewRankList.htm?mtypeCode=1&typeCode=0,
18 .server.voga360.com/nclient/sjson/rank/topNewRankList.htm?mtypeCode=2&typeCode=0,
19 .server.voga360.com/nclient/sjson/rank/topTrendRankList.htm?mtypeCode=1&typeCode=0,
20 .server.voga360.com/nclient/sjson/rank/topTrendRankList.htm?mtypeCode=2&typeCode=0,
21 .server.voga360.com/nclient/sjson/category/categoriesDownload.htm?currentPage=1&mtypeCode=1&typeCode=21,
22 .server.voga360.com/nclient/sjson/category/categoriesDownload.htm?currentPage=1&mtypeCode=2&typeCode=0,
23 .server.voga360.com/nclient/sjson/category/categoriesRate.htm?currentPage=1&mtypeCode=1&typeCode=5,
24 .server.voga360.com/nclient/sjson/category/categoriesRate.htm?currentPage=1&mtypeCode=2&typeCode=0,
25 .server.voga360.com/nclient/sjson/category/categoriesTrend.htm&currentPage=4&mtypeCode=1&typeCode=19,
26 .server.voga360.com/nclient/sjson/category/categoriesTrend.htm&currentPage=4&mtypeCode=2&typeCode=0,
27 .server.voga360.com/nclient/sjson/category/categoriesLatest.htm?currentPage=1&mtypeCode=1&typeCode=10,
28 .server.voga360.com/nclient/sjson/category/categoriesLatest.htm?currentPage=1&mtypeCode=2&typeCode=0]
29 
30 #country=[‘gl‘,]
31 urla=http://
32 
33 
34 def cnt_md(country,url_lst):
35     for urlm in country:
36         for urlp in url_lst:
37             print (urlm,urlp)
38             urlr=urla+urlm+urlp
39             print (Connect to %s\n % urlr)
40             fd=open(t.log,w)
41             req = urllib.request.Request(urlr)
42 
43             response = urllib.request.urlopen(req)
44             the_page = response.read()
45             print (the_page,file=fd)
46 
47             fd.close()
48             fd=open(t.log,r)
49             lines=fd.readlines()
50             s=lines[0]
51             print (find md5 %d times\n\n\n\n % s.count(md5))
52 
53 
54 cnt_md(country,url_lst)

在抓取到的流文件中寻找md5字段,此脚本还需添加返回错误时的处理,否则会跳出停止,to be continue...//my second day @sohu_cyou

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。