isProbablyHTML returns true for source that is probably HTML. False positives are OK as long as the false positives are not JavaScript source.
(source []byte)
| 68 | // False positives are OK as long as the false positives are not |
| 69 | // JavaScript source. |
| 70 | func isProbablyHTML(source []byte) bool { |
| 71 | for _, b := range source { |
| 72 | if unicode.IsSpace(rune(b)) { |
| 73 | continue |
| 74 | } |
| 75 | |
| 76 | if b == '<' { |
| 77 | return true |
| 78 | } |
| 79 | break |
| 80 | } |
| 81 | |
| 82 | return false |
| 83 | } |
| 84 | |
| 85 | // extractInlineJS extracts inline JavaScript from HTML pages using goquery. |
| 86 | func extractInlineJS(source []byte) []byte { |
no outgoing calls