package com.todoist.mediaparser.mediaparser;

import com.todoist.mediaparser.util.MediaType;

import java.util.regex.Pattern;

public class FlickrParser extends BaseOEmbedMediaParserWithContent {
	private static Pattern sMatchingPattern;

	FlickrParser(String url) {
		super(url);
	}

	@Override
	public MediaType getContentMediaType() {
		return MediaType.OTHER;
	}

	@Override
	protected Pattern getMatchingPattern() {
		if(sMatchingPattern == null) {
			sMatchingPattern = Pattern.compile(
					"https?://(?:www\\.)?(?:flic\\.kr/p|flickr.com/photos)/\\w+/?",
					Pattern.CASE_INSENSITIVE
			);
		}
		return sMatchingPattern;
	}

	@Override
	protected String getOEmbedUrlTemplate() {
		return "http://www.flickr.com/services/oembed?url=%s&format=json";
	}

	@Override
	protected String getOEmbedContentUrlName() {
		return "url";
	}

	@Override
	protected String getOEmbedThumbnailUrlName() {
		return "thumbnail_url";
	}
}

@@ -622,24 +622,315 @@
 attern;%0A%09%7D%0A%0A
+%09@Override%0A%09protected String createThumbnailUrl(int smallestSide) %7B%0A%09%09// Flickr thumbnails are tiny. If available, use content url.%0A%09%09String contentUrl = super.getContentUrl();%0A%09%09if(!mUrl.equals(contentUrl))%0A%09%09%09return contentUrl;%0A%09%09else%0A%09%09%09return super.createThumbnailUrl(smallestSide);%0A%09%7D%0A%0A
 %09@Override%0A%09

Use flickr's full image for the thumbnail, if available