Reverted to a modified version of the Skybot youtube plugin
This commit is contained in:
parent
07508eb31f
commit
385f0b4b5e
1 changed files with 14 additions and 22 deletions
|
@ -23,40 +23,32 @@ def get_video_description(vid_id):
|
||||||
return
|
return
|
||||||
|
|
||||||
j = j['data']
|
j = j['data']
|
||||||
out = {}
|
|
||||||
out["title"] = '%s' % j['title']
|
out = '\x02%s\x02' % j['title']
|
||||||
|
|
||||||
if not j.get('duration'):
|
if not j.get('duration'):
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
out += ' - length \x02'
|
||||||
length = j['duration']
|
length = j['duration']
|
||||||
ti = ""
|
|
||||||
if length / 3600: # > 1 hour
|
if length / 3600: # > 1 hour
|
||||||
ti += '%dh ' % (length / 3600)
|
out += '%dh ' % (length / 3600)
|
||||||
if length / 60:
|
if length / 60:
|
||||||
ti += '%dm ' % (length / 60 % 60)
|
out += '%dm ' % (length / 60 % 60)
|
||||||
out["length"] = ti
|
out += "%ds\x02" % (length % 60)
|
||||||
#out += "%ds\x02" % (length % 60)
|
|
||||||
|
|
||||||
if 'ratingCount' in j and 'likeCount' in j:
|
|
||||||
out["likes"] = int(j['likeCount'])
|
|
||||||
out["dislikes"] = int(j['ratingCount']) - int(j['likeCount'])
|
|
||||||
|
|
||||||
if 'rating' in j:
|
|
||||||
out["rating"] = (j['rating'])
|
|
||||||
|
|
||||||
if 'viewCount' in j:
|
if 'viewCount' in j:
|
||||||
out["views"] = j['viewCount']
|
out += ' - \x02%s\x02 views' % locale.format('%d',
|
||||||
|
j['viewCount'], 1)
|
||||||
|
|
||||||
upload_time = time.strptime(j['uploaded'], "%Y-%m-%dT%H:%M:%S.000Z")
|
upload_time = time.strptime(j['uploaded'], "%Y-%m-%dT%H:%M:%S.000Z")
|
||||||
out["uploadtime"] = (j['uploader'])
|
out += ' - \x02%s\x02 on \x02%s\x02' % (j['uploader'],
|
||||||
|
time.strftime("%Y.%m.%d", upload_time))
|
||||||
|
|
||||||
|
if 'contentRating' in j:
|
||||||
|
out += ' - \x034NSFW\x02'
|
||||||
|
|
||||||
# title. uploader. length. upload date.
|
return out
|
||||||
give = '\x02' + j[u'title'] + '\x02'
|
|
||||||
give += " - Length: " + GetInHMS(j['duration'])
|
|
||||||
give += " - "+ j[u'uploaded'][:10] + " by " + j[u'uploader']
|
|
||||||
return give
|
|
||||||
|
|
||||||
def GetInHMS(seconds):
|
def GetInHMS(seconds):
|
||||||
hours = seconds / 3600
|
hours = seconds / 3600
|
||||||
|
@ -87,4 +79,4 @@ def youtube(inp):
|
||||||
|
|
||||||
vid_id = j['data']['items'][0]['id']
|
vid_id = j['data']['items'][0]['id']
|
||||||
|
|
||||||
return get_video_description(vid_id) + " - " + video_url % vid_id
|
return get_video_description(vid_id) + " - " + video_url % vid_id
|
||||||
|
|
Reference in a new issue