mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-02-16 22:44:09 -06:00
#33: Add better audio detection support (needs testing, could pose a security risk, users should be able to disable this).
This commit is contained in:
parent
1e6a784192
commit
52bfa82ec5
@ -4,6 +4,7 @@ import output
|
|||||||
from twython import TwythonError
|
from twython import TwythonError
|
||||||
import config
|
import config
|
||||||
import logging
|
import logging
|
||||||
|
import requests
|
||||||
log = logging.getLogger("twitter.utils")
|
log = logging.getLogger("twitter.utils")
|
||||||
""" Some utilities for the twitter interface."""
|
""" Some utilities for the twitter interface."""
|
||||||
|
|
||||||
@ -46,6 +47,10 @@ def is_audio(tweet):
|
|||||||
for i in tweet["entities"]["hashtags"]:
|
for i in tweet["entities"]["hashtags"]:
|
||||||
if i["text"] == "audio":
|
if i["text"] == "audio":
|
||||||
return True
|
return True
|
||||||
|
for u in find_urls(tweet):
|
||||||
|
response = requests.head(u)
|
||||||
|
if 'audio' in str(response.headers['content-type']).lower():
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_geocoded(tweet):
|
def is_geocoded(tweet):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user