main(String[] args) throws IOException {
String MusicNameUser="морячка";
Document doc=null,doc2=null;
String Name="";
String lol="";
URL name = null;
URL music;
doc= (Document) Jsoup.connect("https://mp3party.net/search?q="+MusicNameUser).get();
Elements musicName=doc.select(".song-item a");
int i = -1;
for(Element none:musicName){
i++;
if(i==0){
lol=none.absUrl("href");
Name=none.ownText();
}
}
Elements MusicName = doc.select("div.track__user-panel");
int j = -1;
for(Element Serch : MusicName){
j++;
if(j==0){
name=new URL(Serch.absUrl("data-js-url"));
}
}
String fileWay="C:\\Users\\amonv\\Desktop\\Новая папка\\"+Name+".mp3";
try{
File file=new File(fileWay);
FileUtils.copyURLToFile(name,file);
System.out.println("Файл загружен");
InputStream inFile=new FileInputStream(fileWay);
} catch (IOException e) {
throw new RuntimeException(e);
}
try{
InputStream inputStream=new FileInputStream(fileWay);
AudioDevice audioDevice=new JavaSoundAudioDevice();
AdvancedPlayer daPlayer=new AdvancedPlayer(inputStream,audioDevice);
daPlayer.play();
} catch (FileNotFoundException|JavaLayerException e) {
throw new RuntimeException(e);
}
}
}
на dpaste.org плиз
https://dpaste.org/73z7C
А почему не скачивается?
Обсуждают сегодня