@@ -2,6 +2,7 @@ package xiaohongshu
22
33import (
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> ` )
3839if titles == nil || len (titles )!= 2 {
3940return nil ,errors .WithStack (extractors .ErrBodyParseFailed )
4041}
@@ -51,6 +52,11 @@ func (e *extractor) Extract(url string, option extractors.Options) ([]*extractor
5152return nil ,errors .WithStack (extractors .ErrBodyParseFailed )
5253}
5354
55+ pUrl ,err := neturl .ParseRequestURI (url )
56+ if err != nil {
57+ return nil ,errors .WithStack (err )
58+ }
59+
5460// streams
5561streams := make (map [string ]* extractors.Stream )
5662var size int64
@@ -62,6 +68,10 @@ func (e *extractor) Extract(url string, option extractors.Options) ([]*extractor
6268if err != nil {
6369continue
6470}
71+
72+ if pUrl .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+ }
6575streams [strconv .Itoa (i )]= & extractors.Stream {
6676Parts : []* extractors.Part {
6777{