Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style type="text/css">
- .box{padding:10px;border-bottom:1px solid #ddd}
- .tumb{float:left;margin-right:10px;width:55px;height:55px}
- .right{height:55px}
- .title_box{font-weight:bold}
- .title_box a{color:#555;text-decoration:none}
- @media all and (max-width: 600px) {.tumb {display:none;}}
- </style>
- <?php
- $s = 'aku jatuh cinta';
- // Functions
- function car($ss){
- $ss = trim(preg_replace(array('`"`', '`[^a-z0-9]+`'), array('', '-'), strtolower($ss)), '-');
- return $ss;
- }
- function limit_words($string, $word_limit){
- $words = explode(" ",$string);
- return implode(" ",array_splice($words,0,$word_limit));}
- $api1 = '257519e63d94a91f7a6d0ab40684a6a7';
- $json1 = file_get_contents('http://api.soundcloud.com/tracks.json?client_id='.$api1.'&q='.urlencode(limit_words($s,5)).'&limit=15&offset=1');
- $out1 = json_decode($json1,true);
- $api2 = 'AIzaSyAuRwtR62BoOeW1rgwwPjJJOopiR3zq9BI';
- $json2 = file_get_contents('https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=15&q='.urlencode(limit_words($s,5)).'&type=video&key='.$api2.'');
- $out2 = json_decode($json2,true);
- $output1 = array();
- $output2 = array();
- //output
- foreach ($out1 as $sc){
- $output1[] = '<div class="box">
- <div class="tumb"><img src="https://lh5.ggpht.com/bgW-nCeeAMdoXdWhMXUOMGEmhZn9-nAjPXjikdxfFWzalnN6p5VLqYuVMMhj_lAll3k=w55"/></div>
- <div class="right"><span class="title_box">'.$sc['title'].'</span><br/>
- <span><small>source: soundcloud</small> | <a rel="nofollow" target="_blank" href="https://waitingfor.download/server1/'.$sc['id'].'/'.car($sc['title']).'.html">Download</a></span></div>
- </div>';
- }
- foreach ($out2['items'] as $yt){
- $output2[] = '<div class="box">
- <div class="tumb"><img src="https://lh5.ggpht.com/bgW-nCeeAMdoXdWhMXUOMGEmhZn9-nAjPXjikdxfFWzalnN6p5VLqYuVMMhj_lAll3k=w55"/></div>
- <div class="right"><span class="title_box">'.$yt['snippet']['title'].'</span><br/>
- <span><small>source: youtube</small> | <a rel="nofollow" target="_blank" href="https://waitingfor.download/server2/'.$yt['id']['videoId'].'/'.car($yt['snippet']['title']).'.html">Download</a></span></div>
- </div>';
- }
- $output = array_map( null, $output1, $output2);
- if ( !empty($output) ) {
- foreach ( $output as $lines ) {
- $lines = array_filter( $lines );
- if (!empty($lines)) {
- foreach ( $lines as $line ) {
- echo $line;
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement