Есть файл JSON:
{
"success": 1,
"query_summary": {
"num_reviews": 2,
"review_score": 6,
"review_score_desc": "Mostly Positive",
"total_positive": 193,
"total_negative": 61,
"total_reviews": 254
},
"reviews": [{
"recommendationid": "128118903",
"author": {
"steamid": "76561198021689610",
"num_games_owned": 175,
"num_reviews": 5,
"playtime_forever": 310,
"playtime_last_two_weeks": 310,
"playtime_at_review": 72,
"last_played": 1670558682
},
"language": "russian",
"review": "Игра супер",
"timestamp_created": 1670441225,
"timestamp_updated": 1670441225,
"voted_up": true,
"votes_up": 122,
"votes_funny": 4,
"weighted_vote_score": "0.889815270900726318",
"comment_count": 0,
"steam_purchase": true,
"received_for_free": false,
"written_during_early_access": false,
"hidden_in_steam_china": true,
"steam_china_location": ""
}, {
"recommendationid": "128130582",
"author": {
"steamid": "76561198087666969",
"num_games_owned": 198,
"num_reviews": 17,
"playtime_forever": 1226,
"playtime_last_two_weeks": 1226,
"playtime_at_review": 327,
"last_played": 1670862732
},
"language": "russian",
"review": "Знаете то чувство, к",
"timestamp_created": 1670458344,
"timestamp_updated": 1670458344,
"voted_up": true,
"votes_up": 122,
"votes_funny": 9,
"weighted_vote_score": "0.870825231075286865",
"comment_count": 5,
"steam_purchase": true,
"received_for_free": false,
"written_during_early_access": false,
"hidden_in_steam_china": true,
"steam_china_location": ""
}],
"cursor": "AoIIP17uY3bh4+gD"
}
Соответственно в списке reviews тут 2 строки. Как обратиться к элементам в строках?
Вот так получается только из одной строки:
response = requests.get(url=url+appid, params=params)
parsed_json = response.json()
item["title"] = parsed_json['reviews'][0]['author']
А вот так уже выдает ошибку:
response = requests.get(url=url+appid, params=params)
parsed_json = response.json()
item["title"] = parsed_json['reviews'][0:]['author']
Вроде как надо сделать цикл разбивания на строки, тогда можно будет не указывать индекс, но попробовал несколько вариантов, не сработало.