本文整理汇总了Python中Channel.fromUserOrId方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.fromUserOrId方法的具体用法?Python Channel.fromUserOrId怎么用?Python Channel.fromUserOrId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel.fromUserOrId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadFromCachedMode
# 需要导入模块: import Channel [as 别名]
# 或者: from Channel import fromUserOrId [as 别名]
def loadFromCachedMode(self):
import Channel
import Playlist
if not self._cachedMode:
raise ValueError('Cannot load from cached mode. Pages are not in cached mode')
#sourcesToUpdate = []
for page in self._pages:
if page.items:
raise ValueError('In cached mode, yet page has original videosource items')
items = []
for cachedItem in page.cacheableItems:
if cachedItem[0] == SourceType.CHANNEL:
channelId = cachedItem[1]
ytVideoSource, needsInfoUpdate = Channel.fromUserOrId(channelId=channelId)
else:
playlistId = cachedItem[1]
ytVideoSource, needsInfoUpdate = Playlist.fromPlaylistId(playlistId)
items.append(ytVideoSource)
if needsInfoUpdate: #ignored here
pass
page.items = items
self._cachedMode = False