<file_sep>import threading
import pyperclip

class ClipboardWatcher(threading.Thread):
    urls = set()
    def __is_youtube_url(self,url):
        if 'https://www.youtube.com/watch?v=' in url:
            return True
        return False

    def __init__(self):
        super(ClipboardWatcher, self).__init__()

        self._stopping = False

    def run(self):
        recent_value = ""
        pyperclip.copy('')

        while not self._stopping:
            tmp_value = pyperclip.paste()
            if tmp_value != recent_value and self.__is_youtube_url(tmp_value):
                recent_value = tmp_value
                if recent_value not in self.urls:
                    self.urls.add(recent_value)
                    print(recent_value)

    def stop(self):
        self._stopping = True

    def get_urls(self):
        return self.urls<file_sep>from  dlmanager import manager
from clipboard import ClipboardWatcher
import time
def main():
    watcher = ClipboardWatcher()
    watcher.start()
    while True:
        try:
            # print "Waiting for changed clipboard..."
            time.sleep(1)
        except KeyboardInterrupt:
            watcher.stop()
            mgr=manager()
            mgr.start(watcher.get_urls())
            break


if __name__ == "__main__":
    main()<file_sep>import youtube_dl
import json

class manager():
    links=None
    def __init__(self):
        super().__init__()
    
    def __putque(self,links):
         lista=list()
         for i in links:             
             lista.append({"link":i,"finished":False})
         with open('lista.json','a') as f:     
             json.dump(lista,f,indent=2)

    def start(self,links):
        self.links=links
        ydl_opts = {
                'format': '137+140',
                'writesubtitles': True,
                'postprocessors': [{
                    'key': 'FFmpegSubtitlesConvertor',
                    'format': 'srt'

                }]
            }
        self.__putque(links)
        with youtube_dl.YoutubeDL(ydl_opts) as ydl:
                ydl.download(self.links)

