diff --git a/server/server_search.go b/server/server_search.go index 58594a3cb..0218eb25c 100644 --- a/server/server_search.go +++ b/server/server_search.go @@ -2,6 +2,7 @@ package server import ( "bytes" + "encoding/json" "io/ioutil" "log" "net/http" @@ -27,19 +28,23 @@ func (s *Server) fetchSearchConfigLoop() { } var fetches = 0 -var currentConfig = defaultSearchConfig +var currentConfig, _ = normalize(defaultSearchConfig) func (s *Server) fetchSearchConfig() error { resp, err := http.Get(searchConfigURL) if err != nil { return err } - fetches++ defer resp.Body.Close() newConfig, err := ioutil.ReadAll(resp.Body) if err != nil { return err } + newConfig, err = normalize(newConfig) + if err != nil { + return err + } + fetches++ if bytes.Equal(currentConfig, newConfig) { return nil //skip } @@ -48,29 +53,22 @@ func (s *Server) fetchSearchConfig() error { } s.state.SearchProviders = s.scraper.Config s.state.Push() - if fetches >= 2 { - log.Printf("Loaded new search providers") - } currentConfig = newConfig + log.Printf("Loaded new search providers") return nil } +func normalize(input []byte) ([]byte, error) { + output := bytes.Buffer{} + if err := json.Indent(&output, input, "", " "); err != nil { + return nil, err + } + return output.Bytes(), nil +} + //see github.com/jpillora/scraper for config specification //cloud-torrent uses "-item" handlers var defaultSearchConfig = []byte(`{ - "et": { - "name": "ExtraTorrent", - "url": "https://extratorrent.cc/search/?search={{query}}&s_cat=&pp=&srt=seeds&order=desc&page={{page:1}}", - "list": "table.tl tr.tlr", - "result": { - "name":["td.tli > a"], - "torrent": ["td:nth-child(1) a","@href","s/torrent_download/download/"], - "url": ["td.tli > a","@href"], - "size": "td:nth-child(5)", - "seeds": "td.sy", - "peers": "td.ly" - } - }, "zq": { "name": "Zooqle", "url": "https://zooqle.com/search?q={{query}}&pg={{page:1}}&s=ns&v=t&sd=d", @@ -123,7 +121,7 @@ var defaultSearchConfig = []byte(`{ "name": "1337X (Item)", "url": "http://1337x.to{{item}}", "result": { - "magnet": ["a.btn-magnet","@href"] + "magnet": [".download-links-dontblock a.btn","@href"] } }, "abb": { diff --git a/static/files.go b/static/files.go index c113ace66..f001c6f4a 100644 --- a/static/files.go +++ b/static/files.go @@ -461,7 +461,7 @@ func filesCssThemesDefaultAssetsImagesFlagsPng() (*asset, error) { return a, nil } -var _filesIndexHtml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x9c\x57\xdb\x6e\xdb\x38\x13\xbe\x96\x9f\x62\x42\xfc\x40\x5a\x20\xb2\x9a\x1f\x7b\xe5\x48\x02\xba\x6d\xd0\x5d\x6c\x16\x05\xd2\xec\xde\x14\xc5\x82\xa6\xc6\x32\x1b\x8a\x54\xc9\x91\x9d\xac\xa1\x77\x5f\x90\x3a\x54\x89\x9d\xc6\x69\x2e\x12\x89\x73\xf8\x66\xbe\x39\x88\x49\xd7\x54\x29\xd0\x65\xcc\xeb\x3a\x63\xbc\xae\x59\x3e\x9b\xa5\x6b\xe4\x45\x3e\x8b\x52\x92\xa4\xd0\x4b\x97\x52\x17\x19\x73\xc4\x09\xe7\x9f\x88\x93\x9b\xdf\x78\x11\xcb\xdf\x29\xd3\x14\x70\x63\xac\x45\x4d\x69\x12\x0c\xbc\x65\x85\xc4\x41\xf3\x0a\x33\xb6\x91\xb8\xad\x8d\x25\x06\xc2\x68\x42\x4d\x19\xdb\xca\x82\xd6\x59\x81\x1b\x29\x30\x0e\x2f\x67\x20\xb5\x24\xc9\x55\xec\x04\x57\x98\x9d\xcf\xdf\x9c\x41\xc5\xef\x64\xd5\x54\xd3\xa3\xc6\xa1\x0d\xef\x7c\xa9\x30\xd3\x86\x79\x30\x25\xf5\x2d\x58\x54\x3e\xc2\x7b\x85\x6e\x8d\x48\x0c\xe8\xbe\xc6\x8c\x11\xde\x51\x22\x9c\x63\xb0\xb6\xb8\xca\x98\x70\x2e\xb9\xe2\x64\xc2\xaf\xb9\x17\xfc\x8c\x07\x87\x15\xd7\x24\xc5\xbc\x92\xfa\xa7\x9d\xf0\xba\x3e\x60\x2b\x85\xd1\xa3\x96\x67\x37\x5e\xf1\x8d\x3f\x9c\xd7\xba\x1c\xdc\xc9\x8a\x97\x98\xdc\xc5\x9d\x72\xe2\x3d\x04\xcc\xc7\x68\xf9\x2c\x8a\x3e\xeb\x32\x16\xca\xf0\xdb\x2f\xb0\x9b\x45\x51\x54\x48\x57\x2b\x7e\xbf\x00\x6d\x34\x5e\xcc\xa2\xa8\x9d\x45\x69\x12\xcc\xf3\x59\x9a\x74\xb5\x9f\xa5\x4b\x53\xdc\x83\x50\xdc\xb9\xa1\x2f\xa2\xb4\x90\x1b\x18\xbc\x0d\x32\xc1\x4b\x0c\x38\x83\x54\xae\x32\x76\x22\x8c\xd6\x28\x08\x0b\x36\xea\x75\x27\xf1\x96\x5b\x2d\x75\x09\x8d\x04\xa9\x37\x68\x09\x0b\xf0\x7f\xa4\xe0\x0a\x2a\xee\xc8\x07\x00\x02\x35\xa1\x05\xae\x64\xa9\xb1\x00\x87\x65\x85\x9a\x02\x4e\x07\xd4\x7b\x6d\x24\xf8\x64\x43\x6b\x71\xa9\xd1\x76\x2a\x51\xba\x3e\x9f\xa8\x8c\x40\xde\xf7\xa8\x13\xbd\x97\x6e\x8c\xb3\xb3\x4a\xd6\xe7\x2f\xb0\x4f\xe5\xa0\x63\xb1\x00\x25\xcb\x35\x85\xd4\x42\x55\xf2\x34\x91\xf9\x43\xaf\x69\x52\xc8\x4d\xa0\x6a\x7c\x38\x89\x63\xb8\xf9\xfd\xe6\xea\x12\xb2\x43\x3f\x10\xc7\x23\xb5\x3d\x14\x75\x83\x17\xfc\xad\xff\xdf\x23\xf0\xbe\x61\xd6\x44\xb5\x5b\x24\x49\x29\x69\xdd\x2c\xe7\xc2\x54\xc9\xd7\x5a\x2a\x65\x2c\x4f\xba\x66\xa2\x6e\x54\x19\x10\xb7\x25\x52\xc6\xfe\x59\x2a\xae\x6f\x59\xa8\x9c\x96\x94\x31\x65\x4a\xf3\x9b\xd9\xa0\x85\x0c\x56\x5c\x39\x64\x01\xc3\x2b\x54\xa6\x71\xe8\x45\x0f\xb5\xc8\x36\xc8\x46\xb9\x42\xbe\xc1\x43\x6e\xf6\x58\x5b\xaa\x06\x3b\xb2\xba\xae\x0a\x87\xbb\x10\xe7\xe2\x64\xb4\x3f\x83\x2e\x9b\x05\x8c\x47\x6d\xc7\x2e\xec\x76\xb0\xb7\x93\x3a\x90\xb6\xed\xa9\xe7\x3d\xf3\x3d\x55\x53\x26\xbd\x69\xe3\x86\x86\x91\x3e\x06\xb7\x36\x5b\x5f\xcd\x6f\x0d\x3a\x9a\x0b\xd3\x68\x82\x1c\xde\xb0\x49\x2f\x08\x69\x45\xa3\xb8\x05\x65\x78\xe1\xab\x6d\xb1\x46\x4e\x7b\x45\x97\x5d\x4e\x52\xdc\x66\xec\x7f\xd6\x18\xef\x4e\xaf\x64\x39\xc7\x42\x12\x64\x70\xb2\x77\x78\xf1\x80\x86\xd2\x22\xea\x05\xec\x69\xb5\x7d\x39\x0e\x44\xe4\xd0\x7a\xbe\x3b\x46\xc3\x40\x67\x6c\x65\x34\xc5\x4e\xfe\x8b\x0b\x38\xff\xa5\xbe\xbb\xf8\x71\x88\xa6\xd2\xf2\x51\x80\xe3\xd1\x0f\xc2\x1b\x75\xda\x83\x4c\x55\xbc\xd4\xd8\x33\xd4\x05\x7f\x54\x70\x87\x38\x7f\x38\x63\xd3\x80\xa0\x8f\x68\x9c\xe8\x33\xb0\x58\x2c\xe0\xfb\x2a\x82\xf6\xbb\xff\x27\x46\xf1\xc3\xd5\xc7\x5f\xdf\x5e\xc1\xe5\xf5\xf5\xc7\x6b\xf8\xf3\xf2\xd3\xa7\xb7\x1f\x8e\x98\xcc\x7e\xe9\xa1\xb5\xd3\xf4\xd1\x5a\x63\xa1\x42\xe7\x86\x0d\x39\x49\x4a\x28\xe3\x1e\xf4\xfe\xa4\x08\x68\xfd\xcc\xe8\x46\xa9\x49\xbc\x93\xbe\x1d\x96\xd0\xa5\x07\x18\xe3\x8f\xd2\x3a\xdf\xed\xd0\xda\xb6\x4d\x93\x7a\x92\x9a\x7f\x72\x28\x48\x1a\x3d\xd9\xc5\x2b\x59\x76\xc8\x46\x93\x35\x4a\xf9\x99\x7e\x17\x8e\xdf\x8d\x27\xfd\x52\x10\xaa\x29\x10\x9c\x15\x19\x3b\x25\xac\x6a\xc5\x09\x93\xbe\x23\xfd\xf5\xe1\xd4\x87\xd9\x23\xe4\x07\xd0\x7c\x77\xec\x61\x7d\xac\xb4\x3c\x0e\x29\x34\xd7\x31\x38\xfd\x6a\x73\x7b\x58\xfd\xf5\xc4\x1d\x87\x37\xb8\x39\x0a\xb3\x30\x5b\xed\x17\xc1\x3e\xe8\xfb\x41\x72\x1c\xea\xe8\xe8\x00\xac\xc7\x5d\x19\x43\x68\xbb\x42\xbb\x9a\xeb\x7c\xb2\xe2\x8f\x59\xff\x7b\x0b\x3f\x1f\x24\x7e\x47\x1e\xe5\xe2\x99\x2f\x48\xfe\x40\xec\xbd\xfa\xef\xba\xf3\x64\x3d\xda\xd3\x7f\xf7\xc7\x6d\x1b\xc5\xfe\xea\xe1\xd3\x19\x13\x1b\xa6\x49\x37\xd5\x1f\x78\xef\x5e\x75\x86\x7f\x39\xb4\xee\x35\xe4\x70\xce\xf2\xdd\x0e\x0e\x0a\xdb\x36\x5c\x0f\xdd\xf7\x15\x70\xc0\x7d\xbe\x9f\xa9\x51\x5c\x97\x73\x63\xcb\xfd\x94\x3e\x98\x90\xc7\xa3\xf8\xaf\x1b\x4d\xb2\x42\xf0\x93\x36\x78\x4f\x93\xa1\x42\xa1\x4b\x84\x95\x35\x75\x35\xfe\xea\x92\x0d\xea\xc2\xd8\xe4\x5b\x83\xf6\x3e\x76\x64\xa5\x2e\xe7\x5f\x5d\xa8\x71\x50\xcc\x9f\xb6\xe1\xba\xf4\x9b\x2f\x5c\x34\x8f\x34\xa9\x8c\xbf\x2b\x1d\x69\xa1\xcc\xdd\x53\x5a\x81\xb4\xad\xd4\x85\xd9\xce\x79\x5d\x43\x06\xc3\xcb\x10\x93\x29\x1a\x85\xaf\x4e\x79\x5d\x9f\x9e\xc1\xe7\x2f\xaf\x2f\x02\x11\x4f\xc3\x75\x4b\x63\x32\x26\xcf\x06\xe8\x87\xff\x25\xfa\xc3\xf0\xbe\xc4\x66\x1c\xbd\x97\x18\x35\x24\x95\x7b\x56\x6b\xf8\x3f\x21\x16\x6b\x14\xb7\xcb\xa7\xb9\x1e\x2d\x6c\xb3\x57\xb5\x7e\x8f\xa7\x89\xbf\x92\xfb\xab\x79\xe2\x57\x44\xfe\x5f\x00\x00\x00\xff\xff\x1c\x07\x7e\xa3\xbb\x0d\x00\x00") +var _filesIndexHtml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x9c\x57\x5b\x6f\xdb\xb8\x12\x7e\x96\x7f\xc5\x84\x38\x40\x5a\x20\xb2\x9a\x83\xf3\xe4\x48\x02\x7a\xda\xa0\xbb\xd8\x2c\x0a\xa4\xe9\xbe\x14\xc5\x82\xa6\xc6\x12\x1b\x8a\x64\x49\xca\x4e\xd6\xd0\x7f\x5f\x90\xba\x44\x89\x9c\xd6\x69\x1e\x12\x9b\x73\xf9\x66\xbe\xb9\x90\x49\x2b\x57\x0b\x90\x65\x4c\xb5\xce\x08\xd5\x9a\xe4\x8b\x45\x5a\x21\x2d\xf2\x45\x94\x3a\xee\x04\x7a\xe9\x9a\xcb\x22\x23\xd6\x51\x87\xcb\x4f\x8e\x3a\xbb\xbc\xf1\x22\x92\xbf\x13\xaa\x29\xe0\x46\x19\x83\xd2\xa5\x49\x30\xf0\x96\x35\x3a\x0a\x92\xd6\x98\x91\x2d\xc7\x9d\x56\xc6\x11\x60\x4a\x3a\x94\x2e\x23\x3b\x5e\xb8\x2a\x2b\x70\xcb\x19\xc6\xe1\xcb\x19\x70\xc9\x1d\xa7\x22\xb6\x8c\x0a\xcc\xce\x97\x6f\xce\xa0\xa6\x77\xbc\x6e\xea\xe9\x51\x63\xd1\x84\xef\x74\x2d\x30\x93\x8a\x78\x30\xc1\xe5\x2d\x18\x14\x3e\xc2\x7b\x81\xb6\x42\x74\x04\xdc\xbd\xc6\x8c\x38\xbc\x73\x09\xb3\x96\x40\x65\x70\x93\x11\x66\x6d\x72\x45\x9d\x0a\xbf\x96\x5e\xf0\x2b\x1e\x2c\xd6\x54\x3a\xce\x96\x35\x97\xbf\xec\x84\x6a\x7d\xc0\x96\x33\x25\x47\x2d\xcf\x6e\xbc\xa1\x5b\x7f\xb8\xd4\xb2\x1c\xdc\xf1\x9a\x96\x98\xdc\xc5\x9d\x72\xe2\x3d\x04\xcc\xa7\x68\xf9\x22\x8a\xbe\xc8\x32\x66\x42\xd1\xdb\xaf\xb0\x5f\x44\x51\x54\x70\xab\x05\xbd\x5f\x81\x54\x12\x2f\x16\x51\xd4\x2e\xa2\x34\x09\xe6\xf9\x22\x4d\xba\xda\x2f\xd2\xb5\x2a\xee\x81\x09\x6a\xed\xd0\x17\x51\x5a\xf0\x2d\x0c\xde\x06\x19\xa3\x25\x06\x9c\x41\xca\x37\x19\x39\x61\x4a\x4a\x64\x0e\x0b\x32\xea\x75\x27\xf1\x8e\x1a\xc9\x65\x09\x0d\x07\x2e\xb7\x68\x1c\x16\xe0\xff\x70\x46\x05\xd4\xd4\x3a\x1f\x00\x30\x94\x0e\x0d\x50\xc1\x4b\x89\x05\x58\x2c\x6b\x94\x2e\xe0\x74\x40\xbd\xd7\x86\x83\x4f\x36\xb4\x16\xe5\x12\x4d\xa7\x12\xa5\xd5\xf9\x44\x65\x04\xf2\xbe\x47\x9d\xe8\x3d\xb7\x63\x9c\x9d\x55\x52\x9d\xbf\xc0\x3e\xe5\x83\x8e\xc1\x02\x04\x2f\x2b\x17\x52\x0b\x55\xc9\xd3\x84\xe7\x8f\xbd\xa6\x49\xc1\xb7\x81\xaa\xf1\xc3\x49\x1c\xc3\xcd\xef\x37\x57\x97\x90\x1d\xfa\x81\x38\x1e\xa9\xed\xa1\x5c\x37\x78\xc1\x5f\xf5\xdf\x1e\x81\xf6\x0d\x53\x39\xa7\xed\x2a\x49\x4a\xee\xaa\x66\xbd\x64\xaa\x4e\xbe\x69\x2e\x84\x32\x34\xe9\x9a\xc9\x75\xa3\x4a\xc0\x51\x53\xa2\xcb\xc8\xdf\x6b\x41\xe5\x2d\x09\x95\x93\xdc\x65\x44\xa8\x52\xfd\xa6\xb6\x68\x20\x83\x0d\x15\x16\x49\xc0\xf0\x0a\xb5\x6a\x2c\x7a\xd1\x63\x2d\x67\x1a\x24\xa3\x5c\x20\xdd\xe2\x21\x37\x33\xd6\xd6\xa2\xc1\x8e\xac\xae\xab\xc2\xe1\x3e\xc4\xb9\x3a\x19\xed\xcf\xa0\xcb\x66\x05\xe3\x51\xdb\xb1\x0b\xfb\x3d\xcc\x76\x52\x07\xd2\xb6\x3d\xf5\xb4\x67\xbe\xa7\x6a\xca\xa4\x37\x6d\xec\xd0\x30\xdc\xc7\x60\x2b\xb5\xf3\xd5\xfc\xde\xa0\x75\x4b\xa6\x1a\xe9\x20\x87\x37\x64\xd2\x0b\x8c\x1b\xd6\x08\x6a\x40\x28\x5a\xf8\x6a\x1b\xd4\x48\xdd\xac\xe8\xbc\xcb\x89\xb3\xdb\x8c\xfc\xc7\x28\xe5\xdd\xc9\x0d\x2f\x97\x58\x70\x07\x19\x9c\xcc\x0e\x2f\x1e\xd1\x50\x1a\x44\xb9\x82\x99\x56\xdb\x97\xe3\x40\x44\x16\x8d\xe7\xbb\x63\x34\x0c\x74\x46\x36\x4a\xba\xd8\xf2\x7f\x70\x05\xe7\xff\xd3\x77\x17\x3f\x0e\x51\xd5\x92\x3f\x09\x70\x3c\xfa\x41\x78\xa3\x4e\x7b\x90\xa9\x9a\x96\x12\x7b\x86\xba\xe0\x8f\x0a\xee\x10\xe7\x8f\x67\x6c\x1a\x10\xf4\x11\x8d\x13\x7d\x06\x06\x8b\x15\x3c\xac\x22\x68\x1f\xfc\x3f\x33\x8a\x1f\xae\x3e\xfe\xff\xed\x15\x5c\x5e\x5f\x7f\xbc\x86\x3f\x2f\x3f\x7d\x7a\xfb\xe1\x88\xc9\xec\x97\x1e\x1a\x33\x4d\x1f\x8d\x51\x06\x6a\xb4\x76\xd8\x90\x93\xa4\x98\x50\xf6\x51\xef\x4f\x8a\x80\xc6\xcf\x8c\x6c\x84\x98\xc4\x3b\xe9\xdb\x61\x09\x5d\x7a\x80\x31\xfe\x28\xd5\xf9\x7e\x8f\xc6\xb4\x6d\x9a\xe8\x49\x6a\xfe\x93\x45\xe6\xb8\x92\x93\x5d\xbc\xe1\x65\x87\xac\xa4\x33\x4a\x08\x3f\xd3\xef\xc2\xf1\xbb\xf1\xa4\x5f\x0a\x4c\x34\x05\x82\x35\x2c\x23\xa7\x0e\x6b\x2d\xa8\xc3\xa4\xef\x48\xff\x7c\x38\xf5\x61\xf6\x08\xf9\x01\x34\xdf\x1d\x33\xac\x8f\xb5\xe4\xc7\x21\x85\xe6\x3a\x06\xa7\x5f\x6d\x76\x86\xd5\x3f\x4f\xec\x71\x78\x83\x9b\xa3\x30\x0b\xb5\x93\x7e\x11\xcc\x41\xdf\x0f\x92\xe3\x50\x47\x47\x07\x60\x3d\xee\x46\x29\x87\xa6\x2b\xb4\xd5\x54\x0e\x4d\x37\xdd\x7f\x9f\xb5\xe3\x35\x92\xbc\xd1\x7e\x33\xd2\x52\xbd\x9a\x4b\x5f\x43\xdb\x46\xb1\xbf\xf0\x35\x95\x0f\xee\xf2\xc9\x8d\x71\xcc\x6d\x32\xbb\x3f\xf2\x41\xe2\x57\xee\x51\x2e\x7e\x72\x21\xe5\x8f\xc4\xde\xab\x7f\x26\x58\xcf\xfd\x93\xb5\xff\x57\x7f\x7c\x30\xb1\x81\x27\xd9\xd4\x7f\xe0\xbd\xed\x19\xf9\x6c\xd1\xd8\xd7\x90\xc3\x39\xc9\xf7\x7b\x38\x28\x6c\xdb\xf0\xda\xb4\x0f\x1b\xe5\x10\x6f\xf3\x4c\x95\xa0\xb2\x5c\x2a\x53\xce\x53\xfa\xa0\x42\x1e\x4f\xe2\xbf\x6e\xa4\xaf\x0c\xf8\xc1\x1d\xbc\xa7\xc9\x50\xf0\xd0\x74\xcc\x70\xed\xba\x96\xf9\x66\x93\x2d\xca\x42\x99\xe4\x7b\x83\xe6\x3e\xb6\xce\x70\x59\x2e\xbf\xd9\xd0\x32\x41\x31\x7f\xde\x86\xca\xd2\x2f\xd2\xf0\x6e\x3d\xd2\xa4\x56\xfe\xe9\x75\xa4\x85\x50\x77\xcf\x69\x05\xd2\x76\x5c\x16\x6a\xb7\xa4\x5a\x43\x06\xc3\x97\x21\x26\x55\x34\x02\x5f\x9d\x52\xad\x4f\xcf\xe0\xcb\xd7\xd7\x17\x81\x88\xe7\xe1\xba\x1d\x34\x99\xba\x9f\x06\xe8\x77\xc9\x4b\xf4\x87\x5d\xf0\x12\x9b\x71\x92\x5f\x62\xd4\x38\x2e\xec\x4f\xb5\x86\x7f\x3b\x62\x56\x21\xbb\x5d\x3f\xcf\xf5\x68\x61\x9a\x59\xd5\xfa\x6b\x21\x4d\xfc\x0b\xdf\xbf\xf4\x13\xbf\x71\xf2\x7f\x03\x00\x00\xff\xff\x18\xe9\x3e\x5e\x0a\x0e\x00\x00") func filesIndexHtmlBytes() ([]byte, error) { return bindataRead( @@ -476,7 +476,7 @@ func filesIndexHtml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "files/index.html", size: 3515, mode: os.FileMode(420), modTime: time.Unix(1498117139, 0)} + info := bindataFileInfo{name: "files/index.html", size: 3594, mode: os.FileMode(420), modTime: time.Unix(1499851886, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/static/files/index.html b/static/files/index.html index 90d6d0296..0ee33ced5 100644 --- a/static/files/index.html +++ b/static/files/index.html @@ -57,6 +57,7 @@