Hello everyone,
I am trying to add value with key “resolution” in Resolution Global list. What i exactly want is that.
Add the key "resolution"of its value in Global Resolution List from “formats”.
if there is no such key inside format - all items with “resolution” key then store value with key “format_id”
- Store values in a global Resolution list:
- For each item in the
formats
list:- If the item contains a key called
resolution
, I want to store its value in a global list. - If the
resolution
key is missing, I want to store the value of theformat_id
key instead.
- If the item contains a key called
Here’s a simplified example of what the final list should look like:
audio only
sd
hd
640x360
960x540
1280x720
1280x720
1280x720
1280x720
Here what i have tried So far, but except “hd” and “sd” all values are stored in list
not
Here is Screenshots
Here is Json Data
{
"id": "793CCE5888B7E619",
"type": "info",
"state": "completed",
"result": [
{
"_type": "video",
"id": "415613308191022",
"title": "Galaxy Impact 💪🔥",
"ext": "mp4",
"format": "941283924693935v - 1280x720 (DASH video)+508062831900816a - audio only (DASH audio)",
"format_id": "941283924693935v+508062831900816a",
"protocol": "https+https",
"formats": [
{
"url": "https://videCDg\u0026oe=66BA4565",
"ext": "m4a",
"format": "508062831900816a - audio only (DASH audio)",
"format_id": "508062831900816a",
"format_note": "DASH audio",
"resolution": "audio only",
"tbr": 65.276,
"abr": 65.276,
"asr": 44100,
"acodec": "mp4a.40.5",
"vcodec": "none",
"container": "m4a_dash",
"protocol": "https"
},
{
"url": "https://videvideo-iad3-2.xx\u0026oh=00_AYA7kXZsxPeNSSelEddLbnpIM8PD8V0Eak3nDZ4A4hmkLg\u0026oe=66BA37CD",
"ext": "mp4",
"format": "sd - unknown",
"format_id": "sd",
"dynamic_range": "SDR",
"protocol": "https"
},
{
"url": "https://video-iad3-2pdmVfZW5jb2RpbmdzAA%3D%3D\u0026ccb=9-4\u0026oh=00_AYCxq4pHL2qIHzq4kPizA7ajo1tRcR7aXenCucfbC0_nAA\u0026oe=66B6613A\u0026_nc_sid=1d576d\u0026_nc_rid=907692684851089\u0026_nc_store_type=1",
"ext": "mp4",
"format": "hd - unknown",
"format_id": "hd",
"dynamic_range": "SDR",
"protocol": "https"
},
{
"url": "https://video-iad3-1.xx.fbcdn.net/v/t39.25447-2/45A3FF1",
"ext": "mp4",
"format": "1006268144155534v - 640x360 (DASH video)",
"format_id": "1006268144155534v",
"format_note": "DASH video",
"width": 640,
"height": 360,
"aspect_ratio": 1.78,
"resolution": "640x360",
"dynamic_range": "SDR",
"tbr": 155.907,
"vbr": 155.907,
"acodec": "none",
"vcodec": "av01.0.01M.08.0.111.01.01.01.0",
"container": "mp4_dash",
"protocol": "https"
},
{
"url": "https://video-iad3-2.xx.fbcd6BA4D51",
"ext": "mp4",
"format": "1656508601560194v - 960x540 (DASH video)",
"format_id": "1656508601560194v",
"format_note": "DASH video",
"width": 960,
"height": 540,
"aspect_ratio": 1.78,
"resolution": "960x540",
"dynamic_range": "SDR",
"tbr": 222.312,
"vbr": 222.312,
"acodec": "none",
"vcodec": "av01.0.04M.08.0.111.01.01.01.0",
"container": "mp4_dash",
"protocol": "https"
},
{
"url": "https://video-iad3-1.xx.fbcdn.net/6oe=66BA466B",
"ext": "mp4",
"format": "497431662977749v - 1280x720 (DASH video)",
"format_id": "497431662977749v",
"format_note": "DASH video",
"width": 1280,
"height": 720,
"aspect_ratio": 1.78,
"resolution": "1280x720",
"dynamic_range": "SDR",
"tbr": 310.569,
"vbr": 310.569,
"acodec": "none",
"vcodec": "av01.0.05M.08.0.111.01.01.01.0",
"container": "mp4_dash",
"protocol": "https"
},
{
"url": "https://video-ia26oe=66BA5518",
"ext": "mp4",
"format": "1734627563739393v - 1280x720 (DASH video)",
"format_id": "1734627563739393v",
"format_note": "DASH video",
"width": 1280,
"height": 720,
"aspect_ratio": 1.78,
"resolution": "1280x720",
"dynamic_range": "SDR",
"tbr": 508.608,
"vbr": 508.608,
"acodec": "none",
"vcodec": "av01.0.05M.08.0.111.01.01.01.0",
"container": "mp4_dash",
"protocol": "https"
},
{
"url": "https://video-iad3-1.xx.fbcdn.net/66BA5D6C",
"ext": "mp4",
"format": "1646502342557067v - 1280x720 (DASH video)",
"format_id": "1646502342557067v",
"format_note": "DASH video",
"width": 1280,
"height": 720,
"aspect_ratio": 1.78,
"resolution": "1280x720",
"dynamic_range": "SDR",
"tbr": 757.49,
"vbr": 757.49,
"acodec": "none",
"vcodec": "av01.0.05M.08.0.111.01.01.01.0",
"container": "mp4_dash",
"protocol": "https"
},
{
"url": "https://vide026oe=66BA5213",
"ext": "mp4",
"format": "941283924693935v - 1280x720 (DASH video)",
"format_id": "941283924693935v",
"format_note": "DASH video",
"width": 1280,
"height": 720,
"aspect_ratio": 1.78,
"resolution": "1280x720",
"dynamic_range": "SDR",
"tbr": 1082.225,
"vbr": 1082.225,
"acodec": "none",
"vcodec": "av01.0.05M.08.0.111.01.01.01.0",
"container": "mp4_dash",
"protocol": "https"
}
],
"description": "Galaxy Impact 💪🔥",
"display_id": "415613308191022",
"duration": 154.366,
"duration_string": "2:34",
"view_count": 563632,
"thumbnail": "https://sconte26_nc_ht=scontent-iad3-2.xx\u0026oh=00_AYB_BeBY3VWqfvJyKvW2hTu6QK2214Mv0OLfuWXmir5YXw\u0026oe=66BA2956",
"thumbnails": [
{
"id": "0",
"url": "https://scontentiad3-2.xx\u0026oh=00_AYB_BeBY3VWqfvJyKvW2hTu6QK2214Mv0OLfuWXmir5YXw\u0026oe=66BA2956"
}
],
"uploader": "XYZ",
"uploader_id": "100062925774958",
"upload_date": "20240804",
"timestamp": 1722733024,
"subtitles": {
"en_US": [
{
"url": "https://scontent-iad3-2.xx.fbcdn.net/v/t39.2093-6/453752u0026oe=66BA2B91",
"ext": "srt"
}
]
},
"extractor": "facebook",
"extractor_key": "Facebook",
"webpage_url": "https://m.facebook.com/watch/r",
"original_url": "https://www.facebook.com/share",
"webpage_url_basename": "watch",
"webpage_url_domain": "m.facebook.com"
}
]
}