(转)抖音解析-aardio源码
By
admin
at 2019-07-26 • 0人收藏 • 2592人看过
感谢: aardio编程群 - 面向群编程(2752####88) 提供源码
import string import inet.http; import console import web.rest.jsonLiteClient; var url = "http://v.douyin.com/h7Wapv/" var headerTable = { ["User-Agent"] = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"; } var http = ..inet.http() http.addHeaders = headerTable var urlText = http.get(url) var itemId = ..string.match(urlText,"itemId\: ""(\d+)") var dytk = ..string.match(urlText,"dytk\: ""(\w+)") var urls = "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids="++itemId++"&dytk="++dytk var jsonLiteClient = ..web.rest.jsonLiteClient() var newTable = jsonLiteClient.get(urls) var spUrl = "https://aweme.snssdk.com/aweme/v1/play/?video_id="++newTable["item_list"][1].video["play_addr"].uri++"&line=0" var headerTables = { ["video_id"] = newTable["item_list"][1].video["play_addr"].uri; ["Connection"] = "Keep-Alive"; ["Accept"] = "*/*"; ["User-Agent"] = "Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5)"; ["Host"] = "aweme.snssdk.com"; } var https = ..inet.http() https.addHeaders = headerTables https.disableRedirects() var urlText,urlTexts = https.get(spUrl) var ss = ..string.replace(..string.match(urlTexts,"href\=""(.+)""")," ","") console.log(ss) string.save("C:\Users\app\Desktop\sas.mp4",http.get(ss)) console.pause(true);
1 个回复 | 最后更新于 2019-08-02
登录后方可回帖
下面是jacen分享的代码:
改进了web.rest.jsonLiteClient用来直接取302返回的网址:
aardio几乎可以把任意网址直接声明为aardio中的函数
可以看到, 同样实现一样的功能, 更简单了