<commit_before>package main

import (
	"regexp"
	"strings"

	log "github.com/Sirupsen/logrus"
	"github.com/google/go-github/github"
)

//StartCutiePullReq is the number of pull request
//where new template (with a picture of a cute animal) was added
const StartCutiePullReq = 20514

//Repo is repository with docker cuties
const Repo = "docker"

//Owner of repository
const Owner = "docker"

//SearchIssuesLimit is github limit for Search.Issues results
const SearchIssuesLimit = 1000

//PerPage number of pull requests per page
const PerPage = 50

//TwitterUser is account fot docker cuties in twitter
const TwitterUser = "DockerCuties"

//TwitterUploadLimit is limit for media upload in bytes
const TwitterUploadLimit = 3145728

// DockerCutie represents docker cutie by pull request URL and picture URL
type DockerCutie struct {
	pullnumber int
	pullURL    string
	cutieURL   string
}

// GetCutieFromPull parse body of pull request and return cutie if found link:
// ![image](https://cloud.githubusercontent.com/assets/2367858/23283487/02bb756e-f9db-11e6-9aa8-5f3e1bb80df3.png)
func GetCutieFromPull(pull *github.Issue) *DockerCutie {
	// TODO add flic.kr links, now just skip it
	if strings.Contains(*pull.Body, "flic.kr") {
		log.WithFields(log.Fields{"body": *pull.Body, "pull": *pull.URL}).Warn("flic.kr found")
		return nil
	}

	re := regexp.MustCompile(`!\[.*\]\((.*)\)`)
	result := re.FindStringSubmatch(*pull.Body)
	if len(result) > 1 {
		return &DockerCutie{
			pullnumber: *pull.Number,
			pullURL:    *pull.HTMLURL,
			cutieURL:   result[len(result)-1],
		}
	}
	return nil
}<commit_msg>Fix flic.kr link parse<commit_after>package main

import (
	"regexp"
	"strings"

	log "github.com/Sirupsen/logrus"
	"github.com/google/go-github/github"
)

//StartCutiePullReq is the number of pull request
//where new template (with a picture of a cute animal) was added
const StartCutiePullReq = 20514

//Repo is repository with docker cuties
const Repo = "docker"

//Owner of repository
const Owner = "docker"

//SearchIssuesLimit is github limit for Search.Issues results
const SearchIssuesLimit = 1000

//PerPage number of pull requests per page
const PerPage = 50

//TwitterUser is account fot docker cuties in twitter
const TwitterUser = "DockerCuties"

//TwitterUploadLimit is limit for media upload in bytes
const TwitterUploadLimit = 3145728

// DockerCutie represents docker cutie by pull request URL and picture URL
type DockerCutie struct {
	pullnumber int
	pullURL    string
	cutieURL   string
}

// GetCutieFromPull parse body of pull request and return cutie if found link
func GetCutieFromPull(pull *github.Issue) *DockerCutie {
	// flic.kr links
	if strings.Contains(*pull.Body, "flic.kr") {
		log.WithFields(log.Fields{"body": *pull.Body, "pull": *pull.URL}).Warn("flic.kr found")
		// [![kitteh](https://c2.staticflickr.com/4/3147/2567501805_17ee8fd947_z.jpg)](https://flic.kr/p/4UT7Qv)
		re := regexp.MustCompile(`\[!\[.*\]\((.*)\)\]\(.*\)`)
		result := re.FindStringSubmatch(*pull.Body)
		if len(result) > 1 {
			return &DockerCutie{
				pullnumber: *pull.Number,
				pullURL:    *pull.HTMLURL,
				cutieURL:   result[len(result)-1],
			}
		}
		return nil
	}

	// ![image](https://cloud.githubusercontent.com/assets/2367858/23283487/02bb756e-f9db-11e6-9aa8-5f3e1bb80df3.png)
	re := regexp.MustCompile(`!\[.*\]\((.*)\)`)
	result := re.FindStringSubmatch(*pull.Body)
	if len(result) > 1 {
		return &DockerCutie{
			pullnumber: *pull.Number,
			pullURL:    *pull.HTMLURL,
			cutieURL:   result[len(result)-1],
		}
	}
	return nil
}
{'fraction_non_alphanumeric': 0.12482389405466328, 'fraction_numerical': 0.03663003663003663, 'mean_word_length': 4.071428571428571, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1106646', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1222, 'n_words': 331}