Advertisement
Nikoh77

Untitled

Sep 28th, 2023
692
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1.         if data:
  2.             data=data.json().get('videos')
  3.             buttons=[]
  4.             for index,video in enumerate(data):
  5.             #     size=humanize.naturalsize(video.get('size'))
  6.                 start_time=datetime.fromisoformat(video.get('time'))
  7.                 end_time=datetime.fromisoformat(video.get('end'))
  8.                 start=humanize.naturaltime(start_time)
  9.                 if video['status']==1:
  10.                     #unread=True
  11.                     start=f'<b>{start}</b>'
  12.                     print(start)
  13.             #     duration=humanize.naturaldelta(end_time-start_time)
  14.             #     fileName=video.get('filename')
  15.             #     videoUrl=url+'/'+fileName
  16.                 CallBack=f'{tag};;{index};;{self.mid}'
  17.                 buttons.append([InlineKeyboardButton(start, callback_data=CallBack)])
  18.             reply_markup = InlineKeyboardMarkup(buttons)
  19.             await self.context.bot.send_message(chat_id=self.chat_id, text="Select one video", reply_markup=reply_markup, parse_mode='HTML')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement