代码说明
开发工具:pycharm
开发语言:python
实施工具:chrome
代码功能:
运行后,能够根据关键字 打开谷歌浏览器,自行搜索关键词,并进行down视频
完整代码
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import youtube_dl
import os
import multiprocessing
def dwl_vid(vidoelink=[]):
ydl_opts = {
} # 用以规定视频参数
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([vidoelink])
time.sleep(50)
print("下载完成")
def getvideos(key,count_videos,sleeptime=5):
'''
:param key: 搜索关键字
:param count: 下载视频个数
:param sleeptime: 每次加载视频列表等待时间,和网速有关
:return:
'''
options = webdriver.ChromeOptions()
options.add_argument(&#