-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
59 lines (46 loc) · 1.24 KB
/
index.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
<table border="0" width="100%">
<tr>
<th>Imagem</th>
<th>Titulo</th>
<th>Autor</th>
<th>Views</th>
<th>Tempo</th>
<th>Link</th>
</tr>
<?php
require 'simple_html_dom.php';
$html = file_get_html('https://www.youtube.com/results?search_query=gta');
$results = $html->find('.yt-lockup');
echo "TOTAL DE RESULTADOS :" . count($results);
foreach ($results as $video) {
$imagem = $video->find('.yt-thumb-simple img', 0)->attr['src'] ?? '';
$tempo = $video->find('.video-time', 0)->plaintext ?? '';
$link = $video->find('.yt-lockup-title a', 0)->href ?? '';
$titulo = $video->find('.yt-lockup-title a', 0)->plaintext ?? '';
$autor = $video->find('.yt-lockup-byline a', 0)->plaintext ?? '';
$views = $video->find('.yt-lockup-meta-info li', 1)->plaintext ?? '';
?>
<tr>
<td>
<img src="<?php echo $imagem;?>" alt="">
</td>
<td>
<?php echo $titulo;?>
</td>
<td>
<?php echo $autor;?>
</td>
<td>
<?php echo $views;?>
</td>
<td>
<?php echo $tempo;?>
</td>
<td>
<?php echo $link;?>
</td>
</tr>
<?php
}
?>
</table>