|
|
@ -22,10 +22,10 @@ class YouTubeUtil: |
|
|
|
# AIzaSyDjPkCgDQ9Tv_xcChjY2E6GpJ6IzngnD5I |
|
|
|
# AIzaSyAxIycOdQYGB5kWhwe3B-kJAYRo7wOnp8o |
|
|
|
apiKeys = [ |
|
|
|
"AIzaSyARaW3mqO9szQiHgWZR4el0HWvdyheSHBc", |
|
|
|
"AIzaSyChPXesnVx6fweon_BckhR6UiJWvi5Ma4s" |
|
|
|
# "AIzaSyARaW3mqO9szQiHgWZR4el0HWvdyheSHBc", |
|
|
|
# "AIzaSyChPXesnVx6fweon_BckhR6UiJWvi5Ma4s" |
|
|
|
|
|
|
|
# "AIzaSyCTBSbq0YjyxTtjmNsnDyKAwHamlv_ST-s", |
|
|
|
"AIzaSyCTBSbq0YjyxTtjmNsnDyKAwHamlv_ST-s" |
|
|
|
# "AIzaSyAESnwtbTIBtU707iZowtQkmAo-qKuEOcY" |
|
|
|
|
|
|
|
|
|
|
@ -38,12 +38,12 @@ class YouTubeUtil: |
|
|
|
# 获取youtube对象 |
|
|
|
def getYoutube(): |
|
|
|
# 本地测试使用代码 |
|
|
|
# proxy_info = httplib2.ProxyInfo( |
|
|
|
# proxy_type=httplib2.socks.PROXY_TYPE_HTTP, proxy_host="127.0.0.1", proxy_port=7890) |
|
|
|
# http = httplib2.Http(timeout=10, proxy_info=proxy_info, |
|
|
|
# disable_ssl_certificate_validation=False) |
|
|
|
http = httplib2.Http( |
|
|
|
timeout=10, disable_ssl_certificate_validation=False) |
|
|
|
proxy_info = httplib2.ProxyInfo( |
|
|
|
proxy_type=httplib2.socks.PROXY_TYPE_HTTP, proxy_host="127.0.0.1", proxy_port=7890) |
|
|
|
http = httplib2.Http(timeout=10, proxy_info=proxy_info, |
|
|
|
disable_ssl_certificate_validation=False) |
|
|
|
# http = httplib2.Http( |
|
|
|
# timeout=10, disable_ssl_certificate_validation=False) |
|
|
|
api_service_name = "youtube" |
|
|
|
api_version = "v3" |
|
|
|
# 获取apiKey |
|
|
@ -121,7 +121,7 @@ class YouTubeUtil: |
|
|
|
video: Video = VideoService.queryOneByVideoId(videoId) |
|
|
|
if video == None: |
|
|
|
VideoService.insertOne( |
|
|
|
videoId=videoId, ChannelId=channelId, videoTitle=videoTitle, videoLen=0, |
|
|
|
videoId=videoId, channelId=channelId, videoTitle=videoTitle, videoLen=0, |
|
|
|
videoType=videoType, videoPublishTime=publisTime, videoLanguage=videoLanguage, isDownload=0) |
|
|
|
videosRequest = videosRequest + "," + str(videoId) |
|
|
|
videosRequestCount = videosRequestCount + 1 |
|
|
@ -146,8 +146,8 @@ class YouTubeUtil: |
|
|
|
) |
|
|
|
videosRequestCount = 0 |
|
|
|
videosRequest = "" |
|
|
|
except: |
|
|
|
pass |
|
|
|
except Exception as e: |
|
|
|
Logger.error(e) |
|
|
|
# 获取最后一个视频 |
|
|
|
video: Video = VideoService.getLastVideoByChannelId(channelId) |
|
|
|
ChannelService.updateTimeByChannelId( |
|
|
|