Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
they sent me a copyright takedown notice! totally reasonable. guess i've arrived?
  • Loading branch information
snarfed committed Aug 6, 2018
1 parent 37f959c commit 9be004c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app.py
Expand Up @@ -14,6 +14,7 @@
from string import Template
import sys
import urllib
import urlparse

import boto
import boto.ec2.cloudwatch
Expand Down Expand Up @@ -50,6 +51,10 @@ def read(filename):
S3_BUCKET = 'huffduff-video'
S3_BASE = 'https://%s.s3-us-west-2.amazonaws.com/' % S3_BUCKET

DOMAIN_BLACKLIST = frozenset((
'www.bbc.co.uk',
))

# ffmpeg on Ryan's laptop is installed in /usr/local/bin, so add it to PATH.
if '/usr/local/bin' not in os.environ['PATH']:
os.environ['PATH'] += ':/usr/local/bin'
Expand All @@ -72,6 +77,12 @@ def application(environ, start_response):
return webob.exc.HTTPBadRequest('Missing required parameter: url')(
environ, start_response)

parsed = urlparse.urlparse(url)
if parsed.netloc in DOMAIN_BLACKLIST:
return webob.exc.HTTPBadRequest(
'Sorry, this content is not currently supported due to copyright.')(
environ, start_response)

# check that our CPU credit balance isn't too low
try:
cloudwatch = boto.ec2.cloudwatch.connect_to_region(
Expand Down

0 comments on commit 9be004c

Please sign in to comment.