You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
570 B
Python
24 lines
570 B
Python
|
11 months ago
|
import json
|
||
|
|
|
||
|
|
filePath = 'test.json'
|
||
|
|
|
||
|
|
with open(filePath, 'r', encoding='utf-8') as f:
|
||
|
|
data = json.load(f)
|
||
|
|
|
||
|
|
print(data)
|
||
|
|
|
||
|
|
|
||
|
|
posts = data['data']['xdt_api__v1__feed__user_timeline_graphql_connection']['edges']
|
||
|
|
posts = [post['node'] for post in posts]
|
||
|
|
|
||
|
|
for post in posts:
|
||
|
|
biggestRes = 0
|
||
|
|
images = post['image_versions2']['candidates']
|
||
|
|
for image in images:
|
||
|
|
width = image['width']
|
||
|
|
height = image['height']
|
||
|
|
if width * height > biggestRes:
|
||
|
|
biggestRes = width * height
|
||
|
|
goodPost = post
|
||
|
|
|
||
|
|
print(goodPost)
|