from .common import HomepageSearchExtractor
import re


class GoldenMoustacheSE(HomepageSearchExtractor):

    def _get_homepage_results(self, n=10):

        webpage = self._download_webpage('http://www.goldenmoustache.com/videos/exclusives/', 'main')
        download_list_html = re.findall(r'<a\s+href="([^"]+)"><img\s+width="\d+"\s+height="\d+"\s+src="([^"]+)"', webpage)
        result = []
        for expr in download_list_html:
            infos = {}
            infos['url'] = expr[0]
            #infos['title'] = expr[1]
            infos['thumbnail'] = expr[1]
            result.append(infos)
        return result

    def _get_icon_url(self):
        return 'https://pbs.twimg.com/profile_images/463330574099156992/rspeNrqx_400x400.png'

@@ -48,16 +48,58 @@
 ort re%0A%0A
+from youtube_dl.utils import unescapeHTML%0A
 %0Aclass G
@@ -296,34 +296,30 @@
         
-download_list_html
+url_thumb_list
  = re.fi
@@ -419,59 +419,210 @@
     
-result = %5B%5D%0A        for expr in download_list_html:
+url_title_list = re.findall(r'%3Ch3 class=%22internet-title%22%3E%3Ca href=%22(%5B%5E%22%5D+)%22%3E(%5B%5E%3C%5D+)%3C', webpage)%0A        result = %5B%5D%0A        i = 0%0A        for expr in url_thumb_list:%0A            expr2 = url_title_list%5Bi%5D
 %0A   
@@ -692,9 +692,8 @@
     
-#
 info
@@ -701,31 +701,46 @@
 %5B'title'%5D = 
+unescapeHTML(
 expr
+2
 %5B1%5D
+)
 %0A           
@@ -802,16 +802,35 @@
 (infos)%0A
+            i += 1%0A
         
@@ -967,8 +967,203 @@
 00.png'%0A
+        #%3Ch3 class=%22internet-title%22%3E%3Ca href=%22http://www.goldenmoustache.com/les-super-heros-baptgael-feat-vincent-tirel-57771/%22%3ELes Super-H%C3%A9ros &#8211; Bapt&#038;Gael feat Vincent Tirel%3C/a%3E%3C/h3%3E%0A

add title