本文整理汇总了Python中dudehere.routines.scrapers.ScraperResult.bitrate方法的典型用法代码示例。如果您正苦于以下问题:Python ScraperResult.bitrate方法的具体用法?Python ScraperResult.bitrate怎么用?Python ScraperResult.bitrate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dudehere.routines.scrapers.ScraperResult
的用法示例。
在下文中一共展示了ScraperResult.bitrate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_resolved_url
# 需要导入模块: from dudehere.routines.scrapers import ScraperResult [as 别名]
# 或者: from dudehere.routines.scrapers.ScraperResult import bitrate [as 别名]
def get_resolved_url(self, id):
self.search_results = []
resolved_url = ''
api_key = self._login()
params = {"type": "video", "id": id, "api_key": api_key, 't_files': 1}
results = self.request("/file/get", params)
if results=='':
return False
files = results['files'][0]['t_files']
for f in files:
if re.search('^video/', f['ct']):
title = f['name']
result = ScraperResult(self.service, 'furk.net', f['url_dl'], title)
result.size = self.format_size(f['size'])
result.bitrate = f['bitrate']
self.search_results.append(result)
resolved_url = self.select_stream()
return resolved_url
示例2: process_results
# 需要导入模块: from dudehere.routines.scrapers import ScraperResult [as 别名]
# 或者: from dudehere.routines.scrapers.ScraperResult import bitrate [as 别名]
def process_results(self, data):
results = []
if 'files' not in data.keys() : return results
files = data['files']
extension = re.compile('(\.MKV)|(\.AVI)|(\.MP4)', re.IGNORECASE)
for f in files:
if f['type'] == 'video':
url = "furk://%s" % f['id']
title = f['name']
result = ScraperResult(self.service, 'furk.net', url, title)
result.quality = self.test_quality(title)
result.size = int(f['size'])
bitrate = re.search('bitrate: (.+?) kb/s', f['video_info'])
if bitrate: result.bitrate = bitrate.group(1)
ext = extension.search(title)
if ext:
if ext.group(1): result.extension = 'MKV'
if ext.group(2): result.extension = 'AVI'
if ext.group(3): result.extension = 'MP4'
results.append(result)
return results