Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 420|回复: 0
打印 上一主题 下一主题

电视猫官网apk安装包下载统计

[复制链接]

30

主题

32

帖子

298

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
298
跳转到指定楼层
楼主
发表于 2017-4-14 10:06:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
#!/usr/bin/python
# -*- coding:utf8 -*-
### 2017-04-10
import os
import commands
import time

DownIp = '106.75.87.81'
CurrTime = time.strftime('%Y%m%d', time.localtime(time.time()))
Year = time.strftime('%Y', time.localtime(time.time()))
Month = time.strftime('%m', time.localtime(time.time()))
Day = time.strftime('%d', time.localtime(time.time()))
BaseDir = '/data/down_logs/'
Yesterday = 0
###
CurrTime = int(CurrTime)
Day = int(Day)
Year = int(Year)
Month = int(Month)

if Day != 1:
    Yesterday = CurrTime - 1

if Day == 1 and (Month in [5,7,10,12]):
    Month = Month - 1
    if 1 <= Month <= 9:
        Month = "%02d" % Month       
    Day = 30
    Yesterday = str(Year) + str(Month) + str(Day)

if Day == 1 and (Month in [2,4,6,8,9,11]):
    Month = Month - 1
    if 1 <= Month <= 9:
        Month = "%02d" % Month
    Day = 31
    Yesterday = str(Year) + str(Month) + str(Day)

if Day == 1 and Month == 1:
    Month = 12
    Day = 31
    Year = Year - 1
    Yesterday = str(Year) + str(Month) + str(Day)

if Day == 1 and Month == 3:
    Month = Month - 1
    if 1 <= Month <= 9:
        Month = "%02d" % Month
    flag = Year % 4
    if flag == 0:
        Day = 29
    else:
        Day = 28
    Yesterday = str(Year) + str(Month) + str(Day)
#####
## Down logs
FullDir = BaseDir + str(Yesterday)
if not os.path.exists(FullDir):
    os.mkdir(FullDir)
os.chdir(FullDir)

LogList = ["%02d"%i for i in range(0,24)]
for x in LogList:
    Url = "http://" + DownIp + "/logs/" + str(Yesterday) + "/down.tvmore.com.cn/big_" + str(Yesterday) + str(x) + "_access.log.seg000.gz"
    cmd = 'wget %s' % Url
    (status,output) = commands.getstatusoutput(cmd)
    if status:
        print "success"
#The counts of downdload

(Stat,Output) = commands.getstatusoutput('zcat * | grep MoreTV_TVApp_2_0_Android/20170214/MoreTVApp3.0_guanwang_V3.1.3.apk| wc -l')
result = open('/data/www/tongji/index.html','a+')
if Stat == 0:
    result.write("<h3>" + str(Yesterday) + ':'+ " " + Output + "</h3>")
    result.close()


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, 2024-12-16 00:39 , Processed in 0.034064 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表