Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
9
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
Jan Klass
Sitemap Crawler
Commits
39e68569
Commit
39e68569
authored
Nov 13, 2018
by
Jan Klass
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix
parent
c7140e2a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
crawl.jl
crawl.jl
+4
-2
No files found.
crawl.jl
View file @
39e68569
...
@@ -13,7 +13,8 @@ end
...
@@ -13,7 +13,8 @@ end
function
handlehref
(
data
::
CrawlData
,
base
,
url
,
href
;
forcehttps
=
false
)
function
handlehref
(
data
::
CrawlData
,
base
,
url
,
href
;
forcehttps
=
false
)
# Remove URL fragment (#)
# Remove URL fragment (#)
href
=
match
(
r
"^(?<path>[^\#]*)"
,
href
)[
:
path
]
href
=
match
(
r
"^(?<path>[^\#]*)"
,
href
)[
:
path
]
href_protocol
=
match
(
r
"^(?<protocol>[a-zA-Z0-9]+\:\/\/)?"
,
href
)[
:
protocol
]
href_protocol
=
match
(
r
"^(?<protocol>[a-zA-Z0-9]+)?\:\/\/"
,
href
)[
:
protocol
]
if
href_protocol
!=
nothing
if
href_protocol
!=
nothing
if
href_protocol
==
"http"
||
href_protocol
==
"https"
if
href_protocol
==
"http"
||
href_protocol
==
"https"
if
forcehttps
if
forcehttps
...
@@ -23,10 +24,11 @@ function handlehref(data::CrawlData, base, url, href; forcehttps=false)
...
@@ -23,10 +24,11 @@ function handlehref(data::CrawlData, base, url, href; forcehttps=false)
ismatch
=
startswith
(
href
,
base
)
ismatch
=
startswith
(
href
,
base
)
end
end
# Index urls that start with the base URL
# Index urls that start with the base URL
if
startswith
(
href
,
base
)
if
ismatch
push!
(
data
.
urls
,
href
)
push!
(
data
.
urls
,
href
)
@debug
"Match (absolute URL):
$
href"
@debug
"Match (absolute URL):
$
href"
else
else
@debug
"External URL:
$
href"
push!
(
data
.
urlsexternal
,
href
)
push!
(
data
.
urlsexternal
,
href
)
end
end
else
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment