快速免费的小说下载器,可下载任意小说

小说下载器源码

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

package main //go build -ldflags "-s -w"

import(`io`;`regexp`;`strings`;`runtime`;`os/exec`;`net/http`;`crypto/tls`)

var(sdyd=map[string]string{

`Referer`:`https://m.sdyd.org/`,

`Content-Type`:`application/x-www-form-urlencoded`,

`Cookie`:`8av__v=1; 8av_t=5; 8av_cdn=https%3A%2F%2F23.225.160.18%2Fxcdn8%2F; 8avlatest=6t67; 8avauth=%012169526422943f9IjQ2NTYyOVx0NmE0ODJjZGZcdGNjZGRielx0MTMwMzA1MDYyMTBcdDM1NTg4MzU1OTVAcXEuY29tXHQxNjk3ODU2MjI5XHQi`,

`User-Agent`:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36`}

uri=`https://m.sdyd.org`

r1=regexp.MustCompile(`<div class="sc-title">.*?<span><a href="/html/(\w+).html" target="_blank">(.*?)</a>`)

r2=regexp.MustCompile(`<li>⑵ <a href="(.*?)"`))

func main(){

if runtime.GOOS==`windows`{

exec.Command(`cmd`,`/c`,`start`,`http://localhost/`).Start()

}else if runtime.GOOS==`linux`{

exec.Command(`bash`,`-c`,`x-www-browser`,`http://localhost/`).Start()

}else if runtime.GOOS==`darwin`{

exec.Command(`open`,`http://localhost/`).Start()}

http.HandleFunc(`/`,Search)

http.HandleFunc(`/bk`,Book)

http.ListenAndServe(`:80`,nil)}



func Search(w http.ResponseWriter,r *http.Request){

if r.Method==`GET`{

io.WriteString(w,`<!DOCTYPE html><html><head><title>Search</title><style>

ul,ol,li{list-style-position:inside;text-align:center}

@font-face{font-family:t3;src:url(http://23.225.160.18/xcdn8/ft/y3.woff) format('woff2')}.y3{font-family:t3}

body{background-image:url([img]http://img1.imgtp.com/2023/09/21/NtHOWm9r.jpg[/img]);background-attachment:fixed;background-repeat:no-repeat;background-size:cover}</style></head><body><div id=div align=center><input type=search name=s id=s><input id=ss type=button value=Search><ol id=ol></ol></div><script>ss.onclick=()=>{

let xhr=new XMLHttpRequest()

xhr.open('POST',location.href)

xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded')

xhr.send('s='+s.value)

xhr.onload=()=>{

ol.innerHTML=''

let re=xhr.response.split('||')

for(let i=0;i<re.length-1;i+=2)ol.insertAdjacentHTML('beforeend','<li><a href=bk?s='+re[i]+'>'+re[i+1]+'</a></li>')}}</script></body></html>`)

}else{r.ParseForm()

c:=&http.Client{Transport:&http.Transport{TLSClientConfig:&tls.Config{InsecureSkipVerify:true}}}

q,_:=http.NewRequest(`POST`,uri+`/search/`,strings.NewReader(`keyword=`+r.Form[`s`][0]+`&submit=`))

for k,v:=range sdyd{q.Header.Set(k,v)}

p,_:=c.Do(q)

defer p.Body.Close()

b,_:=io.ReadAll(p.Body)

s1:=r1.FindAllStringSubmatch(string(b),-1)

for i:=0;i<len(s1);i++{io.WriteString(w,s1[i][1]+`||`+s1[i][2]+`||`)}}}



func Book(w http.ResponseWriter,r *http.Request){

r.ParseForm()

c:=&http.Client{Transport:&http.Transport{TLSClientConfig:&tls.Config{InsecureSkipVerify:true}}}

q,_:=http.NewRequest(`GET`,uri+`/downpage/`+r.Form[`s`][0]+`/?sure=2`,nil)

for k,v:=range sdyd{q.Header.Set(k,v)}

p,_:=c.Do(q)

b,_:=io.ReadAll(p.Body)

defer p.Body.Close()

s1:=r2.FindSubmatch(b)

http.Redirect(w,r,dl(uri+string(s1[1])),302)}



func dl(u string)string{

c:=&http.Client{Transport:&http.Transport{TLSClientConfig:&tls.Config{InsecureSkipVerify:true}},CheckRedirect:func(req *http.Request,via []*http.Request)error{return http.ErrUseLastResponse}}

q,_:=http.NewRequest(`GET`,u,nil)

for k,v:=range sdyd{q.Header.Set(k,v)}

p,_:=c.Do(q)

defer p.Body.Close()

return p.Header.Get(`Location`)}

免费小说下载神器软件界面

image.png

编译好的程序下载地址

https://wwgx.lanzoul.com/iebZO19d4def

如何使用

  1. 双击运行exe程序
  2. 在浏览器中打开localhost即可
  3. 输入要下载的小说名称
  4. 点击下载