Python Forum
How to check if video has been deleted or removed in youtube using python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to check if video has been deleted or removed in youtube using python
#3
You should look YouTube Data API v3.
Need a google account then get can get free API key and most also enable API.
Then can parse out video id out of csv and check if it's publicStatsViewable True or False.
Url is build like this.
https://www.googleapis.com/youtube/v3/videos?id={id_of_the_video}&key={your_api_key}&part=status
Then can write code.
import requests
from pprint import pprint

id_of_video = 'CUNq2_VjRn4'
your_api_key = 'xxxxxxxxxxxxxx'

url = f'https://www.googleapis.com/youtube/v3/videos?id={id_of_video}&key={your_api_key}&part=status'
url_get = requests.get(url)
pprint(url_get.json())
Output:
{'etag': '"RmznBCICv9YtgWaaa_nWDIH1_GM/XBA-sYAccdJQD803PbrNziArt-U"', 'items': [{'etag': '"RmznBCICv9YtgWaaa_nWDIH1_GM/i4VlXNZUnKWY8OIv_qh-vAbzstI"', 'id': 'CUNq2_VjRn4', 'kind': 'youtube#video', 'status': {'embeddable': True, 'license': 'youtube', 'privacyStatus': 'public', 'publicStatsViewable': True, 'uploadStatus': 'processed'}}], 'kind': 'youtube#videoListResponse', 'pageInfo': {'resultsPerPage': 1, 'totalResults': 1}}
The part needed.
>>> url_get.json()['items'][0]['status']['publicStatsViewable']
True
Reply


Messages In This Thread
RE: How to check if video has been deleted or removed in youtube using python - by snippsat - Apr-10-2018, 05:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Video recording with Raspberry Pi - What´s wrong with my python code? Montezuma1502 3 1,180 Feb-24-2023, 06:14 PM
Last Post: deanhystad
  How to output Python in Spout or any other video sharing network? buzzdarkyear 4 2,073 Jan-11-2022, 11:37 AM
Last Post: buzzdarkyear
  deleted Overdue 0 1,115 Dec-14-2021, 06:57 PM
Last Post: Overdue
  How to make a bot in pycharm for youtube for automatically adding python comments kodek2222 1 2,027 Jan-21-2021, 12:47 PM
Last Post: Aspire2Inspire
  How to preserve x-axis labels despite deleted subplot? Mark17 1 1,889 Dec-23-2020, 09:02 PM
Last Post: Mark17
  Openpyxl: Excel formula & condition formatting removed JaneTan 0 3,561 Sep-25-2020, 07:02 AM
Last Post: JaneTan
  Why is one duplicate not removed? Emekadavid 4 2,283 Jun-09-2020, 06:34 PM
Last Post: perfringo
  How to get Data-Taken For a Video file using Python ramprasad1211 1 1,862 Apr-28-2020, 08:48 AM
Last Post: ndc85430
  Get list of Video Device in python on Windows machine Michal 1 10,338 Apr-03-2020, 06:57 PM
Last Post: Mateusz
  Youtube video transcripts jehoshua 2 3,774 Feb-15-2020, 09:55 PM
Last Post: jehoshua

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020