1.java实现最新获取抖音无水印视频和背景音乐
2.求音乐播放器java源代码
3.java编音乐播放器
java实现最新获取抖音无水印视频和背景音乐
提供Java版获取抖音无水印视频与背景音乐的音乐源码b音工具,已整合至网站,网站网址如下:
在线演示地址:
通过代码实现,乐网modbus 调试vb源码主要依赖于jsoup库,站源步骤如下:
首先定义获取链接的音乐源码b音涨跌数指标源码主要方法:
java
public static void main(String[] args) throws Exception {
String url = "三里屯街拍,祝愿大家高考顺利 v.douyin.com/JNDRc6L/ 复制此链接,网站知识付费 源码 php打开抖音短视频,乐网直接观看视频!站源";
System.out.println(getDyMp4Jsoup(url));
}
随后,音乐源码b音定义连接获取方法:
java
public static Connection getConn(String url) {
return Jsoup.connect(url).userAgent("Mozilla/5.0 (iPhone; CPU iPhone OS _0 like Mac OS X) AppleWebKit/.1. (KHTML,网站 like Gecko) Version/.0 Mobile/A Safari/.1").ignoreContentType(true);
}
实现核心功能的方法如下:
java
public static Map dyhtml(String url){
Map restmap = new HashMap();
Connection con = getConn(url);
String recurl = getRedirectURL(con);
String[] rest = recurl.split("video/");
String[] mid = rest[1].split("/");
String rceurl = " iesdouyin.com/web/api/v..."+mid[0];
Connection reccon = getConn(rceurl);
Response res = reccon.ignoreContentType(true).timeout().execute();
JSONObject json = JSONObject.parseObject(res.body());
List<Object> maprest = (List<Object>) json.get("item_list");
Map<Object, Object> re = maprest.get(0);
Map<Object, Object> video = (Map<Object, Object>) re.get("video");
Map<Object, Object> play_addr = (Map<Object, Object>) video.get("play_addr");
String urls = ((List<Object>)play_addr.get("url_list")).get(0);
urls = urls.replace("playwm", "play");
restmap.put("urls", urls);
Map<Object, Object> music = (Map<Object, Object>) re.get("music");
Map<Object, Object> play_url = (Map<Object, Object>) music.get("play_url");
String uri = play_url.get("uri")+"";
restmap.put("uri", uri);
return restmap;
}
接着,解析视频链接与音乐链接:
java
public static Map getDyMp4Jsoup(String url1) throws Exception {
String finalUrl = decodeHttpUrl(url1);
Map restmap = dyhtml(finalUrl);
String matchUrl = restmap.get("urls")+"";
Connection connreturl = getConn(matchUrl);
String urlrest = getRedirectURL(connreturl);
restmap.put("urlrest",乐网 urlrest);
return restmap;
}
最后,获取重定向后的站源链接地址:
java
private static String getRedirectURL(Connection conn) throws IOException {
return conn.followRedirects(false).timeout().execute().header("location");
}
并提供解码链接方法:
java
public static String decodeHttpUrl(String url) {
int start = url.indexOf(".*;
import javax.swing.*;
import java.io.File;
class AudioPlayDemo extends JFrame implements ActionListener {
boolean looping = false;
File file1 = new File("music\\明天会更好.wav");
AudioClip sound1;
AudioClip chosenClip;
JButton playButton = new JButton("播放");
JButton loopButton = new JButton("循环播放");
JButton stopButton = new JButton("停止");
JLabel status = new JLabel("选择播放文件");
JPanel controlPanel = new JPanel();
Container container = getContentPane();
public AudioPlayDemo() {
try {
sound1 = Applet.newAudioClip(file1.toURL());
chosenClip = sound1;
} catch(OutOfMemoryError e){
System.out.println("内存溢出");
e.printStackTrace();
} catch(Exception e){
e.printStackTrace();
}
playButton.addActionListener(this);
loopButton.addActionListener(this);
stopButton.addActionListener(this);
stopButton.setEnabled(false);
controlPanel.add(playButton);
controlPanel.add(loopButton);
controlPanel.add(stopButton);
container.add(controlPanel, BorderLayout.CENTER);
container.add(status, BorderLayout.SOUTH);
setSize(, );
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //关闭窗口时退出程序
}
public void actionPerformed(ActionEvent event) {
if (chosenClip == null) {
status.setText("声音未载入");
return;
}
Object source = event.getSource(); //获取用户洗涤激活的按钮
if (source == playButton) {
stopButton.setEnabled(true);
loopButton.setEnabled(true);
chosenClip.play();
status.setText("正在播放");
}
if (source == loopButton) {
looping = true;
chosenClip.loop();
loopButton.setEnabled(false);
stopButton.setEnabled(true);
status.setText("正在循环播放");
}
if (source == stopButton) {
if (looping) {
looping = false;
chosenClip.stop();
loopButton.setEnabled(true);
} else {
chosenClip.stop();
}
stopButton.setEnabled(false);
status.setText("停止播放");
}
}
public static void main(String s[]) {
new AudioPlayDemo();
}
}
这功能不齐,不能下载,音乐源码b音影视源码没有网络也不能播放mp3格式音乐,网站是乐网斗牛棋牌源码规则用来播放wav格式音乐的,(但你可以在千千静听里把mp3格式转换为wav格式)
java编音乐播放器
package bofan;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.io.File.*;
import java.io.*;
import javax.media.ControllerClosedEvent;
import javax.media.ControllerEvent;
import javax.media.ControllerListener;
import javax.media.EndOfMediaEvent;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.media.PrefetchCompleteEvent;
import javax.media.RealizeCompleteEvent;
import javax.media.Time;
import java.beans.*;
public class yinyue{
private static String path = "a.mp3";
public static void main(String[] args) {
File f1 = new File(path);
try {
Player player = Manager.createRealizedPlayer(f1.toURI().toURL());
System.out.println("获得文件播放时间: "
+ player.getDuration().getSeconds());
player.prefetch();
player.setMediaTime(new Time(.0));//从莫个时间段开始播放
player.start();
}catch(Exception ex){ }
}
}