mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Expose url for URLReplace in JSON scrapeByURL and scrapeByFragment (#1150)
* Expose url for URLReplace in JSON scrapeByURL and scrapeByFragment * Apply queryURLReplace to xpath scrapers Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -52,7 +52,7 @@ func (s *jsonScraper) loadURL(url string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
logger.Infof("loadURL (%s)\n", url)
|
||||
doc, err := ioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -71,7 +71,8 @@ func (s *jsonScraper) loadURL(url string) (string, error) {
|
||||
}
|
||||
|
||||
func (s *jsonScraper) scrapePerformerByURL(url string) (*models.ScrapedPerformer, error) {
|
||||
doc, scraper, err := s.scrapeURL(url)
|
||||
u := replaceURL(url, s.scraper) // allow a URL Replace for performer by URL queries
|
||||
doc, scraper, err := s.scrapeURL(u)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -81,7 +82,8 @@ func (s *jsonScraper) scrapePerformerByURL(url string) (*models.ScrapedPerformer
|
||||
}
|
||||
|
||||
func (s *jsonScraper) scrapeSceneByURL(url string) (*models.ScrapedScene, error) {
|
||||
doc, scraper, err := s.scrapeURL(url)
|
||||
u := replaceURL(url, s.scraper) // allow a URL Replace for scene by URL queries
|
||||
doc, scraper, err := s.scrapeURL(u)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -91,7 +93,8 @@ func (s *jsonScraper) scrapeSceneByURL(url string) (*models.ScrapedScene, error)
|
||||
}
|
||||
|
||||
func (s *jsonScraper) scrapeGalleryByURL(url string) (*models.ScrapedGallery, error) {
|
||||
doc, scraper, err := s.scrapeURL(url)
|
||||
u := replaceURL(url, s.scraper) // allow a URL Replace for gallery by URL queries
|
||||
doc, scraper, err := s.scrapeURL(u)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -101,7 +104,8 @@ func (s *jsonScraper) scrapeGalleryByURL(url string) (*models.ScrapedGallery, er
|
||||
}
|
||||
|
||||
func (s *jsonScraper) scrapeMovieByURL(url string) (*models.ScrapedMovie, error) {
|
||||
doc, scraper, err := s.scrapeURL(url)
|
||||
u := replaceURL(url, s.scraper) // allow a URL Replace for movie by URL queries
|
||||
doc, scraper, err := s.scrapeURL(u)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user