Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Fijxu/79ddab062a572bc1b1bf7cf48eefe72f to your computer and use it in GitHub Desktop.
Save Fijxu/79ddab062a572bc1b1bf7cf48eefe72f to your computer and use it in GitHub Desktop.
require "json"
microformat_from_player = %({
"microformat": {
"playerMicroformatRenderer": {
"thumbnail": {
"thumbnails": [
{
"url": "https://i.ytimg.com/vi/e3CVv6cqoUQ/maxresdefault.jpg",
"width": 1280,
"height": 720
}
]
},
"embed": {
"iframeUrl": "https://www.youtube.com/embed/e3CVv6cqoUQ",
"width": 1280,
"height": 720
},
"title": {
"simpleText": "Wikipedia Just Lost..."
},
"description": {
"simpleText": "test"
},
"lengthSeconds": "1066",
"ownerProfileUrl": "http://www.youtube.com/@SomeOrdinaryGamers",
"externalChannelId": "UCtMVHI3AJD4Qk4hcbZnI9ZQ",
"isFamilySafe": true,
"availableCountries": [
"AD",
"AE",
"AF",
"AG",
"AI",
"AL",
"AM",
"AO",
"AQ",
"AR",
"AS",
"AT",
"AU",
"AW",
"AX",
"AZ",
"BA",
"BB",
"BD",
"BE",
"BF",
"BG",
"BH",
"BI",
"BJ",
"BL",
"BM",
"BN",
"BO",
"BQ",
"BR",
"BS",
"BT",
"BV",
"BW",
"BY",
"BZ",
"CA",
"CC",
"CD",
"CF",
"CG",
"CH",
"CI",
"CK",
"CL",
"CM",
"CN",
"CO",
"CR",
"CU",
"CV",
"CW",
"CX",
"CY",
"CZ",
"DE",
"DJ",
"DK",
"DM",
"DO",
"DZ",
"EC",
"EE",
"EG",
"EH",
"ER",
"ES",
"ET",
"FI",
"FJ",
"FK",
"FM",
"FO",
"FR",
"GA",
"GB",
"GD",
"GE",
"GF",
"GG",
"GH",
"GI",
"GL",
"GM",
"GN",
"GP",
"GQ",
"GR",
"GS",
"GT",
"GU",
"GW",
"GY",
"HK",
"HM",
"HN",
"HR",
"HT",
"HU",
"ID",
"IE",
"IL",
"IM",
"IN",
"IO",
"IQ",
"IR",
"IS",
"IT",
"JE",
"JM",
"JO",
"JP",
"KE",
"KG",
"KH",
"KI",
"KM",
"KN",
"KP",
"KR",
"KW",
"KY",
"KZ",
"LA",
"LB",
"LC",
"LI",
"LK",
"LR",
"LS",
"LT",
"LU",
"LV",
"LY",
"MA",
"MC",
"MD",
"ME",
"MF",
"MG",
"MH",
"MK",
"ML",
"MM",
"MN",
"MO",
"MP",
"MQ",
"MR",
"MS",
"MT",
"MU",
"MV",
"MW",
"MX",
"MY",
"MZ",
"NA",
"NC",
"NE",
"NF",
"NG",
"NI",
"NL",
"NO",
"NP",
"NR",
"NU",
"NZ",
"OM",
"PA",
"PE",
"PF",
"PG",
"PH",
"PK",
"PL",
"PM",
"PN",
"PR",
"PS",
"PT",
"PW",
"PY",
"QA",
"RE",
"RO",
"RS",
"RU",
"RW",
"SA",
"SB",
"SC",
"SD",
"SE",
"SG",
"SH",
"SI",
"SJ",
"SK",
"SL",
"SM",
"SN",
"SO",
"SR",
"SS",
"ST",
"SV",
"SX",
"SY",
"SZ",
"TC",
"TD",
"TF",
"TG",
"TH",
"TJ",
"TK",
"TL",
"TM",
"TN",
"TO",
"TR",
"TT",
"TV",
"TW",
"TZ",
"UA",
"UG",
"UM",
"US",
"UY",
"UZ",
"VA",
"VC",
"VE",
"VG",
"VI",
"VN",
"VU",
"WF",
"WS",
"YE",
"YT",
"ZA",
"ZM",
"ZW"
],
"isUnlisted": false,
"hasYpcMetadata": false,
"viewCount": "158900",
"category": "Gaming",
"publishDate": "2025-08-12T16:42:14-07:00",
"ownerChannelName": "SomeOrdinaryGamers",
"uploadDate": "2025-08-12T16:42:14-07:00",
"isShortsEligible": false,
"externalVideoId": "e3CVv6cqoUQ",
"likeCount": "13153",
"canonicalUrl": "https://www.youtube.com/watch?v=e3CVv6cqoUQ"
}
}
})
microformat_from_next = %(
{
"microformat": {
"microformatDataRenderer": {
"videoDetails": {
"comments": [
{
"@type": "https://schema.org/Comment",
"dateCreated": "2025-08-12T17:25:20-07:00",
"text": "Censoring an encyclopedia, what even is going on...",
"author": {
"@type": "https://schema.org/Person",
"name": "@kiwicami287",
"url": "https://www.youtube.com/@kiwicami287",
"alternateName": "Kiwicami"
},
"upvoteCount": 3066
}
]
}
}
}
})
player_response = JSON.parse(microformat_from_player).as_h
next_response = JSON.parse(microformat_from_next).as_h
merged = player_response.merge(next_response)
puts "merged:"
pp merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment