本文整理汇总了Python中common.Domain.Resource类的典型用法代码示例。如果您正苦于以下问题:Python Resource类的具体用法?Python Resource怎么用?Python Resource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Resource类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildResource
def buildResource(url,title,channelId,videoId):
resource = Resource()
resource['resourceName'] = title
resource['resourceUrl'] = url
resource['channelId'] = channelId
resource['type'] = 'video'
resource['videoType'] = '56'
resource['videoId'] = videoId
resource['createTime'] = getCurTime()
return resource.getInsertDict()
示例2: buildResource
def buildResource(url,title,channelId,videoId):
resource = Resource()
resource['resourceName'] = title
resource['resourceUrl'] = url
resource['channelId'] = channelId
#resource['categoryId'] = clct_channel.find_one({'channelId':resource['channelId']})['channelType']
resource['type'] = 'video'
resource['videoType'] = '56'
resource['videoId'] = videoId
resource['createTime'] = getCurTime()
return resource.getInsertDict()
示例3: buildResource
def buildResource(url,title,hot,channelId):
resource = Resource()
resource['resourceName'] = title
resource['resourceUrl'] = url
resource['hot'] = hot
resource['channelId'] = channelId
#resource['categoryId'] = clct_channel.find_one({'channelId':resource['channelId']})['channelType']
resource['type'] = 'video'
resource['videoType'] = 'baomihua'
resource['videoId'] = p_vid.search(url).groups()[0]
resource['createTime'] = getCurTime()
return resource.getInsertDict()
示例4: buildResource
def buildResource(url,title, number, channelId):
resource = Resource()
resource['resourceName'] = title
resource['resourceUrl'] = url
resource['number'] = number
resource['channelId'] = channelId
resource['type'] = 'video'
resource['videoType'] = 'netease'
resource['videoId'] = url
resource['createTime'] = getCurTime()
return resource.getInsertDict()
示例5: buildResource
def buildResource(url, title, channelId, videoId, number = None):
resource = Resource()
resource['resourceName'] = title
resource['resourceUrl'] = url
resource['channelId'] = channelId
resource['type'] = 'video'
resource['videoType'] = 'wasu'
resource['videoId'] = videoId
resource['createTime'] = getCurTime()
if number!= None:resource['number'] = number
return resource.getInsertDict()
示例6: buildGifResource
def buildGifResource(url,title,channelId,videoId, resourceImageUrl):
resource = Resource()
resource['resourceName'] = title
resource['resourceUrl'] = url
resource['channelId'] = channelId
resource['type'] = 'gif'
resource['videoType'] = 'gif'
resource['videoId'] = videoId#videoUrl
resource['createTime'] = getCurTime()
resource['modifyTime'] = getCurTime()
resource['resourceImageUrl'] = resourceImageUrl
return resource.getInsertDict()
示例7: handleDetailPage
def handleDetailPage(itemList,channelId):
ans = []
for item in itemList:
resource = Resource()
#...
resource['resourceName'] = item['title']
resource['resourceUrl'] = item['url']
resource['channelId'] = channelId
resource['categoryId'] = clct_channel.find_one({'channelId':resource['channelId']})['channelType']
resource['videoId'] = p_vid.search(get_html(item['url'])).groups()[0]
resource['videoType'] = 'iqiyi'
resource['createTime'] = getCurTime()
#...
ans.append(resource.getInsertDict())
pprint(resource.getInsertDict())
return ans
示例8: extractTasks
def extractTasks(url,channelId,season=None,format="MP4",type="ed2k"):
tree = etree.HTML(get_html(url))
if season:
xpath = '//div[@class="box_1"]/ul[@season="%s"]/li[@format="%s"]/span[@class="r"]/a[@type="%s"]/@href'%(season,format,type)
else:
xpath = '//div[@class="box_1"]/ul/li[@format="%s"]/span[@class="r"]/a[@type="%s"]/@href'%(format,type)
urls = tree.xpath(xpath)
ans = []
for url in urls:
filename = p.search(url).groups()[0]
filename = urllib.unquote(filename).decode('utf-8')
name = filename[:filename.find('.')]
number = 0
if season:
print filename
try:
m = pse.search(filename)
name += ' 第%s季第%s集'%(m.groups()[0],m.groups()[1])
number = m.groups()[1]
except:
print '[error] %s can\'t be recognized '
continue
#ans.append({'name':name,'url':url,'filename':filename})
channel = clct_channel.find_one({'channelId':channelId})
resourceImageUrl = channel['resourceImageUrl']
resource = Resource()
resource['resourceName'] = name
resource['resourceImageUrl'] = resourceImageUrl
resource['channelId'] = channelId
resource['categoryId'] = clct_channel.find_one({'channelId':resource['channelId']})['channelType']
resource['createTime'] = getCurTime()
resource['resourceUrl'] = url
resource['type'] = 'video'
resource['videoType'] = 'bt'
resource['videoId'] = filename
resource['number'] = int(number)
ans.append(resource.getInsertDict())
return ans