How to download the fun videos in the ditto video app and the ditto video app
How to download a fun video from the ditto video app
1. ditto video app
Key Content
2. Capture packets to obtain the video address of the app.
Use charles
Enable Proxy:
Set the proxy ip address of the computer on the same wifi:
So many packet capture tools are available for windows.
The last retrieved data interface is:
Http://ditto.short. TV /api/v1/videos
Http://ditto.short. TV /api/v1/sliders
Http://ditto.short. TV /api/v1/videos/153
Http://ditto.short. TV /api/v1/videos? Page = 2
3. json returned by webpage analysis:
This url is required.
4. Get the url. Because I am developing for ios, I directly go to the ios code.
- (void)getDittoVideos { for (int i = 1;i <= 3; i++) { NSString *url = [NSString stringWithFormat:@"http://ditto.short.tv/api/v1/videos?page=%d",i]; AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager GET:url parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"%d\n",i); NSString *detail = @""; NSArray *videoList = responseObject; for (int j=0;j<videoList.count;j++) { NSString *name = [NSString stringWithFormat:@"%@.%@.mp4#%@",videoList[j][@"id"],videoList[j][@"title"],videoList[j][@"url"][@"m3u8"]]; detail = [NSString stringWithFormat:@"%@\n%@",detail,name]; } NSLog(@"%@",detail); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { }]; }}
5. The address is m3u8, which is a live video format. It is not mp4 format. Therefore, you cannot download m3u8 using the conventional method. You can use ffmpeg to download m3u8.
Ffmpeg: https://www.ffmpeg.org/
Download command:
./ffmpeg -i "url" -c copy -bsf:a aac_adtstoasc "fileName.mp4"
6. Download To mp4 format (python)
#coding=utf-8import re,urllib2,osfor line in open("url.txt"): contents = line.split('#') name = contents[0] url = contents[1] urlTmp = url.split() cmd = "./ffmpeg -i \"%s\" -c copy -bsf:a aac_adtstoasc \"%s\"" % (urlTmp[0],name) os.system(cmd)
7. OK. All the videos have been downloaded.