Exemple #1
0
def doubanFollowing(id):
    global sended, sever
    url = "http://m.douban.com/people/" + str(id) + "/"
    handle = html.Html()
    data = handle.get(url, "")
    sData = BeautifulSoup.BeautifulSoup(data)

    lists = sData.div.find("div", {"class": "list"})
    firstDiv = lists.div

    userName = firstDiv.a.contents[0]
    content = replaceSign(firstDiv.a.nextSibling, 0)
    time = replaceSign(firstDiv.find("span", {"class": "info"}).contents[0])

    if time <= dateToday():
        # sms.SMS().sendSMS(content)
        to = "*****@*****.**"
        subj = "New message from " + userName + " in douban"
        text = content
        if text not in sended:
            try:
                myEmail.sendmessage(server, subj, text, to)
                sended.append(text)
            except Exception, e:
                print e
Exemple #2
0
def weiboFollowing(id):
    global sended, sever
    url = 'http://m.weibo.cn/u/' + str(id)

    headers = {
        "Accept":
        "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "Accept-Encoding":
        "gzip,deflate,sdch",
        "Accept-Language":
        "zh-CN,zh;q=0.8",
        "Cache-Control":
        "max-age=0",
        "Connection":
        "keep-alive",
        "Cookie":
        "_T_WM=67482dd32c104ee6452160ff87248f3b; M_WEIBOCN_PARAMS=featurecode%3D20000181%26rl%3D1%26luicode%3D10000011%26lfid%3D1005051843543427%26fid%3D1005051843543427%26uicode%3D10000011",
        "Host":
        "m.weibo.cn",
        "User-Agent":
        "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36 LBBROWSER"
    }

    print url
    handle = html.Html()
    #data = handle.get(url,'')
    data = handle.post(url, {'': ''}, headers)
    #print gzdecode(data)

    url = 'http://m.weibo.cn/page/card?itemid=1005051843543427_-_WEIBO_INDEX_PROFILE_WEIBO_GROUP_OBJ'
    data = handle.get(url, '')
    data = data.replace('"}', '').replace('{"ok":"1","data":"', '')
    #sys.exit()
    sData = BeautifulSoup.BeautifulSoup(data)

    lists = sData.find('article', {})
    firstDiv = lists.div
    print firstDiv
    sys.exit()
    userName = firstDiv.a.contents[0]
    content = replaceSign(firstDiv.a.nextSibling, 0)
    time = replaceSign(firstDiv.find('span', {'class': 'info'}).contents[0])

    if time <= dateToday():
        #sms.SMS().sendSMS(content)
        to = '*****@*****.**'
        subj = 'New message from ' + userName + ' in weibo'
        text = content
        if text not in sended:
            try:
                myEmail.sendmessage(server, subj, text, to)
                sended.append(text)
            except Exception, e:
                print e
Exemple #3
0
def weiboFollowing(id):
    global sended, sever
    url = 'http://m.weibo.cn/u/' + str(id)
    
    headers = {
               
               "Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", 
                "Accept-Encoding" : "gzip,deflate,sdch", 
                "Accept-Language" : "zh-CN,zh;q=0.8", 
                "Cache-Control" : "max-age=0", 
                "Connection" : "keep-alive", 
                "Cookie" : "_T_WM=67482dd32c104ee6452160ff87248f3b; M_WEIBOCN_PARAMS=featurecode%3D20000181%26rl%3D1%26luicode%3D10000011%26lfid%3D1005051843543427%26fid%3D1005051843543427%26uicode%3D10000011", 
                "Host" : "m.weibo.cn", 
                "User-Agent" : "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36 LBBROWSER"
               
               }
    
    print url
    handle = html.Html()
    #data = handle.get(url,'')
    data = handle.post(url,{'':''},headers)
    #print gzdecode(data)
    
    url = 'http://m.weibo.cn/page/card?itemid=1005051843543427_-_WEIBO_INDEX_PROFILE_WEIBO_GROUP_OBJ'
    data = handle.get(url,'')
    data = data.replace('"}','').replace('{"ok":"1","data":"','')
    #sys.exit()
    sData = BeautifulSoup.BeautifulSoup(data)
    
    lists = sData.find('article',{})
    firstDiv = lists.div
    print firstDiv
    sys.exit()
    userName = firstDiv.a.contents[0]
    content = replaceSign(firstDiv.a.nextSibling,0)
    time = replaceSign(firstDiv.find('span',{'class':'info'}).contents[0])
    
    if time <= dateToday():
        #sms.SMS().sendSMS(content)
        to='*****@*****.**'
        subj= 'New message from ' + userName + ' in weibo'
        text = content
        if text not in sended:
            try:
                myEmail.sendmessage(server,subj,text,to)
                sended.append(text)
            except Exception,e:
                print e
Exemple #4
0
def downloadFenshi(stockNum):
    global htmlHandle
    imageUrl = 'http://image.sinajs.cn/newchart/v5/usstock/wap/min_daily/226/'+ stockNum + '.gif'
    return htmlHandle.download(imageUrl,'fenshi/'+stockNum+dateToday()+'.gif')