Conditions | 2 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 2 |
Changes | 0 |
1 | package utils |
||
17 | func GetAllInformation(html *[]string) []models.PhotoReport { |
||
18 | 1 | var photoReport models.PhotoReport |
|
19 | 1 | var result []models.PhotoReport |
|
20 | |||
21 | 1 | compiledTitle := regexp.MustCompile("<h3 (.|\\n)*?[^ ]>(.*)<\\/a>") |
|
22 | 1 | compiledImage := regexp.MustCompile(" src=\"([\\S]+)\" ") |
|
23 | 1 | compiledURL := regexp.MustCompile(" href=[\"|']([\\S]+)(\"|') ") |
|
24 | |||
25 | 1 | for _, tag := range *html { |
|
26 | 1 | photoReport.Title = compiledTitle.FindStringSubmatch(tag)[2] |
|
27 | 1 | photoReport.Image = compiledImage.FindStringSubmatch(tag)[1] |
|
28 | 1 | photoReport.URL = compiledURL.FindStringSubmatch(tag)[1] |
|
29 | |||
30 | 1 | result = append(result, photoReport) |
|
31 | } |
||
32 | |||
33 | 1 | return result |
|
34 | } |
||
40 |