-
Notifications
You must be signed in to change notification settings - Fork 9
/
miaopai.go
37 lines (34 loc) · 831 Bytes
/
miaopai.go
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
26
27
28
29
30
31
32
33
34
35
36
37
package extractors
import (
"github.com/iawia002/annie/downloader"
"github.com/iawia002/annie/parser"
"github.com/iawia002/annie/request"
"github.com/iawia002/annie/utils"
)
// Miaopai download function
func Miaopai(url string) downloader.VideoData {
html := request.Get(url, url)
doc := parser.GetDoc(html)
title := parser.Title(doc)
realURL := utils.MatchOneOf(html, `"videoSrc":"(.+?)"`)[1]
size := request.Size(realURL, url)
urlData := downloader.URLData{
URL: realURL,
Size: size,
Ext: "mp4",
}
format := map[string]downloader.FormatData{
"default": {
URLs: []downloader.URLData{urlData},
Size: size,
},
}
extractedData := downloader.VideoData{
Site: "秒拍 miaopai.com",
Title: title,
Type: "video",
Formats: format,
}
extractedData.Download(url)
return extractedData
}