fix twitter robot
This commit is contained in:
parent
01d5063807
commit
c8e0af9bd9
@ -9,6 +9,7 @@ import twitter
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
# from qrtools import QR
|
# from qrtools import QR
|
||||||
from telegram import Update, InlineKeyboardMarkup, InlineKeyboardButton, MessageEntity
|
from telegram import Update, InlineKeyboardMarkup, InlineKeyboardButton, MessageEntity
|
||||||
|
from telegram.error import BadRequest
|
||||||
from telegram.ext import CallbackContext, Dispatcher, MessageHandler, Filters
|
from telegram.ext import CallbackContext, Dispatcher, MessageHandler, Filters
|
||||||
from djconfig import config
|
from djconfig import config
|
||||||
|
|
||||||
@ -89,11 +90,11 @@ class RobotBotModuleConfig(TelegramBotModuleConfig):
|
|||||||
config.twitter_access_token, config.twitter_access_token_secret)
|
config.twitter_access_token, config.twitter_access_token_secret)
|
||||||
tweet = api.GetStatus(twitter_matches.group(1))
|
tweet = api.GetStatus(twitter_matches.group(1))
|
||||||
try:
|
try:
|
||||||
for media in tweet_info['extended_entities']['media']:
|
for media in tweet.media:
|
||||||
if media['type'] == 'video':
|
if media['type'] == 'video':
|
||||||
max_bitrate = -1
|
max_bitrate = -1
|
||||||
max_bitrate_link = None
|
max_bitrate_link = None
|
||||||
for variant in media['video_info']['variants']:
|
for variant in media.video_unfo['variants']:
|
||||||
if variant['content_type'] == 'video/mp4' and variant['bitrate'] > max_bitrate:
|
if variant['content_type'] == 'video/mp4' and variant['bitrate'] > max_bitrate:
|
||||||
max_bitrate = variant['bitrate']
|
max_bitrate = variant['bitrate']
|
||||||
max_bitrate_link = variant['url']
|
max_bitrate_link = variant['url']
|
||||||
|
Loading…
Reference in New Issue
Block a user