我正在尝试直接从http://i.ytimg.com/读取缩略图,而不使用 google gdata 服务。谁能帮我?
`enter code here`
#!/usr/bin/env python
#_*_ encoding: UTF-8 _*_
from PyQt4.QtGui import QImageReader
from PyQt4.QtNetwork import (QNetworkRequest, QNetworkReply, QNetworkAccessManager)
from PyQt4.QtCore import QUrl
def getThumbnails(self,numTitles):
thumbs = []
thumbs[:]= []
nam = QNetworkAccessManager()
for i in xrange(numTitles):
url = QUrl("http://i.ytimg.com/vi/" + self.tubeLinks[i] + "/default.jpg")
request = QNetworkRequest(url)
reply = nam.get(request)
image_reader = QImageReader(reply)
thumbs.append(image_reader.read())
return thumbs
我的定义是:
1.- 如何测试拇指是否被成功读取?
2.- 如何使用像素图将它们添加到 QListWidget 项?