JS逆向教程:Python采集今日头条视频( 二 )

< continue_num:print(e)# app_logger.error('function get_data error: %s' % e)continue_number += 1video_address = await get_data(url, continue_number)return video_addresselse:# app_logger.error('function get_data : %sexceed maximum retry' % url)return -1async def get_video_url(main_url, continue_number=0):"""获取视频地址 , js执行"""try:tt = """var c = new Array( - 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);function e(t) {var e, o, i, r, n, a, s;for (a = t.length, n = 0, s = ""; a > n;) {do e = c[255while (a > nif ( - 1 == e) break;do o = c[255while (a > nif ( - 1 == o) break;s += String.fromCharCode(e << 2 | (48do {if (i = 255i = c[i]} while ( a > nif ( - 1 == i) break;s += String.fromCharCode((15do {if (r = 255r = c[r]} while ( a > nif ( - 1 == r) break;s += String.fromCharCode((3--tt-darkmode-color: #979797;">总结该项目是JS反爬的一种 , 相对来说不是很复杂 , 未采用JS代码混淆 , 参数加密等 , 查找方向上障碍不是很多 , 后期碰到复杂点的会继续更新分享的