shawarmabytes commited on
Commit
5dc3fde
·
1 Parent(s): 384ad23

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -0
app.py CHANGED
@@ -73,6 +73,46 @@ def tester(text):
73
 
74
  elif (results[0]['label']=="love"):
75
  st_player("https://www.youtube.com/watch?v=XVhEm62Uqog")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  return results[0]['label']
78
  #return results
 
73
 
74
  elif (results[0]['label']=="love"):
75
  st_player("https://www.youtube.com/watch?v=XVhEm62Uqog")
76
+
77
+
78
+ components.html("""<html>
79
+ <body>
80
+ <div id="player"></div>
81
+ <script>
82
+ // 2. This code loads the IFrame Player API code asynchronously.
83
+ var tag = document.createElement('script');
84
+
85
+ tag.src = "https://www.youtube.com/iframe_api";
86
+ var firstScriptTag = document.getElementsByTagName('script')[0];
87
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
88
+
89
+ // 3. This function creates an <iframe> (and YouTube player)
90
+ // after the API code downloads.
91
+ function onYouTubeIframeAPIReady() {
92
+ var numPl = Math.floor((Math.random() * 50) + 1);
93
+ var player = new YT.Player("player", {
94
+ height: '390',
95
+ width: '640',
96
+ playerVars: {
97
+ listType:'playlist',
98
+ list:'PLFgquLnL59anYA8FwzqNFMp3KMcbKwMaT',
99
+ index: numPl,
100
+ autoplay: 1,
101
+ },
102
+ events: {
103
+ 'onReady': function (event) {
104
+ //event.target.cuePlaylist({list: "PLFgquLnL59anYA8FwzqNFMp3KMcbKwMaT"});
105
+ //event.target.playVideo();
106
+ setTimeout(function() {
107
+ event.target.setShuffle({'shufflePlaylist' : true});
108
+ }, 1000);
109
+ }
110
+ }
111
+ });
112
+ }
113
+ </script>
114
+ </body>
115
+ </html>""",width=560,height=325)
116
 
117
  return results[0]['label']
118
  #return results