@@ -515,6 +515,8 @@ def push(value)
515515 [ '--proxy_username' , GetoptLong ::REQUIRED_ARGUMENT ] ,
516516 [ '--proxy_password' , GetoptLong ::REQUIRED_ARGUMENT ] ,
517517 [ "--verbose" , "-v" , GetoptLong ::NO_ARGUMENT ] ,
518+ [ "--keep-js" , GetoptLong ::NO_ARGUMENT ] ,
519+ [ "--keep-css" , GetoptLong ::NO_ARGUMENT ] ,
518520 [ "--debug" , GetoptLong ::NO_ARGUMENT ]
519521)
520522
@@ -549,6 +551,8 @@ def usage
549551 --meta-temp-dir <dir>: The temporary directory used by exiftool when parsing files, default /tmp.
550552 -c, --count: Show the count for each word found.
551553 -v, --verbose: Verbose.
554+ --keep-js: By default all JavaScript is removed, use this to keep it
555+ --keep-css: By default all CSS is removed, use this to keep it
552556 --debug: Extra debug information.
553557
554558 Authentication
@@ -625,6 +629,10 @@ def usage
625629 words_with_numbers = true
626630 when "--convert-umlauts"
627631 convert_umlauts = true
632+ when "--keep-css"
633+ strip_css = false
634+ when "--keep-js"
635+ strip_js = false
628636 when "--count"
629637 show_count = true
630638 when "--meta-temp-dir"
@@ -1097,17 +1105,12 @@ def extract_domain(url, verbose=false)
10971105 re = Regexp . escape ( full_match )
10981106 body . gsub! ( /#{ re } / , "" )
10991107
1100- if j_url !~ /https?:\/ \/ /i
1101- parsed = URI . parse ( a_url )
1102- protocol = parsed . scheme
1103- host = parsed . host
1104-
1105- domain = "#{ protocol } ://#{ host } "
1106-
1107- j_url = domain + j_url
1108- j_url += $1 if j_url [ 0 ] == "/" && parsed . path =~ /(.*)\/ .*/
1109-
1110- puts "Relative URL found, adding domain to make #{ j_url } " if verbose
1108+ begin
1109+ j_url = URI . join ( a_url , j_url ) . to_s
1110+ puts "Resolved redirect to #{ j_url } " if verbose
1111+ rescue URI ::InvalidURIError => e
1112+ puts "Invalid Javascript redirect URL #{ j_url } on #{ a_url } " if verbose
1113+ next
11111114 end
11121115
11131116 x = { a_url => j_url }
0 commit comments