Python Scraping - 无法从 Flipkart 获取所需数据 [英] Python Scraping - Unable to get required data from Flipkart

查看:17
本文介绍了Python Scraping - 无法从 Flipkart 获取所需数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从 Flipkart 网站上抓取客户评论.以下是 链接.以下是我要抓取的代码,但它总是返回一个空列表.

<预><代码>>>>从 bs4 导入 BeautifulSoup>>>进口请求>>>r = requests.get('https://www.flipkart.com/samsung-galaxy-j5-6-new-2016-edition-white-16-gb/product-reviews/itmegmrnzqjcpfg9?pid=MOBEG4XWJG7F9A6Z')>>>汤 = BeautifulSoup(r.content, 'lxml') # 也尝试过 'html.parser'>>>汤.find_all('div', '_3DCdKt')[]>>>汤.find_all('div', {'class': '_3DCdKt'})[]>>>汤.find_all('div', {'class': 'row _3wYu6I _3BRC7L'})[]>>>汤.find_all('div', {'class': '_1GRhLX hFPo14'})[]

所以,我试图获取整个部分,但我只得到以下内容:

<预><代码>>>>汤.find_all('div', {'class': 'col-9-12'})[<div class="col-9-12" data-reactid="96"><div class="row _2_xtR5" data-reactid="97"></div><div class="row _3wYu6I _1KVtzT" data-reactid="98"></div></div>]

我没有得到其他内容.所以,接下来我尝试使用 selenium,即使那样它也返回 None.以下是我的硒代码:

<预><代码>>>>驱动程序 = webdriver.Firefox()>>>driver.get('https://www.flipkart.com/samsung-galaxy-j5-6-new-2016-edition-white-16-gb/product-reviews/itmegmrnzqjcpfg9?pid=MOBEG4XWJG7F9A6Z')>>>a = driver.find_elements_by_class_name("_3DCdKt")>>>连(一)10>>>因为我在一个:... 打印 i.get_attribute('value')...没有任何没有任何没有任何没有任何没有任何没有任何没有任何没有任何没有任何没有任何

可能是什么问题?我在代码中是否有任何错误.请帮助.我是 Python 新手.

解决方案

使用 reactjs 填充评论等,数据是使用 ajax 请求检索的,您可以使用请求来模拟:

导入请求数据 = {"productId": "MOBEG4XWJG7F9A6Z", # url 结束 pid=MOBEG4XWJG7F9A6Z"count": "15","评分": "所有",审稿人类型:ALL""sortOrder": "MOST_HELPFUL"}headers = ({"x-user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36 FKUA/website/41/website/Desktop"})data = requests.get("https://www.flipkart.com/api/3/product/reviews", params=data, headers=headers).json()打印(数据)

你想要的是访问 data["RESPONSE"]["data"] 这是一个字典列表:

用于数据中的 dct["RESPONSE"]["data"]打印(dct)

哪个会给你:

{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u'感谢 Flipkart5 天
金属机身的好手机
最好的带闪光灯前置摄像头
最适合夜间自拍
我在夜间模式下用前置闪光灯拍摄 30 多张照片
良好的智能手机金色也是超级
三星有史以来最好的 15k 以下智能手机
良好的电池
良好的前置闪光灯和后置也很棒', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId':u'be37810e-20fe-4417-9d88-2709288cf2ba',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无,u'tracking':{}},u'fixed':False,u'value':{u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 285, u'downvote': {u'action': {u'originalUrl': None,u'params': {u'vote': u'DOWN', u'reviewId': u'be37810e-20fe-4417-9d88-2709288cf2ba', u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 74, u'type': u'VoteValue'}, u'tracking':无},u'id':u'be37810e-20fe-4417-9d88-2709288cf2ba',u'author':u'Happy Thakur',u'url':u'/reviews/be37810e-20fe-44179d88-2709288cf2ba',u'upvote':{u'action':{u'originalUrl':无,u'params':{u'vote':u'UP',u'reviewId':u'be37810e-20fe-4417-9d88-2709288cf2ba',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 211, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 211, u'created': u'16 May, 2016', u'certifiedBuyer': True, u'title': u'Best三星智能手机', u'type': u'ProductReviewValue'}, u'tracking': None}{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u" 使用 3 个月后于 02-8 月更新评论:
我最喜欢:
外观:100/100 - 非常好看的手机.金色和表面处理超级酷
尺寸:100/100 - 5.2 英寸不大也不小.我仍然可以用一只手操作..
电池:100/100 - 3100 mAH 非常出色.我外出时 3G 始终开启,而家里的 Wi-Fi 始终开启.我每 36 小时只为手机充电一次.我主要使用 Whatsapp、instagram 和浏览.
Display : 90/100 - 不像 S 系列手机那么明亮和锐利,但价格实惠.再次印象深刻.我唯一担心的是它没有大猩猩防刮玻璃.我可能需要使用钢化玻璃.
触摸:95/100 - 非常流畅,我现在看不到任何滞后.
相机:90/100 - 照片很好,可以快速拍摄,但又不如 S 系列手机好.但我相信这个价格这款手机在相机 depa 中胜过所有其他竞争对手订.

最后一件事是关于 SAMSUNG 品牌及其服务中心覆盖范围,这再次很棒.
总的来说,我对这款手机非常满意,这款手机达到了我的预期.
我不喜欢的地方:
底部的耳机插孔..边聊天边听歌我感觉不舒服
扬声器音量小,不过对我来说没什么大不了的,因为我主要不使用扬声器听歌",u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'e786669a-024b-4ef0-b70c-1e4fcf5fe5ff',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omn​​itureData':无,u'screenType':无,u'tracking':{}},u'fixed':False,u'value':{u'count':0,u'type':u'VoteValue'}, u'tracking': None}, u'totalCount': 272, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'e786669a-024b-4ef0-b70c-1e4fcf5fe5ff', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'回退':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无,u'tracking':{}},u'fixed':False,u'value':{u'count': 87, u'type':u'VoteValue'},u'tracking':无},u'id':u'e786669a-024b-4ef0-b70c-1e4fcf5fe5ff',u'author':u'Naresh Kareti',u'url': u'/reviews/e786669a-024b-4ef0-b70c-1e4fcf5fe5ff', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'e786669a-024b-4ef0-b70c-1e4fcf5fe5ff', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'回退':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无,u'tracking':{}},u'fixed':False,u'value':{u'count': 185, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 185, u'created': u'13 May, 2016', u'certifiedBuyer': True, u'title': u'Absolute Stunner and Impressive', u'type': u'ProductReviewValue'}, u'tracking': None}{u'action': None, u'fixed': False, u'value': {u'rating': 3, u'text': u'Hi,

我在周五和这里从 Flipkart 拿到了这款手机是我的 3 天评测.

优点:
 * 漂亮的设计
 * 非常方便,易于操作
 * 备用电池很棒
 * 后置摄像头很好
 * 没有发热问题
 
缺点:
 * 如果我们正在充电,它不会显示任何灯或任何通知是否正在充电.我们需要在屏幕上检查它是否正在充电.因此,每次我们需要打开它并查看它是否正在充电时.
* 相机问题:一旦您拍照并按下后退按钮,它需要一些时间才能返回相机模式.
*如果您打开闪光灯并使用后置摄像头拍照,则需要一些时间来捕捉照片.没有 Flash,它的速度非常快.
* 音量非常低.对于中等大小的房间来说不够.
* 耳机不好,尤其是对我来说.


再使用 15 天后将发布我的反馈.

谢谢', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'9cbcd27c-a8ad-4793-978a-5903cd086252', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无,u'tracking':{}},u'fixed':False,u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 212, u'downvote': {u'action':{u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'9cbcd27c-a8ad-4793-978a-5903cd086252', u'reviewDomain': u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无, u'tracking': {}}, u'fixed': False, u'value': {u'count': 67, u'type': u'VoteValue'}, u'tracking': None}, u'id':u'9cbcd27c-a8ad-4793-978a-5903cd086252',u'author':u'ileep',u'url':u'/reviews/9cbcd27c-a8ad-4793-978a-5903cd086252', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'9cbcd27c-a8ad-4793-978a-5903cd086252',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 145, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 145, u'created': u'16 May, 2016', u'certifiedBuyer': True, u'title': u'好看的手机有一些缺点', u'type': u'ProductReviewValue'}, u'tracking': None}{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u'Super Amoled Display..2 GB RAM 仅适用于最新的 Android Marshmallow OS13K ....在如此低的价格范围内很难买到 2 GB 内存的三星手机 范围......使用了 15 天......变得流畅......很棒的耳机质量......自拍和后置摄像头很好.....电池持续使用超过一天或将持续两天....免费 Microsoft 应用程序和更多...', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'1546ed16-5945-4257-9f2d-0d86db7ed92e', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 34, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'1546ed16-5945-4257-9f2d-0d86db7ed92e',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 9, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'1546ed16-5945-4257-9f2d-0d86db7ed92e', u'author': u'Prashant Dias', u'url': u'/reviews/1546ed16-5945-4257-9f2d-0d86db7ed92e',u'upvote':{u'action':{u'originalUrl':无,u'params':{u'vote':u'UP',u'reviewId':u'1546ed16-5945-4257-9f2d-0d86db7ed92e',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 25, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 25, u'created': u'7 Sep, 2016', u'certifiedBuyer': True, u'title': u'Brilliant Phone Compare to Money', u'type': u'ProductReviewValue'}, u'tracking': None}{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u"Nice.battery backup it's good", u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'a9f2f6a0-2272-4187-bd37-48eb8a0a85c9', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking':None}, u'totalCount': 5, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId':u'a9f2f6a0-2272-4187-bd37-48eb8a0a85c9',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'类型':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无,u'tracking':{}},u'fixed':False,u'value':{u'count':0, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'a9f2f6a0-2272-4187-bd37-48eb8a0a85c9', u'author': u'Flipkart Customer', u'url': u'/reviews/a9f2f6a0-2272-4187-bd37-48eb8a0a85c9', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'a9f2f6a0-2272-4187-bd37-48eb8a0a85c9', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url:无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无,u'tracking':{}},u'fixed':False,u'value': {u'count': 5, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 5, u'created': u'17 Aug, 2016', u'certifiedBuyer': True, u'title': u"非常好", u'type': u'ProductReviewValue'}, u'tracking': None}{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u'This Phone is Awesome..Must Buy', u'reportAbuse':{u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'cf8cf2c8-1f79-4d56-a4cd-e641ffb3551b', u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 5, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId':u'cf8cf2c8-1f79-4d56-a4cd-e641ffb3551b',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无,u'tracking':{}},u'fixed':False,u'value':{u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'cf8cf2c8-1f79-4d56-a4cd-e641ffb3551b', u'author': u'Durvank Aregekar', u'url': u'/reviews/cf8cf2c8-1f79-4d56-a4cd-e641ffb3551b', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'投票':u'UP',u'reviewId':u'cf8cf2c8-1f79-4d56-a4cd-e641ffb3551b',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无,u'tracking':{}},u'fixed':False, u'value': {u'count': 5, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 5, u'created': u'10 Aug,2016', u'certifiedBuyer': True, u'title': u'Must Buy', u'type': u'ProductReviewValue'}, u'tracking': None}{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u'It is a good phone', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'ce31beb5-5c8f-4a2d-be7d-aba416592df2', u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 5, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'ce31beb5-5c8f-4a2d-be7d-aba416592df2',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type': u'REVIEW_VOTE', u'omnitureData': 无, u'screenType': 无, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0,u'type': u'VoteValue'}, u'tracking': None}, u'id': u'ce31beb5-5c8f-4a2d-be7d-aba416592df2', u'author': u'Sourabh Jain', u'url': u'/reviews/ce31beb5-5c8f-4a2d-be7d-aba416592df2', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId':u'ce31beb5-5c8f-4a2d-be7d-aba416592df2',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 5, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 5, u'created': u'9 Aug, 2016', u'certifiedBuyer': True,u'title': u'Good phone', u'type': u'ProductReviewValue'}, u'tracking': None}{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u'delivery is in time 但我的手机很热,请检查数据', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'1fcf5a13-edef-4b16-8372-8732819c143c',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无,u'tracking':{}},u'fixed':False,u'value':{u'count':0,u'type':u'VoteValue'}, u'tracking': None}, u'totalCount': 9, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'1fcf5a13-edef-4b16-8372-8732819c143c', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无,u'tracking':{}},u'fixed':False,u'value': {u'count': 1, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'1fcf5a13-edef-4b16-8372-8732819c143c', u'author': u'Santhoaha mn santh', u'url': u'/reviews/1fcf5a13-edef-4b16-8372-8732819c143c', u'upvote': {u'action': {u'originalUrl':无,u'params':{u'vote':u'UP',u'reviewId':u'1fcf5a13-edef-4b16-8372-8732819c143c',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无,u'tracking': {}}, u'fixed': False, u'value': {u'count': 8, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 8, u'created': u'12 Aug, 2016', u'certifiedBuyer': True, u'title': u'very good', u'type': u'ProductReviewValue'}, u'tracking':没有任何}{u'action': None, u'fixed': False, u'value': {u'rating': 4, u'text': u'Good Product by Samsung

这款手机的东西是
1. Marshmellow v6.0
 2. 前置闪光灯和 5mb 摄像头不太好
 3. 它的设计
 4. 主摄像头不太好配 13mb LED 闪光灯
 5. 电池寿命也不太好
 6. 设计大小正确
 7. 支持OTG
 9. 仅2GB RAM
 10. 16GB 内部存储,但只有11GB 可用
 11. 支持4G
 12. 超省电模式
 13. S 自行车模式
 14. 扬声器音量不太好
 15. 支持3G
 16. 超省流量
 17. 无自动亮度
 18. 支持2G
 19. 顶级性能
20. 14000 的好手机
 *********************', u'reportAbuse': {u'action': {u'originalUrl':无, u'params': {u'vote': u'ABUSE', u'reviewId': u'958efa75-1b67-4872-9f71-b18035fafe6a', u'reviewDomain': u'PRODUCT'}, u'loginType':你的腿ACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}},u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 20, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'958efa75-1b67-4872-9f71-b18035fafe6a', u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 5, u'type': u'VoteValue'}, u'跟踪':无},u'id':u'958efa75-1b67-4872-9f71-b18035fafe6a',u'author':u'Vaishnav',u'url':u'/reviews/958efa75-1b67-48729f71-b18035fafe6a',u'upvote':{u'action':{u'originalUrl':无,u'params':{u'vote':u'UP',u'reviewId':u'958efa75-1b67-4872-9f71-b18035fafe6a',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'回覆VIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 15, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 15, u'created': u'17 May, 2016', u'certifiedBuyer': True, u'title': u'By专家 -Vaishnav VJ', u'type': u'ProductReviewValue'}, u'tracking': None}{u'action': None, u'fixed': False, u'value': {u'rating': 4, u'text': u'Very nice device', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'c7177dfb-39c2-4c0b-8bbd-288f96757c3a', u'reviewDomain': u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE',u'omnitureData':无,u'screenType':无, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None},u'totalCount': 4, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'c7177dfb-39c2-4c0b-8bbd-288f96757c3a',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无,u'type':u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'c7177dfb-39c2-4c0b-8bbd-288f96757c3a', u'author': u'Flipkart Customer', u'url':你'/评论/c7177dfb-39c2-4c0b-8bbd-288f96757c3a', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId':u'c7177dfb-39c2-4c0b-8bbd-288f96757c3a',u'reviewDomain':u'PRODUCT'},u'loginType':u'LEGACY_LOGIN',u'url':无,u'fallback':无, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 4, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 4, u'created': u'8 Sep, 2016', u'certifiedBuyer': True,u'title':u'优质产品',u'type':u'ProductReviewValue'},u'tracking':无}

x-user-agent 是必需的,没有它你会得到一个 403.你可以调整参数来查看不同的结果,我会留给你.

I was trying to scrape the customer reviews from Flipkart website. The following is the link. The following was my code to scrape, but it is always returning an empty list.

>>> from bs4 import BeautifulSoup
>>> import requests

>>> r = requests.get('https://www.flipkart.com/samsung-galaxy-j5-6-new-2016-edition-white-16-gb/product-reviews/itmegmrnzqjcpfg9?pid=MOBEG4XWJG7F9A6Z')
>>> soup = BeautifulSoup(r.content, 'lxml') # Tried with 'html.parser' also
>>> soup.find_all('div', '_3DCdKt')
[]
>>> soup.find_all('div', {'class': '_3DCdKt'})
[]
>>> soup.find_all('div', {'class': 'row _3wYu6I _3BRC7L'})
[]
>>> soup.find_all('div', {'class': '_1GRhLX hFPo14'})
[]

So, I tried to get the entire section, but I was getting only the following:

>>> soup.find_all('div', {'class': 'col-9-12'})
[<div class="col-9-12" data-reactid="96"><div class="row _2_xtR5" data-reactid="97"></div><div class="row _3wYu6I _1KVtzT" data-reactid="98"></div></div>]

I was not getting the other contents. So, next I tried with selenium, even then it was returning None. The following is my selenium code:

>>> driver = webdriver.Firefox()
>>> driver.get('https://www.flipkart.com/samsung-galaxy-j5-6-new-2016-edition-white-16-gb/product-reviews/itmegmrnzqjcpfg9?pid=MOBEG4XWJG7F9A6Z')
>>> a = driver.find_elements_by_class_name("_3DCdKt")
>>> len(a)
10
>>> for i in a:
...    print i.get_attribute('value')
...
None
None
None
None
None
None
None
None
None
None

What might be the problem? Am I doing any mistakes in the code. Kindly help. I am new to Python.

解决方案

The reviews etc.. are populated using reactjs, the data is retrieved using an ajax request which you can mimic with requests:

import requests

data = {"productId": "MOBEG4XWJG7F9A6Z", # end of url pid=MOBEG4XWJG7F9A6Z
        "count": "15",
        "ratings": "ALL",
        "reviewerType:ALL"
        "sortOrder": "MOST_HELPFUL"}



headers = ({"x-user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36 FKUA/website/41/website/Desktop"})
data = requests.get("https://www.flipkart.com/api/3/product/reviews", params=data, headers=headers).json()
print(data)

What you want is to access data["RESPONSE"]["data"] which is a list of dicts:

for dct in data["RESPONSE"]["data"]
    print(dct)

Which will give you:

{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u'Thanks to Flipkart who deliver it me with in 5 days 
Good Phone With Metal Body 
And Best front Camera With Flash
Best for night Selfie 
I Take more than 30 pic in night mode with front flash 
good smartphone  gold color is also supereb
best ever smartphone under 15k by samsung
Good Battery
Good Camera Front with Flash and Rear Also Superb', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'be37810e-20fe-4417-9d88-2709288cf2ba', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 285, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'be37810e-20fe-4417-9d88-2709288cf2ba', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 74, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'be37810e-20fe-4417-9d88-2709288cf2ba', u'author': u'Happy Thakur', u'url': u'/reviews/be37810e-20fe-4417-9d88-2709288cf2ba', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'be37810e-20fe-4417-9d88-2709288cf2ba', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 211, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 211, u'created': u'16 May, 2016', u'certifiedBuyer': True, u'title': u'Best Smartphone by Samsung', u'type': u'ProductReviewValue'}, u'tracking': None}
{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u"Updated Review on 02-August after 3 months of usage:
What I liked most:
Look : 100/100 - Very good looking phone. Gold color and the finishing is super cool
Size : 100/100 - 5.2 Inch is neither big nor small. I can still operate with one hand.. 
Battery : 100/100 - 3100 mAH is outstanding. 3G is always ON when i am out of home and Wi-Fi is always ON in home. I am charging mobile only once in every 36 hours. I use Whatsapp, instagram and Browsing mostly. 
Display : 90/100 - Not so bright and sharp as S series phones, but a real deal for the price. Impressed again. My only worry is about it is not having a Gorilla scratch proof glass. I may need to use tempered glass.
Touch : 95/100 - So smooth and I dont see any lags as of now.
Camera : 90/100 - Photos are good and can capture fast, but again not as great as S series phones. but at this price I believe this phone outclasses all other competitors in camera department. 

One last thing is about the SAMSUNG brand and its service center coverage, which is again awesome. 
Overall I am completely satisfied with the phone and this phone reached my expectations. 
What I disliked:
Earphone jack at the bottom.. I feel uncomfortable when chatting and listening to songs at same time
Low speaker volume, not a big deal though for me, As i don't use loudspeaker for songs mostly", u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'e786669a-024b-4ef0-b70c-1e4fcf5fe5ff', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 272, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'e786669a-024b-4ef0-b70c-1e4fcf5fe5ff', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 87, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'e786669a-024b-4ef0-b70c-1e4fcf5fe5ff', u'author': u'Naresh Kareti', u'url': u'/reviews/e786669a-024b-4ef0-b70c-1e4fcf5fe5ff', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'e786669a-024b-4ef0-b70c-1e4fcf5fe5ff', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 185, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 185, u'created': u'13 May, 2016', u'certifiedBuyer': True, u'title': u'Absolute Stunner and Impressive', u'type': u'ProductReviewValue'}, u'tracking': None}
{u'action': None, u'fixed': False, u'value': {u'rating': 3, u'text': u'Hi,

I got this phone from Flipkart on Friday and here is my 3 days review.

Pros:
 * Beautiful design
 * Very handy, easy to handle
 * Battery backup is great
 * Back camera is good
 * No heating issues
 
Cons:
 * If we are charging, it will not show any light or any notification whether it is charging or not. We need to on the screen and check whether it is charging or not. So every time we need to turn it on and see whether it is charging or not.
* Camera issue: Once you take the picture and then press the back button it is taking some time to come back to camera mode.
* If you turn on the flash and take pic with back camera it is taking some time to capture the picture. With out Flash it is taking very fast.
* Volume is very low. Not enough for a medium sized room.
* Ear phones are not good especially for me. 


Will post my feedback after using it another 15 days.

Thanks', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'9cbcd27c-a8ad-4793-978a-5903cd086252', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 212, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'9cbcd27c-a8ad-4793-978a-5903cd086252', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 67, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'9cbcd27c-a8ad-4793-978a-5903cd086252', u'author': u'ileep ', u'url': u'/reviews/9cbcd27c-a8ad-4793-978a-5903cd086252', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'9cbcd27c-a8ad-4793-978a-5903cd086252', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 145, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 145, u'created': u'16 May, 2016', u'certifiedBuyer': True, u'title': u'Good looking phone with some drawbacks', u'type': u'ProductReviewValue'}, u'tracking': None}
{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u'Super Amoled Display..2 GB RAM with Latest Android Marshmallow OS only for 13K....its difficult to get Samsung Phone with 2 GB ram in such a low price Range...used for 15 days....Going Smooth....Awesome Earphone Quality.....selfie and back Camera Good.....Battery last for more than a day with Continous usage or will go for two days....Free Microsoft apps and Much More...', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'1546ed16-5945-4257-9f2d-0d86db7ed92e', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 34, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'1546ed16-5945-4257-9f2d-0d86db7ed92e', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 9, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'1546ed16-5945-4257-9f2d-0d86db7ed92e', u'author': u'Prashant Dias', u'url': u'/reviews/1546ed16-5945-4257-9f2d-0d86db7ed92e', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'1546ed16-5945-4257-9f2d-0d86db7ed92e', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 25, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 25, u'created': u'7 Sep, 2016', u'certifiedBuyer': True, u'title': u'Brilliant Phone Compared to Money', u'type': u'ProductReviewValue'}, u'tracking': None}
{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u"Nice.battery backup it's good", u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'a9f2f6a0-2272-4187-bd37-48eb8a0a85c9', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 5, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'a9f2f6a0-2272-4187-bd37-48eb8a0a85c9', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'a9f2f6a0-2272-4187-bd37-48eb8a0a85c9', u'author': u'Flipkart Customer', u'url': u'/reviews/a9f2f6a0-2272-4187-bd37-48eb8a0a85c9', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'a9f2f6a0-2272-4187-bd37-48eb8a0a85c9', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 5, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 5, u'created': u'17 Aug, 2016', u'certifiedBuyer': True, u'title': u"It's very good", u'type': u'ProductReviewValue'}, u'tracking': None}
{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u'This Phone is awesome..Must Buy', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'cf8cf2c8-1f79-4d56-a4cd-e641ffb3551b', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 5, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'cf8cf2c8-1f79-4d56-a4cd-e641ffb3551b', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'cf8cf2c8-1f79-4d56-a4cd-e641ffb3551b', u'author': u'Durvank Aregekar', u'url': u'/reviews/cf8cf2c8-1f79-4d56-a4cd-e641ffb3551b', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'cf8cf2c8-1f79-4d56-a4cd-e641ffb3551b', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 5, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 5, u'created': u'10 Aug, 2016', u'certifiedBuyer': True, u'title': u'Must Buy', u'type': u'ProductReviewValue'}, u'tracking': None}
{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u'It is a good phone', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'ce31beb5-5c8f-4a2d-be7d-aba416592df2', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 5, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'ce31beb5-5c8f-4a2d-be7d-aba416592df2', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'ce31beb5-5c8f-4a2d-be7d-aba416592df2', u'author': u'Sourabh Jain', u'url': u'/reviews/ce31beb5-5c8f-4a2d-be7d-aba416592df2', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'ce31beb5-5c8f-4a2d-be7d-aba416592df2', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 5, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 5, u'created': u'9 Aug, 2016', u'certifiedBuyer': True, u'title': u'Good phone', u'type': u'ProductReviewValue'}, u'tracking': None}
{u'action': None, u'fixed': False, u'value': {u'rating': 5, u'text': u'delivery is in time but my phone is heat will data is on plz check', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'1fcf5a13-edef-4b16-8372-8732819c143c', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 9, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'1fcf5a13-edef-4b16-8372-8732819c143c', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 1, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'1fcf5a13-edef-4b16-8372-8732819c143c', u'author': u'Santhoaha m n santhu', u'url': u'/reviews/1fcf5a13-edef-4b16-8372-8732819c143c', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'1fcf5a13-edef-4b16-8372-8732819c143c', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 8, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 8, u'created': u'12 Aug, 2016', u'certifiedBuyer': True, u'title': u'very good', u'type': u'ProductReviewValue'}, u'tracking': None}
{u'action': None, u'fixed': False, u'value': {u'rating': 4, u'text': u'Good Product by Samsung

The things from this phone is
       1. Marshmellow v6.0
       2. Front flash with 5mb camera not so good
       3. Its design
       4. Primary Camera is not so good with 13mb led flash
       5. Battery life is also not so good
       6. Its size is correct in its design
       7. Supports OTG
       9. Only 2GB RAM
      10. 16GB Internal storage but only 11GB is availiable
      11. 4G supports
      12. Ultra power saving mode
      13. S bike mode
      14. Speaker volume is not so good
      15. 3G supports
      16. Ultra data saving
      17. No auto brightness
      18. 2G supports
      19. Top performance 
      20. Good phone at the price 14000
      *********************', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'958efa75-1b67-4872-9f71-b18035fafe6a', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 20, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'958efa75-1b67-4872-9f71-b18035fafe6a', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 5, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'958efa75-1b67-4872-9f71-b18035fafe6a', u'author': u'Vaishnav ', u'url': u'/reviews/958efa75-1b67-4872-9f71-b18035fafe6a', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'958efa75-1b67-4872-9f71-b18035fafe6a', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 15, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 15, u'created': u'17 May, 2016', u'certifiedBuyer': True, u'title': u'By Expert     -Vaishnav VJ', u'type': u'ProductReviewValue'}, u'tracking': None}
{u'action': None, u'fixed': False, u'value': {u'rating': 4, u'text': u'Very nice device', u'reportAbuse': {u'action': {u'originalUrl': None, u'params': {u'vote': u'ABUSE', u'reviewId': u'c7177dfb-39c2-4c0b-8bbd-288f96757c3a', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'totalCount': 4, u'downvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'DOWN', u'reviewId': u'c7177dfb-39c2-4c0b-8bbd-288f96757c3a', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 0, u'type': u'VoteValue'}, u'tracking': None}, u'id': u'c7177dfb-39c2-4c0b-8bbd-288f96757c3a', u'author': u'Flipkart Customer', u'url': u'/reviews/c7177dfb-39c2-4c0b-8bbd-288f96757c3a', u'upvote': {u'action': {u'originalUrl': None, u'params': {u'vote': u'UP', u'reviewId': u'c7177dfb-39c2-4c0b-8bbd-288f96757c3a', u'reviewDomain': u'PRODUCT'}, u'loginType': u'LEGACY_LOGIN', u'url': None, u'fallback': None, u'type': u'REVIEW_VOTE', u'omnitureData': None, u'screenType': None, u'tracking': {}}, u'fixed': False, u'value': {u'count': 4, u'type': u'VoteValue'}, u'tracking': None}, u'helpfulCount': 4, u'created': u'8 Sep, 2016', u'certifiedBuyer': True, u'title': u'Good quality product', u'type': u'ProductReviewValue'}, u'tracking': None}

The x-user-agent is required, without it you will get a 403. You can play around with the parameters to see different results, I will leave that up to you.

这篇关于Python Scraping - 无法从 Flipkart 获取所需数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆