短視頻爬蟲(chóng)
使用Python來(lái)爬取短視頻鏈接勇垛,目前只分析了抖音的扎运,用Flask生成了api接口瑟曲,項(xiàng)目地址:ShortVideoSpider。配套客戶端詳見(jiàn)short_video_spider_client
需要的庫(kù)
- Flask~=2.1.2
- requests
- pyOpenSSL
接口
單個(gè)視頻
- 本地地址:http://ip:port/douyin/single?url=https://v.douyin.com/2jA2dGq/&is_origin=0
- 線上地址:http://81.68.122.109:8080/douyin/single?url=https://v.douyin.com/2jA2dGq/&is_origin=0
參數(shù)說(shuō)明: url:分享的短視頻鏈接,可以直接使用復(fù)制內(nèi)容豪治,會(huì)解析里面的鏈接 is_origin: 是否需要原始返回?cái)?shù)據(jù)(0為需要洞拨,1為不需要) 返回?cái)?shù)據(jù)(is_origin為0): { "code": 200, //cover_image_url 視頻封面的圖片地址 "cover_image_url": "https://p3-sign.douyinpic.com/obj/tos-cn-i-dy/b3cc0713ff7c4ad58e989ad4b8fde693?x-expires=1659412800&x-signature=SxHpFcL6X9HpvAS005QMN%2BhPh2Q%3D&from=4257465056_large", //video_url 視頻無(wú)水印地址 "video_url": "https://aweme.snssdk.com/aweme/v1/play/?video_id=v0200fg10000cb6l3ojc77u09nmstov0&ratio=720p&line=0" } 返回?cái)?shù)據(jù)(is_origin為1): 抖音的詳細(xì)數(shù)據(jù),返回的數(shù)據(jù)太多负拟,自己進(jìn)行測(cè)試烦衣。
多個(gè)視頻
- 本地地址:http://ip:port/douyin/list?url=https://v.douyin.com/2YVVPR7/&is_origin=0&max_cursor=0
- 線上地址:http://81.68.122.109:8080/douyin/list?url=https://v.douyin.com/2YVVPR7/&is_origin=0&max_cursor=0
參數(shù)說(shuō)明:(一次最多返回20條數(shù)據(jù)) url:分享的用戶主頁(yè)鏈接,可以直接使用復(fù)制內(nèi)容,會(huì)解析里面的鏈接 is_origin: 是否需要原始返回?cái)?shù)據(jù)(0為需要掩浙,1為不需要) max_cursor:第一次為0花吟,返回會(huì)有hasmore來(lái)確定是否有更多數(shù)據(jù),設(shè)置返回的max_cursor到下次的請(qǐng)求參數(shù)來(lái)請(qǐng)求下次的數(shù)據(jù) 返回?cái)?shù)據(jù)(is_origin為0): { "code": 200, //視頻封面圖片地址的列表 "cover_image_url_list": [ ..... ], //描述信息 "des": "", //是否有更多數(shù)據(jù) "has_more": true, //下次最大滑動(dòng)距離 "max_cursor": 1643624245000, //視頻無(wú)水印地址列表 "video_url_list": [ ..... ] } 請(qǐng)求的數(shù)據(jù)太多厨姚,自己進(jìn)行測(cè)試衅澈。
用戶信息
- 本地地址:http://ip:port/douyin/user?url=https://v.douyin.com/2YVVPR7/
- 線上地址:http://81.68.122.109:8080/douyin/user?url=https://v.douyin.com/2YVVPR7/
參數(shù)說(shuō)明: url:分享的用戶主頁(yè)鏈接,可以直接使用復(fù)制內(nèi)容,會(huì)解析里面的鏈接 返回?cái)?shù)據(jù): { "code": 200, "extra": { "logid": "20220715151907010209168157440162C9", "now": 1657869547000 }, "status_code": 0, "user_info": { "avatar_larger": { "uri": "aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9", "url_list": [ "https://p3.douyinpic.com/aweme/1080x1080/aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9.jpeg?from=2956013662", "https://p11.douyinpic.com/aweme/1080x1080/aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9.jpeg?from=2956013662", "https://p26.douyinpic.com/aweme/1080x1080/aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9.jpeg?from=2956013662" ] }, "avatar_medium": { "uri": "aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9", "url_list": [ "https://p3.douyinpic.com/aweme/720x720/aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9.jpeg?from=2956013662", "https://p11.douyinpic.com/aweme/720x720/aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9.jpeg?from=2956013662", "https://p26.douyinpic.com/aweme/720x720/aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9.jpeg?from=2956013662" ] }, "avatar_thumb": { "uri": "aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9", "url_list": [ "https://p3.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9.jpeg?from=2956013662", "https://p11.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9.jpeg?from=2956013662", "https://p26.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-i-0813_8b7da88366bc40bba58e2f8bce0255c9.jpeg?from=2956013662" ] }, "aweme_count": 6, "card_entries": [], "custom_verify": "", "enterprise_verify_reason": "", "favoriting_count": 0, "follow_status": 0, "follower_count": 101, "followers_detail": null, "following_count": 239, "geofencing": null, "is_gov_media_vip": false, "is_mix_user": false, "mix_count": 0, "mix_info": null, "mplatform_followers_count": 101, "nickname": "十七??", "original_musician": { "digg_count": 0, "music_count": 0, "music_used_count": 0 }, "platform_sync_info": [], "policy_version": null, "sec_uid": "MS4wLjABAAAAsRIQ9howZwtPIsFFZhkMS6q2KIc4wLs5q7LlExJqUNA", "secret": 0, "short_id": "0", "show_favorite_list": false, "signature": "互關(guān)咯\n#中二病 #熬夜冠軍 #俄語(yǔ)廢物", "total_favorited": "263", "type_label": null, "uid": "405060254438335", "unique_id": "xsy897256134", "verification_type": 0 }}
免責(zé)聲明
本倉(cāng)庫(kù)只為學(xué)習(xí)研究谬墙,如涉及侵犯?jìng)€(gè)人或者團(tuán)體利益今布,請(qǐng)與我取得聯(lián)系,我將主動(dòng)刪除一切相關(guān)資料拭抬,謝謝部默!