@@ -19,7 +19,7 @@ type BestHDEngine struct {
19
19
20
20
// NewBestHDEngine : A Movie Engine Constructor for BestHDEngine
21
21
func NewBestHDEngine () * BestHDEngine {
22
- base := "https://www.besthdmovies.top /"
22
+ base := "https://www.besthdmovies.fit /"
23
23
baseURL , err := url .Parse (base )
24
24
if err != nil {
25
25
log .Fatal (err )
@@ -90,7 +90,7 @@ func (engine *BestHDEngine) parseSingleMovie(el *colly.HTMLElement, index int) (
90
90
}
91
91
92
92
func (engine * BestHDEngine ) updateDownloadProps (downloadCollector * colly.Collector , movies * []Movie ) {
93
- submissionDetails := make (map [string ]string )
93
+ // submissionDetails := make(map[string]string)
94
94
// Update movie download link if div.post-single-content on page
95
95
downloadCollector .OnHTML ("div.post-single-content" , func (e * colly.HTMLElement ) {
96
96
movie := & (* movies )[getMovieIndexFromCtx (e .Request )]
@@ -123,14 +123,16 @@ func (engine *BestHDEngine) updateDownloadProps(downloadCollector *colly.Collect
123
123
})
124
124
125
125
downloadCollector .OnHTML ("div.content-area" , func (e * colly.HTMLElement ) {
126
- movie := & (* movies )[getMovieIndexFromCtx (e .Request )]
126
+ movieIndex := getMovieIndexFromCtx (e .Request )
127
+ movie := & (* movies )[movieIndex ]
127
128
links := e .ChildAttrs ("a" , "href" )
128
129
for _ , link := range links {
129
130
if strings .HasPrefix (link , "https://zeefiles" ) || strings .HasPrefix (link , "http://zeefiles" ) {
130
131
// change all http to https
131
132
if strings .HasPrefix (link , "http://" ) {
132
133
link = "https://" + strings .TrimPrefix (link , "http://" )
133
134
}
135
+ link = link + "?movieIndex=" + strconv .Itoa (movieIndex )
134
136
downloadlink , err := url .Parse (link )
135
137
if err == nil {
136
138
movie .DownloadLink = downloadlink
@@ -145,21 +147,13 @@ func (engine *BestHDEngine) updateDownloadProps(downloadCollector *colly.Collect
145
147
downloadCollector .OnHTML ("div.freeDownload" , func (e * colly.HTMLElement ) {
146
148
movieIndex := getMovieIndexFromCtx (e .Request )
147
149
movie := & (* movies )[movieIndex ]
148
- zeesubmission := make (map [string ]string )
149
150
if e .ChildAttr ("a.link_button" , "href" ) != "" {
150
151
downloadlink , err := url .Parse (e .ChildAttr ("a.link_button" , "href" ))
151
152
if err == nil {
152
153
movie .DownloadLink = downloadlink
153
154
}
154
155
} else {
155
-
156
- inputNames := e .ChildAttrs ("input" , "name" )
157
- inputValues := e .ChildAttrs ("input" , "value" )
158
-
159
- for index := range inputNames {
160
- zeesubmission [inputNames [index ]] = inputValues [index ]
161
- }
162
-
156
+ zeesubmission := getFormDetails (e )
163
157
err := downloadCollector .Post (movie .DownloadLink .String (), zeesubmission )
164
158
if err != nil {
165
159
log .Fatal (err )
@@ -172,15 +166,10 @@ func (engine *BestHDEngine) updateDownloadProps(downloadCollector *colly.Collect
172
166
var err error
173
167
movie := & (* movies )[movieIndex ]
174
168
downloadlink := movie .DownloadLink
175
- inputNames := e .ChildAttrs ("input" , "name" )
176
- inputValues := e .ChildAttrs ("input" , "value" )
177
-
178
- for index := range inputNames {
179
- submissionDetails [inputNames [index ]] = inputValues [index ]
180
- }
169
+ submissionDetails := getFormDetails (e )
181
170
requestlink := e .Request .URL .String ()
182
171
if ! (strings .HasPrefix (requestlink , "https://zeefiles" ) || strings .HasPrefix (requestlink , "http://zeefiles" )) {
183
- downloadlink , err = url .Parse ("https://udown.me/watchonline /?movieIndex=" + strconv .Itoa (movieIndex ))
172
+ downloadlink , err = url .Parse ("https://freeload.best/downloading /?movieIndex=" + strconv .Itoa (movieIndex ))
184
173
if err == nil {
185
174
movie .DownloadLink = downloadlink
186
175
}
@@ -191,6 +180,38 @@ func (engine *BestHDEngine) updateDownloadProps(downloadCollector *colly.Collect
191
180
}
192
181
})
193
182
183
+ downloadCollector .OnHTML ("meta[http-equiv=refresh]" , func (e * colly.HTMLElement ) {
184
+ // Retrieve link when on freeload.best/downloading
185
+ movieIndex := getMovieIndexFromCtx (e .Request )
186
+ movie := & (* movies )[movieIndex ]
187
+ content := e .Attr ("content" )
188
+ re := regexp .MustCompile (`url=(.*)` )
189
+ link := re .FindStringSubmatch (content )
190
+ if len (link ) >= 1 {
191
+ downloadLink , _ := url .Parse (link [1 ])
192
+ movie .DownloadLink = downloadLink
193
+ }
194
+ })
195
+
196
+ downloadCollector .OnHTML ("div.freeDownload" , func (e * colly.HTMLElement ) {
197
+ // Retrieve link when on zeefiles.download/id
198
+ movieIndex := getMovieIndexFromCtx (e .Request )
199
+ movie := & (* movies )[movieIndex ]
200
+ linkButton := e .ChildAttr ("a.link_button" , "href" )
201
+ if linkButton != "" {
202
+ movie .DownloadLink , _ = url .Parse (linkButton )
203
+ } else {
204
+ submissionDetails := getFormDetails (e )
205
+ downloadCollector .AllowURLRevisit = true
206
+ if ! strings .Contains (movie .DownloadLink .String (), "download_token" ) {
207
+ err := downloadCollector .Post (movie .DownloadLink .String (), submissionDetails )
208
+ if err != nil {
209
+ log .Fatal (err )
210
+ }
211
+ }
212
+ }
213
+ })
214
+
194
215
downloadCollector .OnHTML ("video" , func (e * colly.HTMLElement ) {
195
216
downloadlink := e .ChildAttr ("source" , "src" )
196
217
movieIndex := getMovieIndexFromCtx (e .Request )
0 commit comments