Skip to content

Commit 10b3531

Browse files
Specified host scheme
1 parent bd1df24 commit 10b3531

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

is.go

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,16 @@ type IS struct {
3737
var (
3838
userAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36"
3939
anyway = "0"
40-
scheme = "http"
41-
onion = "archiveiya74codqgiixo33q62qlrqtkgmcitqx5u2oeqnmn5bpcbiyd.onion" // archivecaslytosk.onion
40+
onion = "http://archiveiya74codqgiixo33q62qlrqtkgmcitqx5u2oeqnmn5bpcbiyd.onion" // archivecaslytosk.onion
4241
cookie = ""
4342
domains = []string{
44-
"archive.ph",
45-
"archive.today",
46-
"archive.is",
47-
"archive.li",
48-
"archive.vn",
49-
"archive.fo",
50-
"archive.md",
43+
"https://archive.ph",
44+
"https://archive.today",
45+
"https://archive.is",
46+
"https://archive.li",
47+
"https://archive.vn",
48+
"https://archive.fo",
49+
"https://archive.md",
5150
}
5251
)
5352

@@ -76,7 +75,7 @@ func (wbrc *Archiver) Wayback(ctx context.Context, in *url.URL) (dst string, err
7675
if err != nil {
7776
return
7877
}
79-
dst = strings.Replace(dst, onion, "archive.today", 1)
78+
dst = strings.Replace(dst, onion, "https://archive.today", 1)
8079
dst = regexp.MustCompile(`\/again\?url=.*`).ReplaceAllString(dst, "")
8180

8281
return
@@ -100,7 +99,7 @@ func (wbrc *Archiver) Playback(ctx context.Context, in *url.URL) (dst string, er
10099
if err != nil {
101100
return
102101
}
103-
dst = strings.Replace(dst, onion, "archive.today", 1)
102+
dst = strings.Replace(dst, onion, "https://archive.today", 1)
104103

105104
return
106105
}
@@ -184,10 +183,6 @@ func (is *IS) getCookie() string {
184183
}
185184

186185
func (is *IS) getSubmitID(url string) (string, error) {
187-
if !strings.Contains(url, "http") {
188-
return "", fmt.Errorf("missing protocol scheme")
189-
}
190-
191186
r := strings.NewReader("")
192187
req, _ := http.NewRequest("GET", url, r)
193188
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
@@ -221,13 +216,12 @@ func (is *IS) getValidDomain() (*url.URL, error) {
221216
// get valid domain and submitid
222217
r := func(domains []string) {
223218
for _, domain := range domains {
224-
h := fmt.Sprintf("%v://%v", scheme, domain)
225-
id, err := is.getSubmitID(h)
219+
id, err := is.getSubmitID(domain)
226220
if err != nil {
227221
continue
228222
}
229223
is.submitid = id
230-
endpoint, _ = url.Parse(h)
224+
endpoint, _ = url.Parse(domain)
231225
break
232226
}
233227
}

0 commit comments

Comments
 (0)