影刀RPA 商品评论采集与分析:挖掘用户真实反馈
title: “影刀RPA 商品评论采集与分析挖掘用户真实反馈”date: 2026-07-01author: 林焱影刀RPA 商品评论采集与分析挖掘用户真实反馈产品改进靠猜营销文案不知道戳哪个痛点直接从电商评论里挖用户的真实语言是最低成本的用户调研。影刀批量采集评论Python做情感分析和关键词提取半天完成竞品洞察。什么情况用什么适合评论采集的场景竞品分析看竞品用户吐槽什么、点赞什么自家产品改进从差评里找真实问题营销文案提炼从好评里找用户原话做广告语选品依据新产品上市前评估市场反馈平台选择淘宝/天猫评论有API限制需要Cookie京东结构清晰评论接口相对友好拼多多数据量大但接口限制多怎么做方法1京东评论采集【影刀操作】新建流程「京东商品评论采集」先手工登录京东保存Cookie添加【Python】指令调用评论接口importrequestsimportjsonimporttime# 从浏览器开发者工具抓包获取的评论接口# 打开京东商品页F12 → Network → 找到/comment请求defget_jd_comments(product_id,page0,page_size10,score0,cookiesNone): score: 0全部11星22星...55星 10好评20中评30差评 urlhttps://club.jd.com/comment/productPageComments.actionparams{productId:product_id,score:score,sortType:5,# 最新page:page,pageSize:page_size,isShadowSku:0,fold:1}headers{Referer:fhttps://item.jd.com/{product_id}.html,User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36,}resprequests.get(url,paramsparams,headersheaders,cookiescookies,timeout10)returnresp.json()# 产品ID从京东商品URL里取如 item.jd.com/12345678.html 中的 12345678product_id12345678# 先查总评论数first_pageget_jd_comments(product_id,page0)total_countfirst_page.get(productCommentSummary,{}).get(commentCount,0)print(f总评论数{total_count})all_comments[]max_pagesmin(50,(total_count//10)1)# 最多采集50页forpageinrange(max_pages):dataget_jd_comments(product_id,pagepage)commentsdata.get(comments,[])ifnotcomments:breakforcincomments:all_comments.append({id:c.get(id),score:c.get(score),content:c.get(content,).strip(),nickname:c.get(nickname),creation_time:c.get(creationTime),reply_count:c.get(replyCount,0),useful_vote:c.get(usefulVoteCount,0),})print(f第{page1}页{len(comments)}条累计{len(all_comments)}条)time.sleep(1page%3)# 随机间隔# 保存withopen(rC:\评论数据\评论原始.json,w,encodingutf-8)asf:json.dump(all_comments,f,ensure_asciiFalse,indent2)yda.set_variable(comments,json.dumps(all_comments,ensure_asciiFalse))print(f采集完成共{len(all_comments)}条评论)方法2评论关键词分析【影刀操作】添加【Python】指令importjsonimportjiebaimportjieba.analysefromcollectionsimportCounterimportpandasaspd commentsjson.loads(yda.get_variable(comments))# 分好评和差评good_comments[c[content]forcincommentsifc[score]4andc[content]]bad_comments[c[content]forcincommentsifc[score]2andc[content]]print(f好评{len(good_comments)}条差评{len(bad_comments)}条)# 用TF-IDF提取关键词good_text .join(good_comments)bad_text .join(bad_comments)good_keywordsjieba.analyse.extract_tags(good_text,topK30,withWeightTrue)bad_keywordsjieba.analyse.extract_tags(bad_text,topK30,withWeightTrue)print(\n好评高频词)forword,weightingood_keywords[:10]:print(f{word}:{weight:.4f})print(\n差评高频词)forword,weightinbad_keywords[:10]:print(f{word}:{weight:.4f})# 关键词频次统计stop_words{的,了,是,在,我,你,他,这,那,都,和,很,就,也}defcount_words(texts):all_words[]fortextintexts:words[wforwinjieba.cut(text)iflen(w)1andwnotinstop_words]all_words.extend(words)returnCounter(all_words)good_word_countcount_words(good_comments)bad_word_countcount_words(bad_comments)# 导出分析结果result_dfpd.DataFrame({好评高频词:[f{w}({c})forw,cingood_word_count.most_common(20)],差评高频词:[f{w}({c})forw,cinbad_word_count.most_common(20)]})result_df.to_excel(rC:\评论数据\关键词分析.xlsx,indexFalse)print(关键词分析完成)方法3差评自动分类【影刀操作】# 差评问题分类problem_categories{物流问题:[快递,配送,包装,破损,时间长,发货慢,延误],质量问题:[质量差,假货,做工,材质,褪色,生锈,坏了],服务问题:[客服,态度,售后,退款,投诉,联系不上],与描述不符:[图片,描述不符,色差,尺寸,颜色不对,和图片不一样],价格问题:[太贵,不值,价格,涨价,优惠]}defcategorize_review(text):categories[]forcategory,keywordsinproblem_categories.items():ifany(kintextforkinkeywords):categories.append(category)returncategoriesifcategorieselse[其他问题]bad_categorized[]forcinbad_comments:catscategorize_review(c)bad_categorized.append({content:c,categories:, .join(cats)})# 统计各类问题数量fromcollectionsimportCounter all_cats[]foriteminbad_categorized:all_cats.extend(item[categories].split(, ))print(\n差评问题分布)forcat,countinCounter(all_cats).most_common():print(f{cat}:{count}条 ({count/len(bad_comments)*100:.1f}%))有什么坑坑1京东接口返回空数据没带Cookie或者Cookie失效接口返回空数据但状态码200。解决方法检查返回的comment数量是否为0若为0检查Cookie是否有效。坑2采集速度太快被封IP每页间隔不到1秒很快被京东识别为爬虫IP被临时封禁。解决方法每页间隔1-3秒随机每采集100页换IP或停10分钟。坑3中文分词结果含无意义词jieba分词会保留是“的”了等虚词影响关键词质量。解决方法维护一个停用词表网上有现成的哈工大停用词表过滤掉停用词。坑4评论图片里有关键信息有些评论只有图片没有文字文字采集拿不到这部分内容。解决方法采集评论图片URL对图片做OCR提取文字融入文本分析。总结评论分析是产品经理和运营最该用影刀做的工作之一。采集分词关键词提取差评分类这套流程一次开发可以对任何竞品重复使用。关键词里的高频词就是用户真实感受比问卷调研可信度高得多。