我正在使用 python 运行一些基本代码。 我正在使用https://pypi.org/project/play-scraper/玩刮板。
启动命令 print(play_scraper.details('com.android.chrome')) 时我回来了
AttributeError: 'NoneType' object has no attribute 'select'
我尝试调试该问题,但问题似乎返回一个空列表:
section_titles_divs = [x for x in soup.select('div.hAyfc div.BgcNfc')]
直到几周前,我收到了这样的消息:
{
'app_id': 'com.android.chrome',
'category': ['COMMUNICATION'],
'content_rating': ['Everyone'],
'current_version': 'Varies with device',
'description': 'Google Chrome is a fast, easy to use, and secure web browser. Designed for Android, Chrome brings you personalized news ...',
'description_html': 'Google Chrome is a fast, easy to ... Chrome web browser experience you love across all your devices.<br/> <br/> <b>Browse fast and type less.</b> ...',
'developer': 'Google LLC',
'developer_address': '1600 Amphitheatre Parkway, Mountain View 94043',
'developer_email': 'apps-help@google.com',
'developer_id': '5700313618786177705',
'developer_url': 'http://www.google.com/chrome/android',
'editors_choice': False,
'free': True,
'histogram': { 1: 672180, 2: 288519, 3: 735220, 4: 1560066, 5: 6033423},
'iap': False,
'iap_range': None,
'icon': 'https://lh3.googleusercontent.com/nYhPnY2I-e9rpqnid9u9aAODz4C04OycEGxqHG5vxFnA35OGmLMrrUmhM9eaHKJ7liB-',
'installs': '1,000,000,000+',
'interactive_elements': ['Unrestricted Internet'],
'price': '0',
'recent_changes': u"Thanks for choosing Chrome! You can now find your saved passwords more easily \u2013 just tap the new Search icon in Settings > Passwords. We've also included stability and performance improvements.",
'required_android_version': 'Varies with device',
'reviews': 9289408,
'score': '4.3',
'screenshots': [ 'https://lh3.googleusercontent.com/lKPDNfsO2QhJD9i77rGDTiH5ILjXlXwPsRi194hhkY4BsbaXbpCFrdjWvcU1zttUwqXz=w720-h310-rw', ...],
'size': 'Varies with device',
'title': 'Google Chrome: Fast & Secure',
'updated': 'May 10, 2018',
'url': 'https://play.google.com/store/apps/details?id=com.android.chrome',
'video': None
}
感谢您的帮助!
最佳答案
今天早上我也遇到了类似的问题。我在 utils 中进行了更改: extra_info_data = parse_additional_info(soup.select_one('.IxB2fe'))
至
additional_info_data = parse_additional_info(soup.select_one('div.IxB2fe'))
页面正在加载上述选择器的两个引用,第一个结果是不正确的。我假设它曾经是只有一个结果可以匹配的地方。
希望这有帮助!我今天早上玩得很开心,这是肯定的。
关于python - 玩刮刀空响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55636086/