-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathresults.php
235 lines (92 loc) · 10.3 KB
/
results.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<?php
include("./static/header.php");
include("./static/guide.php");
?>
<div id="content">
<div id="context-source-container" data-context-source=""electric company" and "see sallys knee"" style="display:none;"></div><div class="primary-col"><div class="search-header yt-uix-expander yt-uix-expander-collapsed"> <div class="filter-top">
<div class="filter-bar-container">
<ul class="filter-crumb-list"><li class="filter-crumb filter-crumb-ghost"><a class="filter"><span class="filter-text filter-ghost"></span><span class="yt-close" style="
display: none;
">×</span></a></li></ul>
</div>
</div>
<div id="filter-dropdown" class="yt-uix-expander-body"><div class="filter-col"><h4 class="filter-col-title">Upload Date</h4><ul><li>
<a class="filter " title="Last hour" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+hour&lclk=hour"><span class="filter-text filter-ghost">Last hour</span></a>
</li><li>
<a class="filter " title="Today" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+today&lclk=today"><span class="filter-text filter-ghost">Today</span></a>
</li><li>
<a class="filter " title="This week" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+this+week&lclk=this_week"><span class="filter-text filter-ghost">This week</span></a>
</li><li>
<a class="filter " title="This month" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+this+month&lclk=this_month"><span class="filter-text filter-ghost">This month</span></a>
</li><li>
<a class="filter " title="This year" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+this+year&lclk=this_year"><span class="filter-text filter-ghost">This year</span></a>
</li></ul></div><div class="filter-col"><h4 class="filter-col-title">Result Type</h4><ul><li>
<a class="filter " title="Video" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+video&lclk=video"><span class="filter-text filter-ghost">Video</span></a>
</li><li>
<a class="filter " title="Channel" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+channel&lclk=channel"><span class="filter-text filter-ghost">Channel</span></a>
</li><li>
<a class="filter " title="Playlist" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+playlist&lclk=playlist"><span class="filter-text filter-ghost">Playlist</span></a>
</li><li>
<a class="filter " title="Movie" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+movie&lclk=movie"><span class="filter-text filter-ghost">Movie</span></a>
</li><li>
<a class="filter " title="Show" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+show&lclk=show"><span class="filter-text filter-ghost">Show</span></a>
</li></ul></div><div class="filter-col"><h4 class="filter-col-title">Duration</h4><ul><li>
<a class="filter " title="Short (~4 minutes)" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+short&lclk=short"><span class="filter-text filter-ghost">Short (~4 minutes)</span></a>
</li><li>
<a class="filter " title="Long (20~ minutes)" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+long&lclk=long"><span class="filter-text filter-ghost">Long (20~ minutes)</span></a>
</li></ul></div><div class="filter-col"><h4 class="filter-col-title">Features</h4><ul><li>
<a class="filter " title="HD (high definition)" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+hd&lclk=hd"><span class="filter-text filter-ghost">HD (high definition)</span></a>
</li><li>
<a class="filter " title="CC (closed caption)" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+cc&lclk=cc"><span class="filter-text filter-ghost">CC (closed caption)</span></a>
</li><li>
<a class="filter " title="Creative commons" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+creativecommons&lclk=creativecommons"><span class="filter-text filter-ghost">Creative commons</span></a>
</li><li>
<a class="filter " title="3D" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+3d&lclk=3d"><span class="filter-text filter-ghost">3D</span></a>
</li><li>
<a class="filter " title="Live" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_date_uploaded&search_type=videos&search_query=%22electric+company%22+and+%22see+sallys+knee%22%2C+live&lclk=live"><span class="filter-text filter-ghost">Live</span></a>
</li></ul></div><div class="filter-col"><h4 class="filter-col-title">Sort by</h4><ul><li>
<a class="filter filter-sort " title="" href="/web/20130127182407/http://www.youtube.com/results?search_query=%22electric+company%22+and+%22see+sallys+knee%22&search_type=videos"><span class="filter-text ">Relevance</span></a>
</li><li>
<span class="filter filter-sort filter-selected " title=""><span class="filter-text ">Upload date</span></span>
</li><li>
<a class="filter filter-sort " title="" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_view_count&search_query=%22electric+company%22+and+%22see+sallys+knee%22&search_type=videos"><span class="filter-text ">View count</span></a>
</li><li>
<a class="filter filter-sort " title="" href="/web/20130127182407/http://www.youtube.com/results?search_sort=video_avg_rating&search_query=%22electric+company%22+and+%22see+sallys+knee%22&search_type=videos"><span class="filter-text ">Rating</span></a>
</li></ul></div></div></div><div id="results">
<ol id="search-results" class="result-list context-data-container">
<?php
if(isset($_GET["page"])) {
$page = $_GET["page"];
$videoList = json_decode(file_get_contents('https://vid.puffyan.us/api/v1/search?q='.urlencode($_GET["search_query"]).'&page='.$_GET["page"]));
} else {
$page = 1;
$videoList = json_decode(file_get_contents('https://vid.puffyan.us/api/v1/search?q='.urlencode($_GET["search_query"]).'&page=1'));
}
foreach($videoList as $videoList){
echo "<li class='yt-lockup2 yt-lockup2-video yt-uix-tile context-data-item clearfix '>
<div class='yt-lockup2-thumbnail'><a href='watch?v=".$videoList->videoId."' class='ux-thumb-wrap yt-uix-sessionlink yt-uix-contextlink contains-addto ' data-sessionlink='ei=CNGX56CUibUCFQo8RAodEEKIqg%3D%3D&ved=CAMQwBs%3D'><span class='video-thumb ux-thumb yt-thumb-default-185 '><span class='yt-thumb-clip'><span class='yt-thumb-clip-inner'><img alt='Thumbnail' src='".$videoList->videoThumbnails[2]->url."' width='185'><span class='vertical-align'></span></span></span></span>
</a>
</div>
<div class='yt-lockup2-content'>
<h3 class='yt-lockup2-title'><a class='yt-uix-sessionlink yt-uix-tile-link yt-uix-contextlink ' dir='ltr' data-sessionlink='ei=CNGX56CUibUCFQo8RAodEEKIqg%3D%3D&ved=CAIQvxs%3D' href='watch?v=".$videoList->videoId."'>".htmlspecialchars($videoList->title)."</a></h3>
<p class='yt-lockup2-meta'> by <a href='profile?id=".$videoList->authorId."' class='yt-uix-sessionlink yt-user-name ' data-sessionlink='ei=CNGX56CUibUCFQo8RAodEEKIqg%3D%3D&ved=CAQQwRs%3D' dir='ltr'>".$videoList->author."</a><span class='metadata-separator'>•</span>".$videoList->publishedText."<span class='metadata-separator'>•</span></p>
<p class='yt-lockup2-description' dir='ltr'>".mb_strimwidth(htmlspecialchars($videoList->description), 0, 50, "...")."</p>
<div class='yt-lockup2-badges'>
<ul class='item-badge-line'></ul>
</div>
</div>
</li>";
}
?>
</ol>
<div class="promoted-videos pyv-promoted-videos">
<ol class="context-data-container result-list">
</ol>
</div>
</div></div>
<div class="yt-uix-pager" role="navigation">
<a href="results?search_query=<?php echo urlencode($_GET["search_query"]); ?>&page=<?php echo $page + 1; ?>" class="yt-uix-button yt-uix-pager-button yt-uix-sessionlink yt-uix-button-default" data-sessionlink="ei=CLHplbT-ibUCFcdRRAod3XcHTw%3D%3D" data-page="2"><span class="yt-uix-button-content">Next »</span></a>
</div>
</div>
<?php
include("./static/footer.php");