Closed Blackrucat closed 4 years ago
It's not a virus haha Just check the code if it reassure you. The software is very simple: you have to choose a song and then the software will crawl bandcamp in order to obtain the right link for the widget (mini-player).
The code of the crawler is:
<?php
$url = $_GET['url'];
$parse = parse_url($url);
if($parse['host'] != 'daily.bandcamp.com' and $parse['host'] != 'bandcamp.com' and strpos($parse['host'], 'bandcamp.com')){
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$html = curl_exec($handle);
libxml_use_internal_errors(true);
$doc = new DOMDocument();
$doc->loadHTML($html);
$id = $doc->getElementsByTagName('meta')->item(20);
echo str_replace('/size=large/tracklist=false/artwork=small/','',str_replace('https://bandcamp.com/EmbeddedPlayer/v=2/album=','',$id->getAttribute('content')));
}
?>
I leave this issue open if you have other questions :)
Dear @Blackrucat, the application has been rebuilt in JavaScript. Now it has a build-int crawler whose code is:
request({
uri: mainWindow.webContents.getURL(),
}, function(error, response, body) {
var $ = cheerio.load(body);
var meta = $("meta");
var id = meta[20]['attribs']['content'].replace('https://bandcamp.com/EmbeddedPlayer/v=2/album=', '').replace('/size=large/tracklist=false/artwork=small/', '');
if(id != ''){
player = new BrowserWindow({
width: 385,
height: 600,
center: true,
titleBarStyle: 'hidden',
frame: process.platform == 'darwin' ? false : true,
});
player.loadURL(require('url').format({
pathname: 'giuliodematteis.altervista.org/bandcamp-desktop/player.php',
query: {'id': id},
protocol: 'https:',
slashes: true
}));
player.setMenu(null);
player.setResizable(false);
}
});
If you have further questions, feel free to reopen this issue :)
Is it safe? you guys probabily won't tell me, but i don't have any money to buy another computer, greetings from Brazil.