Skip to content

Instantly share code, notes, and snippets.

@harej
Created September 28, 2017 02:01
Show Gist options
  • Save harej/30f71eacac7654c0b4bb4183e120ea33 to your computer and use it in GitHub Desktop.
Save harej/30f71eacac7654c0b4bb4183e120ea33 to your computer and use it in GitHub Desktop.
import random
import requests
from time import sleep
while True:
random_id = ''.join(random.choices('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_', k=11))
url = 'https://www.youtube.com/watch?v=' + random_id
r = requests.get(url)
if r.text.find('This video is unavailable') == -1:
print(url)
break
sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment