无水印视频抓取

最近在研究抖音原视频的抓取,经过网上一系列案例的学习,终于抓取成功了。

以下是实现思路。

1. 把分享链接中的url地址复制出来,在浏览器打开,地址会重定向,f12得到视频带水印的地址。

 

 

2.在控制台的network一栏找到 https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=6917614991038270724 请求地址,可以发现在返回属性中有我们刚刚找到的水印视频地址。

3.把这个地址【https://aweme.snssdk.com/aweme/v1/playwm/?video_id=v0300f0e0000c004aqmo07e7ghnho1og&ratio=720p&line=0】复制出来,将playwm换成play。

再将浏览器改成手机模式请求,就能得到无水印url地址了。

 

以上便是获取抖音无水印视频地址的思路,具体代码实现大家自行解决。

大家可以点击下面地址自行尝试。

视频无水印解析

 

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
抖音无水印视频的下载可以通过调用API接口实现。可以使用Python或Java编写相关代码。 Python实现: ``` import requests import json url = 'https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?itemId=' item_id = '视频ID' headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3' } response = requests.get(url=url+item_id, headers=headers) data = json.loads(response.text) video_url = data['item_list'][0]['video']['play_addr']['url_list'][0] video = requests.get(video_url, headers=headers) with open('video.mp4', 'wb') as f: f.write(video.content) ``` Java实现: ``` import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; public class DownloadVideo { public static void main(String[] args) throws IOException { String url = "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?itemId="; String item_id = "视频ID"; String user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"; String video_url = ""; URL real_url = new URL(url+item_id); HttpURLConnection connection = (HttpURLConnection) real_url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("User-Agent", user_agent); connection.setRequestProperty("Accept", "*/*"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Connection", "keep-alive"); connection.connect(); InputStream in = connection.getInputStream(); byte[] buf = new byte[1024]; int len = 0; StringBuffer stringBuffer = new StringBuffer(); while((len=in.read(buf))!=-1){ stringBuffer.append(new String(buf,0,len)); } in.close(); JSONObject jsonObject = JSON.parseObject(stringBuffer.toString()); video_url = jsonObject.getJSONObject("item_list").getJSONObject("video").getJSONArray("play_addr").getJSONObject(0).getString("url_list").get(0); real_url = new URL(video_url); connection = (HttpURLConnection) real_url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("User-Agent", user_agent); connection.setRequestProperty("Accept", "*/*"); connection.setRequestProperty("Content-Type", "application/octet-stream"); connection.setRequestProperty("Connection", "keep-alive"); connection.connect(); in = connection.getInputStream(); FileOutputStream out = new FileOutputStream("video.mp4"); while((len=in.read(buf))!=-1){ out.write(buf,0,len); } in.close(); out.close(); } } ``` 注意:以上代码仅供学习参考,请勿用于非法用途。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值