Skip to content

Commit ad1901c

Browse files
committed
Improve profileTarget extraction
1 parent 32e243a commit ad1901c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

scrapers/scraper.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@ func dry(s string) string {
2222
return strings.Join(strings.Fields(s), " ")
2323
}
2424

25-
func reEscape(s string) string {
26-
decodedValue, _ := url.QueryUnescape(s)
27-
return url.QueryEscape(decodedValue)
28-
}
29-
3025
func extractProfileTarget(link string) string {
31-
return reEscape(link[69:]) // Nice
26+
u, _ := url.Parse(link)
27+
m, _ := url.ParseQuery(u.RawQuery)
28+
return url.QueryEscape(m["profileTarget"][0])
3229
}
3330

3431
func collyFactory() (c *colly.Collector) {

0 commit comments

Comments
 (0)