python 从youtube下载文件列表

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 从youtube下载文件列表相关的知识,希望对你有一定的参考价值。

'''
Copy the list from youtube and save it in a file urls.txt
Run this script to get all the urls
Put them in a file and run youtube-dl --playlist-start <number> --playlist-end <number> -a "filename.txt"
Download entire playlist
'''

from BeautifulSoup import BeautifulSoup

a = open('urls.txt', 'r')
b = a.read()
soup = BeautifulSoup(b)

urls = soup.findAll('a', {'class':'playlist-video clearfix  spf-link '})

print urls

for val in urls:
	print "http://youtube.com"+val['href']

以上是关于python 从youtube下载文件列表的主要内容,如果未能解决你的问题,请参考以下文章