保存一些 youtube 视频的描述 [英] Save description of a number of youtube videos
本文介绍了保存一些 youtube 视频的描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要保存 YouTube 视频列表的说明.我想提供视频的网址(即 http://www.youtube.com/watch?v=sVtkQCz9Sx8),然后获取youtube视频关于"部分的相应信息.我什至可以在不学习编程基础知识的情况下做到这一点吗?
I need to save descriptions of a list of youtube videos. I want to feed the urls of videos (i.e. http://www.youtube.com/watch?v=sVtkQCz9Sx8) and then get the corresponding info of the "about" section of the youtube video. Is this possible for me to do without learning even basics of programming?
推荐答案
在 python 3 中,是这样的:
In python 3, something like this :
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
from urllib.request import urlopen
with open('links.txt') as f:
for link in f:
page = urlopen(link)
soup = BeautifulSoup(page.read())
description_tag = soup.find(id='eow-description')
upload_date_tag = soup.find(id='eow-date')
print(link)
print('Published on', upload_date_tag.text)
print(description_tag.text)
print()
在 links.txt 中输入您的网址(每行一个网址).
Type your urls in links.txt (one url per lines).
这篇关于保存一些 youtube 视频的描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文