Skip to content

Instantly share code, notes, and snippets.

@toomasv
Created November 26, 2019 14:22
Show Gist options
  • Select an option

  • Save toomasv/e6f237d31b4402cac07a1115ccecb3f1 to your computer and use it in GitHub Desktop.

Select an option

Save toomasv/e6f237d31b4402cac07a1115ccecb3f1 to your computer and use it in GitHub Desktop.
Crude hack for cleaning a web-page.
Red [
Date: 26-Nov-2019
See: https://gitter.im/red/help?at=5ddd28def65fec1c8e72c7da
]
clean-url: function [url][
bin: read/binary url
while [
error? err: try [str: to-string b: bin]
][
while [b: find b err/arg1][remove b]
] str
]
; E.g.
comment [
>> read http://www.iwritewordsgood.com/apl/patterns/apl014.htm
*** Access Error: invalid UTF-8 encoding: #{8B6E6F20}
*** Where: read
*** Stack:
>> clean-url http://www.iwritewordsgood.com/apl/patterns/apl014.htm
== {<HTML>^/<HEAD>^/<TITLE>14 Indentifiable Neighborhood</TITLE>^/^/^/^/<link rel="stylesheet" href="../patternlanguag...
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment