【Python】微博自動搶紅包
# -*- coding: utf-8 -*- import requests import js2xml from lxml import etree headers = { # 這邊cookie替換成你的cookie ‘Cookie‘:‘9b‘, ‘User-Agent‘: ‘Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19‘, } # 獲取紅包列表 def getuid(): url = ‘http://chunjie.hongbao.weibo.com/hongbao2017/h5index‘ # 帶上request headers z = requests.get(url, headers=headers) #print(z.status_code) if z.status_code == 200: # 這邊是查找所有的ouid alluid = etree.HTML(z.content).xpath(‘//div[@class="m-auto-box"][email protected]
【Python】微博自動搶紅包