Skip to content

Instantly share code, notes, and snippets.

@spookyahell
Last active September 22, 2018 16:16
Show Gist options
  • Save spookyahell/8be293c2a3b79eb10f5ff8770502cdee to your computer and use it in GitHub Desktop.
Save spookyahell/8be293c2a3b79eb10f5ff8770502cdee to your computer and use it in GitHub Desktop.
Ever needed that one YouTube ad downloaded but didn't know how to get the URL? (while watch on your computer) Just copy debug infos to clipboard via right click on the viewer and then run this script. (Run in python3.6+)
import re
from tkinter import Tk
AdDocId = None
text = Tk().clipboard_get()
for line in text.split('\n'):
x = re.search('"ad_docid": "(.+)"', line)
if x:
AdDocId = x.group(1)
break
#~ print()
if AdDocId is not None:
input(f'https://www.youtube.com/watch?v={AdDocId}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment