# 需要抓取公众号的__biz参数 biz = "" # 个人微信号登陆后获取的uin uin = "" # 个人微信号登陆后获取的key,隔段时间更新 key = "" lst = get_history_urls(biz, uin, key, lst=[], start_timestamp=0, start_count=0, end_count=10) print("抓取到的文章链接") print(lst) # 个人微信号登陆后获取的token appmsg_token = "" # 个人微信号登陆后获取的cookie cookie = "" # 获取点赞数、阅读数、评论信息 ai = ArticlesInfo(appmsg_token, cookie) # url:微信文章链接. lst[0]["app_msg_ext_info"]["content_url"] read_num, like_num, old_like_num = ai.read_like_nums(url) item = ai.comments(url) print("阅读:{}; 在看: {}; 点赞: {}".format(read_num, like_num, old_like_num)) print("评论信息") pprint(item)
# 需要抓取公众号的__biz参数 biz = '' # 个人微信号登陆后获取的uin uin = '' # 个人微信号登陆后获取的cookie cookie = '' # 个人微信号登陆后获取的key,隔段时间更新 key = '' lst = method_one(biz, uin, cookie) # 个人微信号登陆后获取的token appmsg_token = '' # 获取点赞数、阅读数、评论信息 test = ArticlesInfo(appmsg_token, cookie) """ data_lst = [] for i, url in enumerate(url_lst): item = test.comments(url) temp_lst = [url, item] try: read_num, like_num = test.read_like_nums(url) temp_lst.append(read_num) temp_lst.append(like_num) except: print("第{}个爬取失败,请更新参数".format(i + 1)) break data_lst.append(temp_lst) """
reader.contral(outfile) appmsg_token, cookie = reader.request(outfile) # 通过抓包工具,手动获取appmsg_token, cookie,手动输入参数 appmsg_token = appmsg_token cookie = cookie ''' lst = method_two(biz, cookie) # 碾平数组 # lst = flatten(lst) # 提取url # url_lst = get_all_urls(lst) # 获取点赞数、阅读数、评论信息 test = ArticlesInfo(appmsg_token, cookie) """ data_lst = [] for i, url in enumerate(url_lst): item = test.comments(url) temp_lst = [url, item] try: read_num, like_num = test.read_like_nums(url) temp_lst.append(read_num) temp_lst.append(like_num) except: print("第{}个爬取失败,请更新参数".format(i + 1)) break data_lst.append(temp_lst) """