import json

from utils import text_filter
from .basic import get_page


BASE_URL = 'http://weibo.com/p/aj/mblog/getlongtext?ajwvr=6&mid={}'


def get_cont_of_weibo(mid):
    """
    :param mid: weibo's mid
    :return: all cont of the weibo
    """
    url = BASE_URL.format(mid)
    html = get_page(url, user_verify=False)

    if html:
        try:
            html = json.loads(html, encoding='utf-8').get('data').get('html')
            cont = text_filter(html)
        except AttributeError:
            cont = ''
        return cont


@@ -85,16 +85,18 @@
 'http://
+s.
 weibo.co
@@ -101,39 +101,32 @@
 com/
-p/aj/mblog/getlongtext?ajwvr=6&
+ajax/direct/morethan140?
 mid=
@@ -298,24 +298,33 @@
 rl, 
-user_verify=Fals
+auth_level=0, is_ajax=Tru
 e)%0A%0A
@@ -517,16 +517,16 @@
 nt = ''%0A
-
         
@@ -536,10 +536,38 @@
 urn cont
+%0A    else:%0A        return ''
 %0A%0A

optimize crawl for weibo details