Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit03f19e9

Browse files
authored
Merge pull request#1337 from iAsuma/contrib
优化小红书下载
2 parents511cc54 +85bcc2f commit03f19e9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

‎extractors/extractors.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ func Extract(u string, option Options) ([]*Data, error) {
4141
}
4242
ifu.Host=="haokan.baidu.com" {
4343
domain="haokan"
44+
}elseifu.Host=="xhslink.com" {
45+
domain="xiaohongshu"
4446
}else {
4547
domain=utils.Domain(u.Host)
4648
}

‎extractors/xiaohongshu/xiaohongshu.go‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package xiaohongshu
22

33
import (
44
"encoding/json"
5+
neturl"net/url"
56
"strconv"
67
"strings"
78

@@ -34,7 +35,7 @@ func (e *extractor) Extract(url string, option extractors.Options) ([]*extractor
3435
}
3536

3637
// title
37-
titles:=utils.MatchOneOf(html,`,"title":"(.+?)",`)
38+
titles:=utils.MatchOneOf(html,`<title>(.*?)</title>`)
3839
iftitles==nil||len(titles)!=2 {
3940
returnnil,errors.WithStack(extractors.ErrBodyParseFailed)
4041
}
@@ -51,6 +52,11 @@ func (e *extractor) Extract(url string, option extractors.Options) ([]*extractor
5152
returnnil,errors.WithStack(extractors.ErrBodyParseFailed)
5253
}
5354

55+
pUrl,err:=neturl.ParseRequestURI(url)
56+
iferr!=nil {
57+
returnnil,errors.WithStack(err)
58+
}
59+
5460
// streams
5561
streams:=make(map[string]*extractors.Stream)
5662
varsizeint64
@@ -62,6 +68,10 @@ func (e *extractor) Extract(url string, option extractors.Options) ([]*extractor
6268
iferr!=nil {
6369
continue
6470
}
71+
72+
ifpUrl.Host=="xhslink.com"&&strings.Contains(u,"sns-video-qc") {
73+
size+=1// Make sure the link is downloadable and sort the link first with the same size
74+
}
6575
streams[strconv.Itoa(i)]=&extractors.Stream{
6676
Parts: []*extractors.Part{
6777
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp