@@ -3,6 +3,7 @@ package scrape
3
3
import (
4
4
"encoding/json"
5
5
"html"
6
+ "net/http"
6
7
"regexp"
7
8
"strconv"
8
9
"strings"
@@ -148,14 +149,25 @@ func SexLikeReal(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out
148
149
149
150
// Cover
150
151
if ! isTransScene {
151
- coverURL := strings .Replace (gjson .Get (JsonMetadataA ,"thumbnailUrl" ).String (),"app" ,"desktop" ,- 1 )
152
- if len (coverURL )> 0 {
152
+ appCover := gjson .Get (JsonMetadataA ,"thumbnailUrl" ).String ()
153
+ desktopCover := strings .Replace (gjson .Get (JsonMetadataA ,"thumbnailUrl" ).String (),"app" ,"desktop" ,- 1 )
154
+ desktopCresp ,_ := http .Head (desktopCover )
155
+ if desktopCresp .StatusCode == 200 {
156
+ coverURL := desktopCover
153
157
sc .Covers = append (sc .Covers ,coverURL )
154
158
}else {
155
- e .ForEach (`link[as="image"]` ,func (id int ,e * colly.HTMLElement ) {
156
- sc .Covers = append (sc .Covers ,e .Request .AbsoluteURL (e .Attr ("href" )))
157
- })
159
+ appCresp ,_ := http .Head (appCover )
160
+ if appCresp .StatusCode == 200 {
161
+ coverURL := appCover
162
+ sc .Covers = append (sc .Covers ,coverURL )
163
+ defer appCresp .Body .Close ()
164
+ }else {
165
+ e .ForEach (`link[as="image"]` ,func (id int ,e * colly.HTMLElement ) {
166
+ sc .Covers = append (sc .Covers ,e .Request .AbsoluteURL (e .Attr ("href" )))
167
+ })
168
+ }
158
169
}
170
+ defer desktopCresp .Body .Close ()
159
171
}else {
160
172
posterURLFound := false
161
173
e .ForEach (`script[type="text/javascript"]` ,func (id int ,e * colly.HTMLElement ) {