Skip to content

Instantly share code, notes, and snippets.

@awesomebytes
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save awesomebytes/27cb3779a3b9e85e9490 to your computer and use it in GitHub Desktop.

Select an option

Save awesomebytes/27cb3779a3b9e85e9490 to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 6/5/15
@author: sampfeiffer
create_drc_web.py contains...
"""
__author__ = 'sampfeiffer'
import requests
blue_video = '''<td id="blueVideo" onclick="changeVideo('blue', '''
red_video = '''<td id="redVideo" onclick="changeVideo('red', '''
green_video = '''<td id="greenVideo" onclick="changeVideo('green', '''
yellow_video = '''<td id="yellowVideo" onclick="changeVideo('yellow', '''
main_video = '''<td id="mainVideo" onclick="changeVideo('main', '''
videos = [blue_video, red_video, green_video, yellow_video, main_video]
if __name__ == '__main__':
url = "http://www.theroboticschallenge.org"
r = requests.get(url)
web_str = r.content
video_urls = []
for video in videos:
video_pos = web_str.find(video)
#print video_pos
video_youtube_url = web_str[video_pos+1 + len(video):video_pos+1+11 + len(video)]
#print "url of video_youtube_url: " + str(video_youtube_url)
video_urls.append(video_youtube_url)
full_web = '''
<html>
<style>
body, table, iframe {height: 100%;}
body{margin:0;}
table, iframe{width: 100%;}
tr{height:50%;}
td{padding:0;}
</style>
<body>
<table>
<tr>
<td><iframe src="https://www.youtube.com/embed/''' + video_urls[0] + '''" frameborder="0" allowfullscreen></iframe>
</td>
<td><iframe src="https://www.youtube.com/embed/'''+ video_urls[1] +'''" frameborder="0" allowfullscreen></iframe>
</td>
</tr>
<tr>
<td><iframe src="https://www.youtube.com/embed/'''+ video_urls[2] +'''" frameborder="0" allowfullscreen></iframe>
</td>
<td>
<iframe src="https://www.youtube.com/embed/'''+ video_urls[3] +'''" frameborder="0" allowfullscreen></iframe>
</td>
</tr>
</body>
</html>'''
print full_web
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment