mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Merge branch 'master' of https://oauth2:glpat-z6wQgDKeSNnXtXcB58D5@gitlab.com/jeancf/twoot.git
This commit is contained in:
commit
72f7f40a66
30
twoot.py
30
twoot.py
|
@ -877,20 +877,8 @@ def process_attachments(nitter_url, attachments_container, status_id, author_acc
|
||||||
with open('gif_video.mp4', 'wb') as f:
|
with open('gif_video.mp4', 'wb') as f:
|
||||||
for chunk in r.iter_content(chunk_size=16 * 1024):
|
for chunk in r.iter_content(chunk_size=16 * 1024):
|
||||||
f.write(chunk)
|
f.write(chunk)
|
||||||
# Initiate session
|
|
||||||
session = requests.Session()
|
|
||||||
|
|
||||||
# Get a copy of the default headers that requests would use
|
logging.debug('Downloaded video of GIF animation from attachments')
|
||||||
headers = requests.utils.default_headers()
|
|
||||||
|
|
||||||
# Update default headers with randomly selected user agent
|
|
||||||
headers.update(
|
|
||||||
{
|
|
||||||
'User-Agent': USER_AGENTS[random.randint(0, len(USER_AGENTS) - 1)],
|
|
||||||
'Cookie': 'replaceTwitter=; replaceYouTube=; hlsPlayback=on; proxyVideos=',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
ded video of GIF animation from attachments')
|
|
||||||
except: # Don't do anything if video can't be found or downloaded
|
except: # Don't do anything if video can't be found or downloaded
|
||||||
logging.debug('Could not download video of GIF animation from attachments')
|
logging.debug('Could not download video of GIF animation from attachments')
|
||||||
pass
|
pass
|
||||||
|
@ -930,20 +918,8 @@ ded video of GIF animation from attachments')
|
||||||
logging.debug("Media is unavailable")
|
logging.debug("Media is unavailable")
|
||||||
vid_in_tweet = True
|
vid_in_tweet = True
|
||||||
else:
|
else:
|
||||||
logging.debug("Media i # Initiate session
|
logging.debug("Media is unavailable")
|
||||||
session = requests.Session()
|
vid_in_tweet = True
|
||||||
|
|
||||||
# Get a copy of the default headers that requests would use
|
|
||||||
headers = requests.utils.default_headers()
|
|
||||||
|
|
||||||
# Update default headers with randomly selected user agent
|
|
||||||
headers.update(
|
|
||||||
{
|
|
||||||
'User-Agent': USER_AGENTS[random.randint(0, len(USER_AGENTS) - 1)],
|
|
||||||
'Cookie': 'replaceTwitter=; replaceYouTube=; hlsPlayback=on; proxyVideos=',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
return pics, vid_in_tweet
|
return pics, vid_in_tweet
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user