Example #1
0
def download(frame, index=0):
    with open('download_index.txt', 'a') as fp:
        start_flag = False
        for i, item in enumerate(frame.values):
            fp.write(str(i) + '\n')
            url = item[2]
            if 'watch' not in url:
                continue
            print(i)
            print(url)
            if index == i:
                start_flag = True
                continue
            if not start_flag:
                continue
            try:
                result = youtube.download(url,
                                          output_dir='/data/videos',
                                          merge=False)
            except KeyError as e:
                continue
            except SyntaxError as e:
                continue
            except Exception as e:
                raise
Example #2
0
 def download(self, path):
     socks.setdefaultproxy(None)
     socket.socket = socks.socksocket
     i = 0
     for name, url, duration in self.videos_list:
         self.log_signal.emit('正在下载第{}个视频'.format(i + 1))
         i = i + 1
         try:
             youtube.download(url,
                              merge=True,
                              output_dir=path,
                              caption=True)
         except Exception:
             self.log_signal.emit(
                 'An video error occurred when download:\n')
             continue
Example #3
0
 def test_youtube(self):
     youtube.download('http://www.youtube.com/watch?v=pzKerr0JIPA',
                      info_only=True)
     youtube.download('http://youtu.be/pzKerr0JIPA', info_only=True)
     youtube.download(
         'http://www.youtube.com/attribution_link?u=/watch?v%3DldAKIzq7bvs%26feature%3Dshare',  # noqa
         info_only=True)
     youtube.download('https://www.youtube.com/watch?v=Fpr4fQSh1cc',
                      info_only=True)
Example #4
0
 def test_youtube(self):
     youtube.download(
         'http://www.youtube.com/watch?v=pzKerr0JIPA', info_only=True
     )
     youtube.download('http://youtu.be/pzKerr0JIPA', info_only=True)
     youtube.download(
         'http://www.youtube.com/attribution_link?u=/watch?v%3DldAKIzq7bvs%26feature%3Dshare',  # noqa
         info_only=True
     )
Example #5
0
def test_youtube():
    youtube.download('http://www.youtube.com/watch?v=CboJMlgfyMA',
                     output_dir='/data/videos',
                     merge=True)