微博图文私信群发

import requests
import json
import time
import random

url = 'https://weibo.com/aj/message/add?ajwvr=6'

cookies = str(input('请输入cookies:'))
contentss = str(input('请输入准备群发的内容:'))
fid = str(input('请输入准备群发的图片fid:'))

headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0',
'Referer':'xxx',
'Cookie':cookies}

with open('daxian.txt','r') as f:
    for i in f:
        data = {'location':'msgdialog',
                'module':'msgissue',
                'text':contentss,
                'uid':i.strip(),
                'fids':fid,}
        try:
            res = requests.post(url,data,headers=headers)
            a = json.loads(res.text)['msg']
            if '添加成功' in a:
                print(a)
        except Exception as e:
            print(e,i)

 

posted @ 2017-12-06 10:31  Erick-LONG  阅读(658)  评论(0编辑  收藏  举报