利用Python抓取指定微博用户新发的动态,并通过邮件进行通知 ~
环境需求
Python 3.x
第三方库:BeautifulSoup
食用方法
获取用户oid
首先需要获取目标用户的oid。...weibo_text, date, imgs):
with open('get_weibo.txt', 'a+') as f:
for img in imgs: # 如果有图片则以img标签形式追加到文本...nohup.out`,则使用下面这条命令
$ nohup python -u get_weibo.py > nohup.out 2>&1 &
如果未安装BeautifulSoup库,需要先安装一下
$...,包含html标签
# 如果未显示全文,需跳转到全文页面获取内容
if '全文' in text: # 需跳转到全文的微博,匹配其跳转连接
href_url = re.findall...weibo_text, date, imgs):
with open('get_weibo.txt', 'a+') as f:
for img in imgs: # 如果有图片则以img标签形式追加到文本