MCPcopy
hub / github.com/jaeles-project/gospider / feedLinkfinder

Method feedLinkfinder

core/crawler.go:310–345  ·  view source on GitHub ↗
(jsFileUrl string, OutputType string, source string, )

Source from the content-addressed store, hash-verified

308
309
310func (crawler *Crawler) feedLinkfinder(jsFileUrl string, OutputType string, source string, ) {
311
312 if !crawler.jsSet.Duplicate(jsFileUrl) {
313 outputFormat := fmt.Sprintf("[%s] - %s", OutputType, jsFileUrl)
314
315 if crawler.JsonOutput {
316 sout := SpiderOutput{
317 Input: crawler.Input,
318 Source: source,
319 OutputType: OutputType,
320 Output: jsFileUrl,
321 }
322 if data, err := jsoniter.MarshalToString(sout); err == nil {
323 outputFormat = data
324 fmt.Println(outputFormat)
325 }
326
327 } else if !crawler.Quiet {
328 fmt.Println(outputFormat)
329 }
330
331 if crawler.Output != nil {
332 crawler.Output.WriteToFile(outputFormat)
333 }
334
335 // If JS file is minimal format. Try to find original format
336 if strings.Contains(jsFileUrl, ".min.js") {
337 originalJS := strings.ReplaceAll(jsFileUrl, ".min.js", ".js")
338 _ = crawler.LinkFinderCollector.Visit(originalJS)
339 }
340
341 // Send Javascript to Link Finder Collector
342 _ = crawler.LinkFinderCollector.Visit(jsFileUrl)
343
344 }
345}
346
347func (crawler *Crawler) Start(linkfinder bool) {
348 // Setup Link Finder

Callers 2

StartMethod · 0.95
setupLinkFinderMethod · 0.95

Calls 2

DuplicateMethod · 0.80
WriteToFileMethod · 0.80

Tested by

no test coverage detected