Skip to content

Instantly share code, notes, and snippets.

@emsesc
Last active February 10, 2023 20:43
Show Gist options
  • Save emsesc/e6d7ce8b3b54aabc0db55fe347b001e8 to your computer and use it in GitHub Desktop.
Save emsesc/e6d7ce8b3b54aabc0db55fe347b001e8 to your computer and use it in GitHub Desktop.
Output of YouTube API

Python Script

from youtube_api import YouTubeDataAPI

# Set the API key
API_KEY=""

yt = YouTubeDataAPI(API_KEY)

# Channel IDs
ids = ["UCZBEpllW49CkLE0szqpvJAQ", "UCu7G08TrwPx_0WH4M7OxjIQ"]
videos = []

# attempts to get videos
for id in ids:
  descriptions = []
  print("Channel ID: " + str(id))
  result = yt.search(maxResults=10, channel_id=id, part=["snippet", "id"], published_after=None, published_before=None)
  # loops through each video received in result
  for video in result:
    metadata = yt.get_video_metadata(video['video_id'], part=["statistics", "snippet"])
    descriptions.append(metadata['video_description'])
  videos.append({"id": id, "descriptions": descriptions})

print(videos)

Object Output

"\\"[
   {
      "id":"UCZBEpllW49CkLE0szqpvJAQ",
      "descriptions":[
         "Subscribe to our channel and turn on bell notifications so you don\\'t miss a video 🎥:  https://www.youtube.com/POGOwatchdog?sub_confirmation=1\n\nThroughout history, Presidents have invoked executive privilege to shield themselves from legal process. Does this put the President above the law?\n_________________________________________________________________________________________________\n\nFurther reading:\nhttps://www.pogo.org/tcp\n\n_________________________________________________________________________________________________\n\nFollow POGO on Twitter: https://twitter.com/pogowatchdog\nInstagram:  https://www.instagram.com/pogowatchdog/?hl=en\nAnd Facebook: https://www.facebook.com/pogo.org\n\n_________________________________________________________________________________________________\n\nMusic\n\"Corporate Technology\" by Scott Holmes (c) copyright 2018. Licensed under a Creative Commons Attribution-NonCommercial (4.0) International license. https://creativecommons.org/licenses/by-nc/4.0/legalcode\n\n“I Am Running Down the Long Hallway of Viewmont Elementary” by Chris Zabriskie. Licensed under a Creative Commons Attribution (4.0) International license. https://creativecommons.org/licenses/by/4.0/legalcode\n\n“Namaste” by Jason Shaw. Licensed under an Attribution 3.0 United States License. https://creativecommons.org/licenses/by/3.0/us/legalcode\n\n_________________________________________________________________\n\nGraphics\n\"Mini Glitch Pack,\" Motion Array, by Moysher.\nVector designed by Freepik from www.flaticon.com\n\n_________________________________________________________________\n\nMultimedia provided by \nABC News, Associated Press, C-SPAN, CNN, National Archives, New York Daily News, Oyez, and The Washington Post.",
         "Subscribe to our channel and turn on bell notifications so you don't miss a video 🎥:  https://www.youtube.com/POGOwatchdog?sub_confirmation=1\n\nIt seems like inspectors general are all over the news these days, but what exactly is an inspector general, anyway? Let's break it down.\n______________________________________________________________________________________________\n\nFurther reading on inspectors general:\nhttps://www.pogo.org/inspectors-general\n\n______________________________________________________________________________________________\n\nFollow POGO on Twitter: https://twitter.com/pogowatchdog\nInstagram:  https://www.instagram.com/pogowatchdog/?hl=en\nAnd Facebook: https://www.facebook.com/pogo.org",
         "Subscribe to our channel and turn on bell notifications so you don't miss a video 🎥:  \nhttps://www.youtube.com/POGOwatchdog?sub_confirmation=1\n\nThe Supreme Court wields massive influence in our democracy, but this power is concentrated in the hands of just a few individuals. It's no wonder then that the struggle over who gets to sit on the bench is so hotly debated -- every seat on the court is critical to shaping its political influence. That problem starts with the composition of the court.",
         "Subscribe to our channel and turn on bell notifications so you don't miss a video 🎥: \nhttps://www.youtube.com/POGOwatchdog?sub_confirmation=1\n\nA little-known agency is risking your financial future. Are we destined for another financial disaster? Read David Hilzenrath’s latest investigation at https://www.pogo.org/series-collections/your-financial-security-on-the-line/\n\n___________________________________________________________________________________________________\n\nFurther reading:\nhttps://www.pogo.org/investigation/2019/09/how-an-agency-youve-never-heard-of-is-leaving-the-economy-at-risk/\nhttps://www.pogo.org/investigation/2020/01/how-accountants-took-washingtons-revolving-door-to-a-criminal-extreme/\n\n___________________________________________________________________________________________________\n\nFollow POGO on Twitter: https://twitter.com/pogowatchdog\nInstagram:  https://www.instagram.com/pogowatchdog/?hl=en\nAnd Facebook: https://www.facebook.com/pogo.org",
         "Subscribe to our channel and turn on bell notifications so you don\\'t miss a video 🎥: \nhttps://www.youtube.com/POGOwatchdog?sub_confirmation=1\n\nFollow POGO on Twitter: https://twitter.com/pogowatchdog\nInstagram:  https://www.instagram.com/pogowatchdog/?hl=en\nAnd Facebook: https://www.facebook.com/pogo.org\n\n\nWATCH The F-35 in 2 Minutes: https://www.youtube.com/watch?v=Y22-UsnARVo\n___________________________________________________________________________________________________\n\nIn this interview, Air Force Technical Sergeant Robert Gutierrez discusses a firefight, in which he directed A-10 \"Warthogs\" from the ground against enemy targets within close proximity (\"Danger Close\").  For his heroism during this battle, Sergeant Gutierrez was awarded the Air Force Cross.  \n\nBackground: On 5 October, 2009, Sergeant Gutierrez, a Joint Terminal Attack Controller (JTAC) embedded with a special operations team in Afghanistan, was on a kill/capture mission for a high-value Taliban leader.  The special operations team met the enemy, who was well prepared for a firefight, and became split and pinned down in a compound by intense, accurate, and effective small arms fire. \n\nThis portion of the interview picks up after Sergeant Gutierrez describes taking a bullet to the chest and the medical attention he received under fire. He was forced to abort a remotely piloted aircraft due to misidentification of the target (it was targeting their building).  His team had also received a show of force flyby by F-16s, which departed early because their aircraft were low on fuel. \n\nSergeant Gutierrez describes how a flight of A-10s\\' lethal 30 MM strafe killed the enemy (who was within 20 feet of Gutierrez\\'s position) and ultimately saved the lives of his teammates. \n\nThis video exemplifies why ground commanders still require \"close-in\" firepower (effects within 100 meters) on the spectrum of close air support (CAS), and why the A-10 is currently the world\\'s premier CAS aircraft for these effects."
      ]
   },
   {
      "id":"UCu7G08TrwPx_0WH4M7OxjIQ",
      "descriptions":[
         "A report now shows that a part of the west Valley doesn't have 100 years of water left. Gov. Katie Hobbs accused the Ducey administration of burying the report.",
         "The Pipeline Fire and Haywire Fire are burning near Flagstaff. The Contreras Fire near Tucson has burned 25,000 acres and is 50% contained.",
         "Homeowner associations in Arizona will now have a more difficult time regulating residents attempting to organize against the HOA after lawmakers have successfully passed a new set of guidelines. \r\n\r\nHouse Bill 2158 intends to protect the rights of residents who choose to speak out against their HOA managers by barring associations from controlling certain forms of expression and activism.\r\n\r\nGov. Doug Ducey signed the bill into law this week after it passed through the Arizona Legislature.",
         "Arizona water officials now predict the West will enter the next stage of drought restrictions as soon as August.\r\n\r\nA Tier 2 shortage declaration would mean even more cuts to the amount of water Arizona gets from the Colorado River, but not nearly as much as the Tier 1 shortage declared in 2021.\r\n\r\nStill, officials with the Central Arizona Project and the Department of Water Resources warn the state needs to do more to conserve water to help stave off even more restrictive cuts.",
         "Increased development in the Arizona community of Pine-Strawberry is threatening the community's most precious resource: water. \r\n\r\nThe town's largest water supplier has seen more than half of its wells dry up, going from nearly 40 active wells to 14.\r\n\r\nThe situation has become so dire that residents are meeting with Sen. Mark Kelly's team to try and secure funding for potential solutions.\r\n\r\nThe main solution being purposed by town leaders, however, will only make matters worse, according to one of the state's leading hydrologists.\r\n\r\nFor more on this story: https://www.12news.com/article/news/regional/scorched-earth/pine-strawberry-water-wells-mark-kelly/75-2ef5bb41-af77-42cb-af03-ed199a303d5b"
      ]
   }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment