aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2019-01-06 19:31:01 -0800
committerJames Taylor <user234683@users.noreply.github.com>2019-01-06 19:31:01 -0800
commit1ba38a5c9cc7a7b21a5a8a54db630f47c9a550ea (patch)
tree7761c2581b9c5ddc2195b013c7ddd0dec9c01d32 /youtube
parent1c061783b42aecf8d8843adf9bd89baaba58996c (diff)
downloadyt-local-1ba38a5c9cc7a7b21a5a8a54db630f47c9a550ea.tar.lz
yt-local-1ba38a5c9cc7a7b21a5a8a54db630f47c9a550ea.tar.xz
yt-local-1ba38a5c9cc7a7b21a5a8a54db630f47c9a550ea.zip
Content-type: text/plain for errors or status messages
Diffstat (limited to 'youtube')
-rw-r--r--youtube/accounts.py4
-rw-r--r--youtube/channel.py6
-rw-r--r--youtube/local_playlist.py4
-rw-r--r--youtube/watch.py2
-rw-r--r--youtube/youtube.py8
5 files changed, 12 insertions, 12 deletions
diff --git a/youtube/accounts.py b/youtube/accounts.py
index 4108269..bde9852 100644
--- a/youtube/accounts.py
+++ b/youtube/accounts.py
@@ -64,10 +64,10 @@ def add_account(env, start_response):
use_tor = False
if _add_account(parameters['username'][0], parameters['password'][0], save_account, use_tor ):
- start_response('200 OK', () )
+ start_response('200 OK', [('Content-type', 'text/plain'),] )
return b'Account successfully added'
else:
- start_response('200 OK', () )
+ start_response('200 OK', [('Content-type', 'text/plain'),] )
return b'Failed to add account'
def get_account_login_page(env, start_response):
diff --git a/youtube/channel.py b/youtube/channel.py
index 6acb371..1ec5635 100644
--- a/youtube/channel.py
+++ b/youtube/channel.py
@@ -402,7 +402,7 @@ def get_channel_page(env, start_response):
result = channel_search_page(polymer_json, query, page_number, number_of_videos, env['QUERY_STRING'])
else:
- start_response('404 Not Found', ())
+ start_response('404 Not Found', [('Content-type', 'text/plain'),])
return b'Unknown channel tab: ' + tab.encode('utf-8')
start_response('200 OK', [('Content-type','text/html'),])
@@ -423,7 +423,7 @@ def get_channel_page_general_url(env, start_response):
page = 'videos'
base_url = 'https://www.youtube.com/' + '/'.join(path_parts)
else:
- start_response('404 Not Found', ())
+ start_response('404 Not Found', [('Content-type', 'text/plain'),])
return b'Invalid channel url'
if page == 'videos':
@@ -446,7 +446,7 @@ def get_channel_page_general_url(env, start_response):
polymer_json = json.loads(polymer_json)
return channel_search_page('''
else:
- start_response('404 Not Found', ())
+ start_response('404 Not Found', [('Content-type', 'text/plain'),])
return b'Unknown channel page: ' + page.encode('utf-8')
start_response('200 OK', [('Content-type','text/html'),])
diff --git a/youtube/local_playlist.py b/youtube/local_playlist.py
index bfca48f..0375040 100644
--- a/youtube/local_playlist.py
+++ b/youtube/local_playlist.py
@@ -155,7 +155,7 @@ def path_edit_playlist(env, start_response):
return b''
else:
- start_response('400 Bad Request', ())
+ start_response('400 Bad Request', [('Content-type', 'text/plain'),])
return b'400 Bad Request'
def edit_playlist(env, start_response):
@@ -165,5 +165,5 @@ def edit_playlist(env, start_response):
add_to_playlist(parameters['playlist_name'][0], parameters['video_info_list'])
start_response('204 No Content', ())
else:
- start_response('400 Bad Request', ())
+ start_response('400 Bad Request', [('Content-type', 'text/plain'),])
return b'400 Bad Request'
diff --git a/youtube/watch.py b/youtube/watch.py
index 9e3a1c2..04a5b5d 100644
--- a/youtube/watch.py
+++ b/youtube/watch.py
@@ -231,7 +231,7 @@ music_list_table_row = Template('''<tr>
def get_watch_page(env, start_response):
video_id = env['parameters']['v'][0]
if len(video_id) < 11:
- start_response('404 Not Found', ())
+ start_response('404 Not Found', [('Content-type', 'text/plain'),])
return b'Incomplete video id (too short): ' + video_id.encode('ascii')
start_response('200 OK', [('Content-type','text/html'),])
diff --git a/youtube/youtube.py b/youtube/youtube.py
index 988e09a..240e785 100644
--- a/youtube/youtube.py
+++ b/youtube/youtube.py
@@ -75,11 +75,11 @@ def youtube(env, start_response):
return f.read().replace(b'$port_number', str(settings.port_number).encode())
elif path == "/comment_delete_success":
- start_response('200 OK', () )
+ start_response('200 OK', [('Content-type', 'text/plain'),] )
return b'Successfully deleted comment'
elif path == "/comment_delete_fail":
- start_response('200 OK', () )
+ start_response('200 OK', [('Content-type', 'text/plain'),] )
return b'Failed to deleted comment'
else:
@@ -97,9 +97,9 @@ def youtube(env, start_response):
else:
return handler(env, start_response)
- start_response('404 Not Found', ())
+ start_response('404 Not Found', [('Content-type', 'text/plain'),])
return b'404 Not Found'
else:
- start_response('501 Not Implemented', ())
+ start_response('501 Not Implemented', [('Content-type', 'text/plain'),])
return b'501 Not Implemented'