抖音排行榜播放软件源码分享
By
admin
at 2019-12-09 • 0人收藏 • 4495人看过
感谢:aardio培训群: 撒旦微笑 提供源代码
原作者注: 本源码只作为aardio学习使用, 里面的视频和内容都属于抖音版权所有,切勿用于违法用途, 否则后果自负!
import fonts.fontAwesome; import win.ui; /*DSG{{*/ var winform = win.form(text="aardio form";right=419;bottom=799;bgcolor=13195370;border="none";min=false) winform.add( back={cls="plus";text='\uF053';left=0;top=1;right=42;bottom=43;color=16777215;dl=1;dt=1;font=LOGFONT(h=-18;name='FontAwesome');notify=1;z=5}; custom={cls="custom";text="自定义控件";left=0;top=42;right=420;bottom=800;db=1;dl=1;dr=1;dt=1;z=2}; plus={cls="plus";text="list";left=0;top=49;right=420;bottom=84;align="left";bgcolor=13195370;dl=1;dr=1;dt=1;forecolor=15780518;iconStyle={font=LOGFONT(name='FontAwesome')};paddingLeft=10;paddingRight=10;tabstop=1;textPadding={left=10;right=10};z=3}; plus2={cls="plus";text="list";left=0;top=84;right=420;bottom=119;align="left";bgcolor=13195370;dl=1;dr=1;dt=1;forecolor=15780518;notify=1;paddingLeft=10;paddingRight=10;tabstop=1;textPadding={left=10;right=10};z=4}; plus3={cls="plus";text="2019 © 抖音";left=0;top=755;right=420;bottom=797;color=13598861;db=1;dl=1;dr=1;z=6}; title={cls="plus";text="抖音排行榜";left=42;top=0;right=378;bottom=42;color=16777215;dl=1;dr=1;dt=1;transparent=1;z=1} ) /*}}*/ /**排行及视频数据归抖音及原作者所有,请在合理合法范围内使用本源码**/ import win.ui.simpleWindow2; import win.ui.tabs; var titleBar={ background = { hover = 0xFFFF3B3B; active = 0xffff6666; default = 0x0A000000; }; color = { hover = 0xffffffff; active = 0xffffffff; default = 0xffffffff; }; }; var tabsTheme = { //默认状态字体颜色 color = { hover = 0xFFFFFFFF; focus = 0xFFEBEBEB; active =0xFFEBEBEB; default = 0xFFFFFFFF; }; //默认状态边框 border = { default = { top=1; color=0xFF6A58C9; } }; //默认状态前景色 foreground={ default = 0xFF7A68CF; hover = 0xFF9777F2; focus = 0xFF9777F2; }; //选中状态配置 checked = { //选中颜色 color = { default = 0xFF6A58C9; hover = 0xFFFFFFFF; }; //选中前景色 foreground={ default = 0xFFFFFFFF; hover = 0xFF9777F2; }; } }; var bar = win.ui.simpleWindow2(winform,18,42,42).skin(titleBar); var tabs = win.ui.tabs(winform.plus,winform.plus2); tabs.skin(tabsTheme) tabs.clear(); var hotListUrl = "https://www.iesdouyin.com/web/api/v2/hotsearch/billboard/aweme/"; //获取热门视频 var getHotList = function(url){ import web.rest.jsonLiteClient; import web.rest.jsonLiteClient; var http = web.rest.jsonLiteClient(); var res = http.get(url)||{}; if(res.status_code=="0"){ var list = res.aweme_list; list = table.map(list,function(v,k,result){ var url = "https://aweme.snssdk.com/aweme/v1/play/?video_id="++v.aweme_info.video.vid++"&line=0&ratio=720p"; var tab = { title = v.aweme_info.desc; url = url; } return tab; }) return list; }else { return {}; } }; //获取视频地址 var getVideo = function(url){ import inet.http; var http = inet.http(); http.addHeaders={ ["user-agent"] = "user-agent:Mozilla/5.0 (Linux; U; Android 8.0.0; zh-cn; MI 5 Build/OPR1.170623.032) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/9.6 Mobile Safari/537.36" } var res = http.location(url); return res||""; }; var tab = getHotList(hotListUrl); //填充播放列表 for(k,v in tab){ tabs.add({ text=v.title; }) } tabs.selIndex = 1;//设置默认选中的索引 //将视频层切换orphanWindow模式,并隐藏相关控件 winform.custom.orphanWindow() winform.back.show(false) winform.custom.show(false) var wmp = winform.custom.createEmbed( "WMPlayer.OCX" )._object; tabs.oncommand = function(strip,id,event){ winform.title.text=tab[tabs.selIndex].title; playUrl=tab[tabs.selIndex].url; wmp.url = getVideo(playUrl); //恢复视频相关控件显示 winform.back.show(true) winform.custom.show(true) } winform.back.oncommand = function(id,event){ wmp.controls.stop() winform.title.text="抖音排行榜" winform.back.show(false) winform.custom.show(false) } //优化视频层显示时,窗口关闭效果 winform.onClose = function(hwnd,message,wParam,lParam){ winform.show(false) } winform.show() win.loopMessage();
1 个回复 | 最后更新于 2019-12-10
登录后方可回帖
用起来更简洁了, 给力![](/static/editor/dialogs/emotion/images/pp/i_f48.png)