# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests, re

sogou_search = 'http://weixin.sogou.com/weixin? ' \
               'type=1&query={}&ie=utf8&_sug_=n&_sug_type_='
req_session = requests.session()
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64)  '
                        'AppleWebKit/537.36 (KHTML, like Gecko)  '
                        'Chrome/52.0.2743.116 Safari/537.36'}

def get_onwer_url(url):
    web_data = req_session.get(url.format('如松'), headers=headers)
    soup = BeautifulSoup(web_data.text, 'lxml')
    owner_urls = soup.select('#sogou_vr_11002301_box_0')
    if owner_urls:
        owner_url = owner_urls[0].get('href')
        print(owner_url)
        get_article_page(owner_url)

def get_article_page(url):
    web_data = req_session.get(url, headers=headers)
    print(web_data.status_code, '\n-------------')
    articles = re.findall(
        r'\/s\?timestamp=\d{10}&amp;amp;src=\d&amp;amp;ver=\d&amp;amp;signature=\S{172}',
                          web_data.text)
    print(len(articles), '\n-------------')
    print(articles[0], '\n-------------')
    # for article in articles:
    #     get_artical_info(article)
    get_artical_info(articles[0].replace('amp;',''))
    # print(articles[0].replace('amp;',''))

def get_artical_info(url):
    goal = 'http://mp.weixin.qq.com' + url
    web_data = req_session.get(goal, headers=headers)
    print(web_data.status_code, '\n-------------')
    soup = BeautifulSoup(web_data.text, 'lxml')
    lines = soup.find_all("p")
    print(len(lines))
    for line in lines:
        line = line.stripped_strings
        for content in line:
            print(content)
    return

get_onwer_url(sogou_search)

# /s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDlud0Xhmx6Hh6tJB3iyo8LGXBhwAZlVLJyiINlwCYOJ7wi4KPyEC6S0gxJVLa1W9eq6bsOSP7O0mIUy9*Ar650XHQ=
''''{&quot;list&quot;:[{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000052,&quot;type&quot;:49,&quot;datetime&quot;:1471214801,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：危机终于来到“身边”&quot;,&quot;digest&quot;:&quot;我们的北边邻居爆发了严重的经济危机，据彭博社发布报道称，蒙古财长Choijilsuren\\\\nBattogtok&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDlud0Xhmx6Hh6tJB3iyo8LGXBhwAZlVLJyiINlwCYOJ7wi4KPyEC6S0gxJVLa1W9eq6bsOSP7O0mIUy9*Ar650XHQ=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000051,&quot;type&quot;:49,&quot;datetime&quot;:1471135852,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：中华最应该闪光的人物是谁？&quot;,&quot;digest&quot;:&quot;&nbsp;&nbsp;&nbsp;这自然是一个仁者见仁智者见智的问题，但影响一个民族最重要的人物应该出自思想和政治两个方面，历史上重要的&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluXFl*jGBN5sA5FJsgQSvd6zJiZXZctriI51DbYoXkBGSPEucHFG0cLlTuywpKtihjqwJnRjgjPrJfJpNYDz9-zY=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000050,&quot;type&quot;:49,&quot;datetime&quot;:1471045500,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：超级黑洞正在形成，哪个家伙会率先进去？&quot;,&quot;digest&quot;:&quot;前天一篇报道（疯狂！全球市场惊现两大“怪象”，这个世界怎么了？），文中说到：“2016年的全球金融市场注定将&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluUzHs5rGLxa2Kdqs9yHi72seJ*y6XogEDyKPWCz7ys8ZEOj6CSibXx2B2G*l-2gp0pa5PZvnqN5Su42TGbCUQjg=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000049,&quot;type&quot;:49,&quot;datetime&quot;:1470970974,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：每个中国人都不能忘记那场屈辱的战败！&quot;,&quot;digest&quot;:&quot;英国脱欧、韩国在境内部署萨德反导系统，已经成为一个时代重新开启的标志，英国韩国都以自己的全球战略和军事利益（&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluec6ntpGzMTNvIVa4w42Zd-CF4bUTUwsXWByLxThRHkqaxafZTG5eAnDpbbxv-RTJuVz3Grb6V3LqgOI*sOe1RE=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000048,&quot;type&quot;:49,&quot;datetime&quot;:1470879794,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：泡沫的脉络和将要撞击的冰山&quot;,&quot;digest&quot;:&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;过去三十年，全球经济被各国央行用印钞机不断推动，形成一个巨大的以资产价格泡沫和债务泡沫为载体的&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluem1m7pYxntEunsBNEnlhpk24kPyy6a8FosPtotpItTBGoyEOFZBwQj6lRDGvP-OaAW66CZmvWFFikxg5K-Ipds=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000047,&quot;type&quot;:49,&quot;datetime&quot;:1470791091,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：可以改变人生命运的“艺术”&quot;,&quot;digest&quot;:&quot;很多人将鬼谷子的学说归结于术的范畴，事实上，鬼谷子的学术是将道与术相结合的典范，是一种“艺术”。而且在如松看&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluQ9nLOYKDpukwixqFqzSA8TsONeOAXNbkPqxSxNCSC8fdDqAf68dG0qvGjuejUGjC5edZYRwGklscIkkHWzW0QI=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000046,&quot;type&quot;:49,&quot;datetime&quot;:1470698428,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：新一代弄潮儿&quot;,&quot;digest&quot;:&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;今年上半年，最引人瞩目的经济现象是民间投资下降，1—6月，民间固定资产投资仅仅同比增长2&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDlufOYF3*eorcVVOOauf5GbZR5mCEApZuRBLdlVeumjg4yqYfF1i8q0PYRZIjeM6MWVISE6GbpgDY4rH1sP6EQcIQ=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000045,&quot;type&quot;:49,&quot;datetime&quot;:1470612387,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：泡沫美国与迷离的黄金&quot;,&quot;digest&quot;:&quot;本来，一旦趋势确立，如松一般也就不再说具体运行过程，技术上的好手们更精于这些方面。但是，由于有过多人关注，也&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluVO7xpbwaP-QQPK6yu0MFbDxXyP5YKs6wenJ4BD5lh0NHLI8wk2zacAloVJzuyZmgdGSKwNXW93helAOCx6sRT4=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000044,&quot;type&quot;:49,&quot;datetime&quot;:1470534027,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：我们的账单为什么总是“赤字”？&quot;,&quot;digest&quot;:&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;本来，周日按惯例应该写历史、思想之类的话题，但觉得更应该尽快写出另外一个话题，那就是我们到底拥&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluc*hWr8RKl8M3swdxJsU88f3KMbn8t72opmHlYSlfjY-Y*atgTW9pdO0*iKnq3Ily9tSUVpEWSFfneta7vlC2IY=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000043,&quot;type&quot;:49,&quot;datetime&quot;:1470446033,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：“大水”冲垮泡沫之后&quot;,&quot;digest&quot;:&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;房地产泡沫最终会被央行不断释放的“大水”所冲垮，因为持续的“大水”让生产要素价格（土地房屋&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluRgrxO2Tdmwwcg5jTQ4o5LGeuiWw1wDx3KrEy83wqRoq*dU8nlcL5Y-8PhOsaOPC8Ym60NWMzPHk22EFenLG5s4=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}}]}';
'''

1a99d5716b59a719f78b3a231503c53a6e2c8144
<mask token>


def get_onwer_url(url):
    web_data = req_session.get(url.format('如松'), headers=headers)
    soup = BeautifulSoup(web_data.text, 'lxml')
    owner_urls = soup.select('#sogou_vr_11002301_box_0')
    if owner_urls:
        owner_url = owner_urls[0].get('href')
        print(owner_url)
        get_article_page(owner_url)


def get_article_page(url):
    web_data = req_session.get(url, headers=headers)
    print(web_data.status_code, '\n-------------')
    articles = re.findall(
        '\\/s\\?timestamp=\\d{10}&amp;amp;src=\\d&amp;amp;ver=\\d&amp;amp;signature=\\S{172}'
        , web_data.text)
    print(len(articles), '\n-------------')
    print(articles[0], '\n-------------')
    get_artical_info(articles[0].replace('amp;', ''))


def get_artical_info(url):
    goal = 'http://mp.weixin.qq.com' + url
    web_data = req_session.get(goal, headers=headers)
    print(web_data.status_code, '\n-------------')
    soup = BeautifulSoup(web_data.text, 'lxml')
    lines = soup.find_all('p')
    print(len(lines))
    for line in lines:
        line = line.stripped_strings
        for content in line:
            print(content)
    return


<mask token>

<mask token>


def get_onwer_url(url):
    web_data = req_session.get(url.format('如松'), headers=headers)
    soup = BeautifulSoup(web_data.text, 'lxml')
    owner_urls = soup.select('#sogou_vr_11002301_box_0')
    if owner_urls:
        owner_url = owner_urls[0].get('href')
        print(owner_url)
        get_article_page(owner_url)


def get_article_page(url):
    web_data = req_session.get(url, headers=headers)
    print(web_data.status_code, '\n-------------')
    articles = re.findall(
        '\\/s\\?timestamp=\\d{10}&amp;amp;src=\\d&amp;amp;ver=\\d&amp;amp;signature=\\S{172}'
        , web_data.text)
    print(len(articles), '\n-------------')
    print(articles[0], '\n-------------')
    get_artical_info(articles[0].replace('amp;', ''))


def get_artical_info(url):
    goal = 'http://mp.weixin.qq.com' + url
    web_data = req_session.get(goal, headers=headers)
    print(web_data.status_code, '\n-------------')
    soup = BeautifulSoup(web_data.text, 'lxml')
    lines = soup.find_all('p')
    print(len(lines))
    for line in lines:
        line = line.stripped_strings
        for content in line:
            print(content)
    return


get_onwer_url(sogou_search)
<mask token>

<mask token>
sogou_search = (
    'http://weixin.sogou.com/weixin? type=1&query={}&ie=utf8&_sug_=n&_sug_type_='
    )
req_session = requests.session()
headers = {'User-Agent':
    'Mozilla/5.0 (Windows NT 6.1; WOW64)  AppleWebKit/537.36 (KHTML, like Gecko)  Chrome/52.0.2743.116 Safari/537.36'
    }


def get_onwer_url(url):
    web_data = req_session.get(url.format('如松'), headers=headers)
    soup = BeautifulSoup(web_data.text, 'lxml')
    owner_urls = soup.select('#sogou_vr_11002301_box_0')
    if owner_urls:
        owner_url = owner_urls[0].get('href')
        print(owner_url)
        get_article_page(owner_url)


def get_article_page(url):
    web_data = req_session.get(url, headers=headers)
    print(web_data.status_code, '\n-------------')
    articles = re.findall(
        '\\/s\\?timestamp=\\d{10}&amp;amp;src=\\d&amp;amp;ver=\\d&amp;amp;signature=\\S{172}'
        , web_data.text)
    print(len(articles), '\n-------------')
    print(articles[0], '\n-------------')
    get_artical_info(articles[0].replace('amp;', ''))


def get_artical_info(url):
    goal = 'http://mp.weixin.qq.com' + url
    web_data = req_session.get(goal, headers=headers)
    print(web_data.status_code, '\n-------------')
    soup = BeautifulSoup(web_data.text, 'lxml')
    lines = soup.find_all('p')
    print(len(lines))
    for line in lines:
        line = line.stripped_strings
        for content in line:
            print(content)
    return


get_onwer_url(sogou_search)
<mask token>

from bs4 import BeautifulSoup
import requests, re
sogou_search = (
    'http://weixin.sogou.com/weixin? type=1&query={}&ie=utf8&_sug_=n&_sug_type_='
    )
req_session = requests.session()
headers = {'User-Agent':
    'Mozilla/5.0 (Windows NT 6.1; WOW64)  AppleWebKit/537.36 (KHTML, like Gecko)  Chrome/52.0.2743.116 Safari/537.36'
    }


def get_onwer_url(url):
    web_data = req_session.get(url.format('如松'), headers=headers)
    soup = BeautifulSoup(web_data.text, 'lxml')
    owner_urls = soup.select('#sogou_vr_11002301_box_0')
    if owner_urls:
        owner_url = owner_urls[0].get('href')
        print(owner_url)
        get_article_page(owner_url)


def get_article_page(url):
    web_data = req_session.get(url, headers=headers)
    print(web_data.status_code, '\n-------------')
    articles = re.findall(
        '\\/s\\?timestamp=\\d{10}&amp;amp;src=\\d&amp;amp;ver=\\d&amp;amp;signature=\\S{172}'
        , web_data.text)
    print(len(articles), '\n-------------')
    print(articles[0], '\n-------------')
    get_artical_info(articles[0].replace('amp;', ''))


def get_artical_info(url):
    goal = 'http://mp.weixin.qq.com' + url
    web_data = req_session.get(goal, headers=headers)
    print(web_data.status_code, '\n-------------')
    soup = BeautifulSoup(web_data.text, 'lxml')
    lines = soup.find_all('p')
    print(len(lines))
    for line in lines:
        line = line.stripped_strings
        for content in line:
            print(content)
    return


get_onwer_url(sogou_search)
<mask token>

# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests, re

sogou_search = 'http://weixin.sogou.com/weixin? ' \
               'type=1&query={}&ie=utf8&_sug_=n&_sug_type_='
req_session = requests.session()
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64)  '
                        'AppleWebKit/537.36 (KHTML, like Gecko)  '
                        'Chrome/52.0.2743.116 Safari/537.36'}

def get_onwer_url(url):
    web_data = req_session.get(url.format('如松'), headers=headers)
    soup = BeautifulSoup(web_data.text, 'lxml')
    owner_urls = soup.select('#sogou_vr_11002301_box_0')
    if owner_urls:
        owner_url = owner_urls[0].get('href')
        print(owner_url)
        get_article_page(owner_url)

def get_article_page(url):
    web_data = req_session.get(url, headers=headers)
    print(web_data.status_code, '\n-------------')
    articles = re.findall(
        r'\/s\?timestamp=\d{10}&amp;amp;src=\d&amp;amp;ver=\d&amp;amp;signature=\S{172}',
                          web_data.text)
    print(len(articles), '\n-------------')
    print(articles[0], '\n-------------')
    # for article in articles:
    #     get_artical_info(article)
    get_artical_info(articles[0].replace('amp;',''))
    # print(articles[0].replace('amp;',''))

def get_artical_info(url):
    goal = 'http://mp.weixin.qq.com' + url
    web_data = req_session.get(goal, headers=headers)
    print(web_data.status_code, '\n-------------')
    soup = BeautifulSoup(web_data.text, 'lxml')
    lines = soup.find_all("p")
    print(len(lines))
    for line in lines:
        line = line.stripped_strings
        for content in line:
            print(content)
    return

get_onwer_url(sogou_search)

# /s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDlud0Xhmx6Hh6tJB3iyo8LGXBhwAZlVLJyiINlwCYOJ7wi4KPyEC6S0gxJVLa1W9eq6bsOSP7O0mIUy9*Ar650XHQ=
''''{&quot;list&quot;:[{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000052,&quot;type&quot;:49,&quot;datetime&quot;:1471214801,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：危机终于来到“身边”&quot;,&quot;digest&quot;:&quot;我们的北边邻居爆发了严重的经济危机，据彭博社发布报道称，蒙古财长Choijilsuren\\\\nBattogtok&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDlud0Xhmx6Hh6tJB3iyo8LGXBhwAZlVLJyiINlwCYOJ7wi4KPyEC6S0gxJVLa1W9eq6bsOSP7O0mIUy9*Ar650XHQ=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000051,&quot;type&quot;:49,&quot;datetime&quot;:1471135852,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：中华最应该闪光的人物是谁？&quot;,&quot;digest&quot;:&quot;&nbsp;&nbsp;&nbsp;这自然是一个仁者见仁智者见智的问题，但影响一个民族最重要的人物应该出自思想和政治两个方面，历史上重要的&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluXFl*jGBN5sA5FJsgQSvd6zJiZXZctriI51DbYoXkBGSPEucHFG0cLlTuywpKtihjqwJnRjgjPrJfJpNYDz9-zY=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000050,&quot;type&quot;:49,&quot;datetime&quot;:1471045500,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：超级黑洞正在形成，哪个家伙会率先进去？&quot;,&quot;digest&quot;:&quot;前天一篇报道（疯狂！全球市场惊现两大“怪象”，这个世界怎么了？），文中说到：“2016年的全球金融市场注定将&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluUzHs5rGLxa2Kdqs9yHi72seJ*y6XogEDyKPWCz7ys8ZEOj6CSibXx2B2G*l-2gp0pa5PZvnqN5Su42TGbCUQjg=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000049,&quot;type&quot;:49,&quot;datetime&quot;:1470970974,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：每个中国人都不能忘记那场屈辱的战败！&quot;,&quot;digest&quot;:&quot;英国脱欧、韩国在境内部署萨德反导系统，已经成为一个时代重新开启的标志，英国韩国都以自己的全球战略和军事利益（&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluec6ntpGzMTNvIVa4w42Zd-CF4bUTUwsXWByLxThRHkqaxafZTG5eAnDpbbxv-RTJuVz3Grb6V3LqgOI*sOe1RE=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000048,&quot;type&quot;:49,&quot;datetime&quot;:1470879794,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：泡沫的脉络和将要撞击的冰山&quot;,&quot;digest&quot;:&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;过去三十年，全球经济被各国央行用印钞机不断推动，形成一个巨大的以资产价格泡沫和债务泡沫为载体的&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluem1m7pYxntEunsBNEnlhpk24kPyy6a8FosPtotpItTBGoyEOFZBwQj6lRDGvP-OaAW66CZmvWFFikxg5K-Ipds=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000047,&quot;type&quot;:49,&quot;datetime&quot;:1470791091,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：可以改变人生命运的“艺术”&quot;,&quot;digest&quot;:&quot;很多人将鬼谷子的学说归结于术的范畴，事实上，鬼谷子的学术是将道与术相结合的典范，是一种“艺术”。而且在如松看&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluQ9nLOYKDpukwixqFqzSA8TsONeOAXNbkPqxSxNCSC8fdDqAf68dG0qvGjuejUGjC5edZYRwGklscIkkHWzW0QI=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000046,&quot;type&quot;:49,&quot;datetime&quot;:1470698428,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：新一代弄潮儿&quot;,&quot;digest&quot;:&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;今年上半年，最引人瞩目的经济现象是民间投资下降，1—6月，民间固定资产投资仅仅同比增长2&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDlufOYF3*eorcVVOOauf5GbZR5mCEApZuRBLdlVeumjg4yqYfF1i8q0PYRZIjeM6MWVISE6GbpgDY4rH1sP6EQcIQ=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000045,&quot;type&quot;:49,&quot;datetime&quot;:1470612387,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：泡沫美国与迷离的黄金&quot;,&quot;digest&quot;:&quot;本来，一旦趋势确立，如松一般也就不再说具体运行过程，技术上的好手们更精于这些方面。但是，由于有过多人关注，也&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluVO7xpbwaP-QQPK6yu0MFbDxXyP5YKs6wenJ4BD5lh0NHLI8wk2zacAloVJzuyZmgdGSKwNXW93helAOCx6sRT4=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000044,&quot;type&quot;:49,&quot;datetime&quot;:1470534027,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：我们的账单为什么总是“赤字”？&quot;,&quot;digest&quot;:&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;本来，周日按惯例应该写历史、思想之类的话题，但觉得更应该尽快写出另外一个话题，那就是我们到底拥&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluc*hWr8RKl8M3swdxJsU88f3KMbn8t72opmHlYSlfjY-Y*atgTW9pdO0*iKnq3Ily9tSUVpEWSFfneta7vlC2IY=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}},{&quot;comm_msg_info&quot;:{&quot;id&quot;:1000000043,&quot;type&quot;:49,&quot;datetime&quot;:1470446033,&quot;fakeid&quot;:&quot;3086873337&quot;,&quot;status&quot;:2,&quot;content&quot;:&quot;&quot;},&quot;app_msg_ext_info&quot;:{&quot;title&quot;:&quot;如松：“大水”冲垮泡沫之后&quot;,&quot;digest&quot;:&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;房地产泡沫最终会被央行不断释放的“大水”所冲垮，因为持续的“大水”让生产要素价格（土地房屋&quot;,&quot;content&quot;:&quot;&quot;,&quot;fileid&quot;:300580222,&quot;content_url&quot;:&quot;\\/s?timestamp=1471221554&amp;amp;src=3&amp;amp;ver=1&amp;amp;signature=IKytqWRXOVNFd8YMY0eOGgMZbx8tH7Vjk2QHnYuNaimtnlCFA2VHDbp2i30hmw7sjfpMKoKpX6ARnfD0PNDluRgrxO2Tdmwwcg5jTQ4o5LGeuiWw1wDx3KrEy83wqRoq*dU8nlcL5Y-8PhOsaOPC8Ym60NWMzPHk22EFenLG5s4=&quot;,&quot;source_url&quot;:&quot;&quot;,&quot;cover&quot;:&quot;http:\\/\\/mmbiz.qpic.cn\\/mmbiz\\/qqDnU5gmVSqzbHficdrXrf2ABfbkQO8ibzNPXQk8Q5STB1lOYJyibxNLgttoibyTzBVibF18DRZMnwz60iaDLRXd1h2g\\/0?wx_fmt=jpeg&quot;,&quot;subtype&quot;:9,&quot;is_multi&quot;:0,&quot;multi_app_msg_item_list&quot;:[],&quot;author&quot;:&quot;如松&quot;,&quot;copyright_stat&quot;:11}}]}';
'''
