Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
fc314e2
Added Index HTML
15mikesmith Jul 26, 2018
262574a
Basic App.py and CSS file
15mikesmith Jul 26, 2018
88572b0
Able to load videos thru Youtube API
15mikesmith Jul 26, 2018
ccf217e
Removed API Key
15mikesmith Jul 26, 2018
8abdda0
Removed API Key
15mikesmith Jul 26, 2018
a9cbb3e
Moved files to new Directory structure
15mikesmith Jul 26, 2018
223efdf
Delete app.py
15mikesmith Jul 26, 2018
a5b28cd
Delete main.js
15mikesmith Jul 26, 2018
6c0a5da
Delete styles.css
15mikesmith Jul 26, 2018
59cc9f1
Delete index.html
15mikesmith Jul 26, 2018
4e67645
Delete Surf-Videos.iml
15mikesmith Jul 26, 2018
99d10fb
Delete misc.xml
15mikesmith Jul 26, 2018
f09025a
Delete vcs.xml
15mikesmith Jul 26, 2018
b56d560
Delete modules.xml
15mikesmith Jul 26, 2018
0ae81cc
Delete pyvenv.cfg
15mikesmith Jul 26, 2018
98ab209
Delete pip-selfcheck.json
15mikesmith Jul 26, 2018
0b3e60f
Clicking a vid opens new page, videos from author also appear
15mikesmith Jul 26, 2018
65129b8
Merge remote-tracking branch 'origin/master'
15mikesmith Jul 26, 2018
c497057
Able to see Related Videos from Author
15mikesmith Jul 26, 2018
32ada84
Added Comments and Navbar
15mikesmith Jul 27, 2018
29bcf38
Working on filtering
15mikesmith Jul 27, 2018
250c477
Can filter by video title
15mikesmith Jul 27, 2018
c3dff7d
Search presentation finished
15mikesmith Jul 27, 2018
c5895d5
Can now load related author videos
15mikesmith Jul 27, 2018
f5f94e5
Infinite Scroll up to 50 vids for some reason
15mikesmith Jul 27, 2018
67c3fd3
CORS not letting me query for vids?!
15mikesmith Jul 27, 2018
74f4075
Add files via upload
15mikesmith Jul 27, 2018
4ec5b03
Added comments
15mikesmith Jul 27, 2018
dbdccc8
Merge remote-tracking branch 'origin/master'
15mikesmith Jul 27, 2018
cd93cd6
Added Drift ChatBot
15mikesmith Jul 30, 2018
4a10bd1
Update main.js
15mikesmith Jul 30, 2018
3118920
Update videoQuery.js
15mikesmith Jul 30, 2018
07a99e4
Recommit
15mikesmith Jul 30, 2018
9173aa3
Merge remote-tracking branch 'origin/master'
15mikesmith Jul 30, 2018
4555e8f
Recommit
15mikesmith Jul 30, 2018
33b73e1
Recommit
15mikesmith Jul 30, 2018
4bb382c
Delete video.html
15mikesmith Jul 30, 2018
8de8c30
Create README.md
15mikesmith Jul 30, 2018
0d9838e
Update README.md
15mikesmith Jul 30, 2018
5121ff9
Delete README.md
15mikesmith Jul 30, 2018
fd12144
test
15mikesmith Aug 8, 2018
179b06f
Merge remote-tracking branch 'origin/master'
15mikesmith Aug 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 24 additions & 0 deletions Assessment/.idea/Assessment.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Assessment/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assessment/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Assessment/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assessment/CORS.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Assessment/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from flask import Flask, render_template, request
import os

app = Flask(__name__)


#This returns the home page
@app.route('/')
def hello_world():
return render_template('index.html')


#This will render a single video with accompanying info and videos
@app.route('/video')
def vid():
vidId = request.args.get('id')
vidChannel = request.args.get('channel')
return render_template('video.html', videoToShow=vidId,channelToShow=vidChannel)

#This will render a new page, with updated keywords
@app.route('/searchVids')
def index2():
vidKey = request.args.get('keyword')
return render_template('searchVids.html', videoKeyToShow=vidKey)


# if __name__ == '__main__':
# app.debug = True
# host = os.environ.get('IP', '0.0.0.0')
# port = int(os.environ.get('PORT', 8080))
# app.run(host=host, port=port)

if __name__ == '__main__':
app.run()
130 changes: 130 additions & 0 deletions Assessment/static/getNewVids.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
var key = 'AIzaSyDc5Y2QwI7t4r2xhEP8go6MrYccO9DreAo'

var globalData;

$(document).ready(function() {

//EventListener on button to redirect with new paramaters when clicked
$(".button").click(function() {

var text = $('#myText').val();
// alert(text);
var keyword = 'surf,';
keyword+= text;

var url = "/searchVids" + "?keyword=" + keyword;

window.location = url;

});


initialFeed("")

//This will populate the main section on the home page with videos
function initialFeed(filterQuery){

var qKey = $('.container').attr('data-key');
console.log(qKey);


var URL = "https://www.googleapis.com/youtube/v3/search";
options = {
part : 'snippet',
type : 'video',
q:qKey,
maxResults:50,
key: key};


$.get(URL, options, function (data) {
console.log(data);
globalData = data;
var ID = data.items[0].id.videoId;
//ID = 'sIpbI0SQczM';
var initialData = [];
for (i = 0; i < 10; i++) {
initialData.push(data.items[i])
}
console.log(initialData)
resultsLoop(initialData);
});

}

//Calling Method to populate homepage
// initialFeed("")


var counter = 10;
//Function to create article elements and append to section
function resultsLoop(data){

//$.each(data.items,function(i, item){
$.each(data,function(i, item){

var thumb = item.snippet.thumbnails.medium.url;
var title = item.snippet.title;
var desc = item.snippet.description.substring(0,100);
var channel = item.snippet.channelId;
var vid = item.id.videoId;

$('main').append(`
<article class="item" data-key="${vid}" data-channel="${channel}">
<img src="${thumb}" alt="" class="thumb">
<div class="details">
<h4>${title}</h4>
<p>${desc}</p>
</div>
</article>
`)
});

}

//Function sets event listener on articles and redirects the page
$('main').on('click','article',function(){
//$("html").load("/video");

var id = $(this).attr('data-key');
var channel = $(this).attr('data-channel');

var url = "/video" + "?id=" + id +"&channel="+channel;

//window.location = "/video?username=alex&password=pw1";
window.location = url;


});


//Function to filter out the videos based on input text
$("#myInput").on("keyup", function() {

var value = $(this).val().toLowerCase();

$("h4").filter(function() {
$(this).parent().parent().toggle($(this).text().toLowerCase().indexOf(value) > -1)
//console.log(this.parent());
});
});


//Function to enable Infinite scrolling(Dynamically loading videos)
$(window).scroll(function(){

if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {

var initialData = [];
var end = counter + 10;
for(i = counter; i < end; i++){
initialData.push(globalData.items[i])
}
counter = counter + 10;
console.log(counter)
resultsLoop(initialData);

}

});
});
136 changes: 136 additions & 0 deletions Assessment/static/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
var key = 'AIzaSyDc5Y2QwI7t4r2xhEP8go6MrYccO9DreAo'

var playlistId = 'PL8QlzjBVZXjRhCJSyT038EHWUpDzV5Xz6'

var options = {
part: 'snippet',
key:key,
maxResults:50,
playlistId:playlistId
}

var globalData;

//Wait until document is finished loading
$(document).ready(function() {

//EventListener in button to redirect with new paramaters when clicked
$(".button").click(function() {

var text = $('#myText').val();
// alert(text);
var keyword = 'surf,';

keyword+= text;

var url = "/searchVids" + "?keyword=" + keyword;

window.location = url;

});

//This will populate the main section on the home page with videos
function initialFeed(filterQuery){

//var URL = "https://www.googleapis.com/youtube/v3/search?key=AIzaSyDc5Y2QwI7t4r2xhEP8go6MrYccO9DreAo&part=snippet&type=video&q=surf";
var URL = "https://www.googleapis.com/youtube/v3/search";
options = {
part : 'snippet',
type : 'video',
q:'surf',
maxResults:50,
key: key};


$.get(URL, options, function (data) {
console.log(data);
globalData = data;
var ID = data.items[0].id.videoId;
//ID = 'sIpbI0SQczM';
var initialData = [];
for (i = 0; i < 10; i++) {
initialData.push(data.items[i])
}
console.log(initialData)
resultsLoop(initialData);
});

}

//Calling Method to populate homepage
initialFeed("")


var counter = 10;
//Function to create article elements and append to section
function resultsLoop(data){

//$.each(data.items,function(i, item){
$.each(data,function(i, item){

var thumb = item.snippet.thumbnails.medium.url;
var title = item.snippet.title;
var desc = item.snippet.description.substring(0,100);
var channel = item.snippet.channelId;
var vid = item.id.videoId;

$('main').append(`
<article class="item" data-key="${vid}" data-channel="${channel}">
<img src="${thumb}" alt="" class="thumb">
<div class="details">
<h4>${title}</h4>
<p>${desc}</p>
</div>
</article>
`)
});

}

//Function sets event listener on articles and redirects the page
$('main').on('click','article',function(){
//$("html").load("/video");

var id = $(this).attr('data-key');
var channel = $(this).attr('data-channel');

var url = "/video" + "?id=" + id +"&channel="+channel;

//window.location = "/video?username=alex&password=pw1";
window.location = url;


});


//Function to filter out the videos based on input text
$("#myInput").on("keyup", function() {

var value = $(this).val().toLowerCase();

$("h4").filter(function() {
$(this).parent().parent().toggle($(this).text().toLowerCase().indexOf(value) > -1)
//console.log(this.parent());
});
});


//Function to enable Infinite scrolling(Dynamically loading videos)
$(window).scroll(function(){

if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {

var initialData = [];
var end = counter + 10;
for(i = counter; i < end; i++){
initialData.push(globalData.items[i])
}
counter = counter + 10;
console.log(counter)
resultsLoop(initialData);

}

});

});
Loading