{"id":59,"date":"2014-06-23T15:05:20","date_gmt":"2014-06-23T15:05:20","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=59"},"modified":"2014-06-23T15:05:20","modified_gmt":"2014-06-23T15:05:20","slug":"%e6%96%b0%e6%b5%aa%e5%8d%9a%e5%ae%a2%e6%96%87%e7%ab%a0%e6%89%b9%e9%87%8f%e4%b8%8b%e8%bd%bd%e7%9a%84python%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/59.html","title":{"rendered":"\u65b0\u6d6a\u535a\u5ba2\u6587\u7ae0\u6279\u91cf\u4e0b\u8f7d\u7684Python\u811a\u672c"},"content":{"rendered":"<h6>Update @ 2015-6-14<\/h6>\n<p>\u5efa\u8bae\u6709\u6279\u91cf\u4e0b\u8f7d\u65b0\u6d6a\u535a\u5ba2\u6587\u7ae0\u9700\u6c42\u7684\u540c\u5b66\u4f7f\u7528\u00a0<a href=\"https:\/\/github.com\/bfishadow\/SBB\" target=\"_blank\">https:\/\/github.com\/bfishadow\/SBB<\/a> \u6765\u8fdb\u884c\u64cd\u4f5c\uff0c\u4e00\u4e2a\u7b80\u5355\u7684Python\u811a\u672c\uff0c\u6ca1\u6709\u7528\u5230BeautifulSoup\uff0c\u751a\u81f3\u90fd\u6ca1\u6709\u7528re\uff0c\u4ec5\u4ec5\u4f9d\u9760urllib2\u6a21\u5757\u4e0b\u8f7d\uff0c\u7136\u540e\u5b57\u7b26\u4e32\u8fdb\u884c\u622a\u53d6\u64cd\u4f5c\u5c31\u53ef\u4ee5\u8fbe\u5230\u76f8\u540c\u7684\u76ee\u7684\uff0c\u901f\u5ea6\u4e5f\u6bd4\u8f83\u5feb\uff0c\u4e0d\u8fc7\u7f3a\u70b9\u5c31\u662f\u6ca1\u6709\u65b0\u5efa\u76ee\u5f55\u8fdb\u884c\u5b58\u653e\uff0c\u6240\u4ee5\u5728\u64cd\u4f5c\u7684\u65f6\u5019\u8981\u6ce8\u610f\u653e\u5728\u4e00\u4e2a\u5355\u72ec\u7684\u76ee\u5f55\u4e2d\u6267\u884c\uff1b\u6709\u80fd\u529b\u7684\u540c\u5b66\u53ef\u4ee5\u81ea\u884c\u4e0b\u8f7d\u8be5\u811a\u672c\u8fdb\u884c\u4e00\u4e9b\u4fee\u6539\uff0c\u6dfb\u52a0\/\u4fee\u6539\u4e00\u4e9b\u529f\u80fd\u65b9\u4fbf\u81ea\u5df1\u4f7f\u7528\u3002<\/p>\n<pre class=\"lang:default decode:true\">&gt; python SBB.py http:\/\/blog.sina.com.cn\/chjguancha<\/pre>\n<hr \/>\n<p>\u5728\u4e00\u4e2a\u5927\u725b\u7684blog\u91cc\u9762\u901b\u7684\u65f6\u5019\u770b\u5230\u4ed6\u4e4b\u524d\u5199\u7684\u8fd9\u4e2aPython\u6293\u53d6\u811a\u672c\uff0c\u89c9\u5f97\u6bd4\u8f83\u6709\u8da3\u800c\u4e14\u6709\u4e00\u5b9a\u5b9e\u9645\u610f\u4e49\uff0c\u5c31\u6536\u85cf\u4e86~~\u539f\u59cb\u7684\u811a\u672c\u56e0\u4e3a\u662f2012\u5e741\u6708\u4efd\u5de6\u53f3\u5199\u7684\uff0c\u73b0\u5728\u7684BeautifulSoup\u8fd9\u4e2a\u6a21\u5757\u4e5f\u6709\u4e86\u53d8\u5316\uff0c\u6240\u4ee5\u7a0d\u5fae\u4fee\u6539\u4e86\u4e00\u4e0b\uff0c\u671f\u95f4\u89e3\u51b3\u95ee\u9898\u7684\u8fc7\u7a0b\u503c\u5f97\u8bb0\u5f55\uff0c\u6240\u4ee5\u4e5f\u5c31\u4e00\u5e76\u53d1\u51fa\u6765\u4e86\uff0c\u505a\u4e2a\u8bb0\u5f55\uff1a<\/p>\n<hr \/>\n<h6>\u9996\u5148\uff0c\u539f\u6587\u94fe\u63a5\uff1a<\/h6>\n<p><a style=\"font-weight: inherit; font-style: inherit; color: #2c63a9;\" title=\"\u65b0\u6d6a\u535a\u5ba2\u6279\u91cf\u4e0b\u8f7d\" href=\"https:\/\/github.com\/dangoakachan\/Dango-Scripts\/blob\/master\/Others\/sinablog_download.py\" target=\"_blank\">\u65b0\u6d6a\u535a\u5ba2\u6279\u91cf\u4e0b\u8f7d<\/a>\uff1a\u6279\u91cf\u4e0b\u8f7d\u65b0\u6d6a\u535a\u5ba2\u7684\u6587\u7ae0<\/p>\n<h6>\u5176\u6b21\uff0c\u5fae\u8c03\u540e\u7684\u4ee3\u7801\uff1a<\/h6>\n<pre class=\"lang:python decode:true\">#!\/usr\/bin\/env python\n# coding=utf-8\nimport urllib2\nimport sys, os\nimport re\nimport string\nfrom bs4 import BeautifulSoup\n\nreload(sys)\nsys.setdefaultencoding('utf8')\n\ndef encode(s):\n    return s.decode('utf-8').encode(sys.stdout.encoding, 'ignore')\n\ndef getHTML(url):\n    #proxy_handler = urllib2.ProxyHandler({'http':'http:\/\/211.138.124.211:80'})\n    #opener = urllib2.build_opener(proxy_handler)\n    #urllib2.install_opener(opener)\n    req = urllib2.Request(url)\n    response = urllib2.urlopen(req, timeout=15)\n    return BeautifulSoup(response)\n\ndef visible(element):\n    '''\u6293\u53d6\u53ef\u89c1\u7684\u6587\u672c\u5143\u7d20'''\n    if element.parent.name in ['style', 'script', '[document]', 'head', 'title']:\n        return False\n    elif re.match('&lt;!--.*--&gt;', str(element)):\n        return False\n    elif element == u'xa0':\n        return False\n    return True\n\ndef delReturn(element):\n    '''\u5220\u9664\u5143\u7d20\u5185\u7684\u6362\u884c'''\n    return re.sub('(?&lt;!^)\\n+(?!$)', ' ', str(element)).decode('utf-8')\n\ndef validFilename(filename):\n    '''Windows'''\n    return re.sub('[\\\/:*?&lt;&gt;\"|\\xa0]', '', filename)\n\ndef writeToFile(text, filename, dirname):\n    if not os.path.exists(dirname):\n        os.makedirs(dirname)\n        print encode('\u4fdd\u5b58\u5230\u76ee\u5f55'), dirname\n\n    filename = validFilename(filename)\n    print encode('\u4fdd\u5b58\u6587\u7ae0'), filename\n\n    path = os.path.join(dirname, filename)\n    if not os.path.exists(path):\n        f = open(path, 'w')\n        f.write(text)\n        f.close()\n    else:\n        print filename, encode('\u5df2\u7ecf\u5b58\u5728')\n\ndef formatContent(url, title=''):\n    '''\u683c\u5f0f\u5316\u6587\u7ae0\u5185\u5bb9'''\n    page = getHTML(url)\n    content = page.find('div', {'class':'articalContent'})\n    art_id = re.search('blog_(\\w+)\\.html', url).group(1)\n    blog_name = str(page.find('title')).split('_')[-2]\n\n    if title == '':\n        title = str(page.find('title')).split('_')[0][7:]\n\n    temp_data = filter(visible, content.findAll(text=True)) # \u53bb\u6389\u4e0d\u53ef\u89c1\u5143\u7d20\n    temp_data = ''.join(map(delReturn, temp_data)) # \u5220\u9664\u5143\u7d20\u5185\u7684\u6362\u884c\u7b26\n    temp_data = temp_data.strip() # \u5220\u9664\u6587\u7ae0\u9996\u5c3e\u7684\u7a7a\u884c\n    temp_data = re.sub('\\n{2,}', '\\n\\n', temp_data) # \u5220\u9664\u6587\u7ae0\u5185\u8fc7\u591a\u7684\u7a7a\u884c\n\n    # \u8f93\u51fa\u5230\u6587\u4ef6\n    # \u7f16\u7801\u95ee\u9898\n    temp_data = '\u672c\u6587\u5730\u5740:'.decode('utf-8') + url + '\\n\\n' + temp_data\n    op_text = temp_data.encode('utf-8')\n    op_file = title + '_' + art_id +'.txt'\n\n    writeToFile(op_text, op_file, blog_name)\n\ndef articlelist(url):\n    articles = {}\n    page = getHTML(url)\n    pages = page.find('ul', {'class':'SG_pages'}).span.string\n    page_num = int(re.search('(\\d+)', pages).group(1))\n\n    for i in range(1, page_num+1):\n        print encode('\u751f\u6210\u7b2c%d\u9875\u6587\u7ae0\u7d22\u5f15'%i)\n        if i != 1:\n            url = re.sub('(_)\\d+(\\.html)$', '\\g&lt;1&gt;'+str(i)+'\\g&lt;2&gt;', url)\n            page = getHTML(url)\n\n        article = page.findAll('span', {'class':'atc_title'})\n        for art in article:\n            art_title = art.a['title']\n            art_href = art.a['href']\n            articles[art_title] = art_href\n\n    return articles\n\ndef blog_dld(articles):\n    if not isinstance(articles, dict):\n        return False\n    print encode('\u5f00\u59cb\u4e0b\u8f7d\u6587\u7ae0')\n    for art_title, art_href in articles.items():\n        formatContent(art_href, art_title)\n\nif __name__ == '__main__':\n    sel = raw_input(encode('\u4f60\u8981\u4e0b\u8f7d\u7684\u662f(1)\u5168\u90e8\u6587\u7ae0\u8fd8\u662f(2)\u5355\u7bc7\u6587\u7ae0\uff0c\u8f93\u51651\u6216\u80052: '))\n\n    if sel == '1':\n        #articlelist_url = 'http:\/\/blog.sina.com.cn\/s\/articlelist_1303481411_0_1.html'\n        articlelist_url = raw_input(encode('\u8bf7\u8f93\u5165\u535a\u5ba2\u6587\u7ae0\u76ee\u5f55\u94fe\u63a5: '))\n        articles = articlelist(articlelist_url)\n        blog_dld(articles)\n    else:\n        #article_url = 'http:\/\/blog.sina.com.cn\/s\/blog_4db18c430100gxc5.html'\n        article_url = raw_input(encode('\u8bf7\u8f93\u5165\u535a\u5ba2\u6587\u7ae0\u94fe\u63a5: '))\n        formatContent(article_url)<\/pre>\n<h5>\u4ee5\u4e0b\u662f\u6211\u5f53\u65f6\u89e3\u51b3\u95ee\u9898\u7684\u8fc7\u7a0b\u8bb0\u5f55\uff1a<\/h5>\n<h6>\u7b2c\u4e00\u6b21\u62a5\u9519\uff1aImportError: No module named BeautifulSoup<\/h6>\n<p>\u56e0\u4e3a\u65b0\u7248\u672c\u7684BeautifulSoup\u5df2\u7ecf\u4e0d\u518d\u547d\u540d\u4e3aBeautifulSoup\u4e86\uff0c\u800c\u662fbs4\uff0c\u6240\u4ee5\u9700\u8981\u5148\u4e0b\u8f7d\u5b89\u88c5bs4\u6a21\u5757\uff0c\u7136\u540e\u5728\u4ee3\u7801\u4e2d\u5c06\u5bf9\u5e94\u7684import\u547d\u4ee4\u4fee\u6539\u4e3a\uff1afrom bs4 import BeautifulSoup<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u53c2\u8003\u6587\u7ae0\uff1a<\/strong><\/span><\/p>\n<ul>\n<li><a href=\"http:\/\/www.crummy.com\/software\/BeautifulSoup\/#Download\" target=\"_blank\">http:\/\/www.crummy.com\/software\/BeautifulSoup\/#Download<\/a><\/li>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/5663980\/importerror-no-module-named-beautifulsoup\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/5663980\/importerror-no-module-named-beautifulsoup<\/a><\/li>\n<\/ul>\n<h6>\u7b2c\u4e8c\u6b21\u62a5\u9519\uff1a<\/h6>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true\">&gt; python sinablog_download.py\n\u4f60\u8981\u4e0b\u8f7d\u7684\u662f(1)\u5168\u90e8\u6587\u7ae0\u8fd8\u662f(2)\u5355\u7bc7\u6587\u7ae0\uff0c\u8f93\u51651\u6216\u80052: 1\n\u8bf7\u8f93\u5165\u535a\u5ba2\u6587\u7ae0\u76ee\u5f55\u94fe\u63a5: http:\/\/blog.sina.com.cn\/s\/articlelist_1852149607_0_1.html\nTraceback (most recent call last):\n    File \"sinablog_download.py\", line 116, in &lt;module&gt;\n        articles = articlelist(articlelist_url)\n    File \"sinablog_download.py\", line 83, in articlelist\n        page = getHTML(url)\n    File \"sinablog_download.py\", line 19, in getHTML\n        return BeautifulSoup(response, convertEntities=BeautifulSoup.HTML_ENTITIES)\nAttributeError: type object 'BeautifulSoup' has no attribute 'HTML_ENTITIES'<\/pre>\n<p>\u641c\u7d22\u201cAttributeError: type object &#8216;BeautifulSoup&#8217; has no attribute &#8216;HTML_ENTITIES&#8217;\u201d\uff0c\u539f\u6765\u662f\u56e0\u4e3a\u201c<span style=\"color: #0000ff;\"><strong>BeautifulSoup\u6784\u9020\u51fd\u6570\u4e0d\u518d\u627f\u8ba4smartQuotesTo\u6216convertEntities\u7b49\u53c2\u6570\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u76f4\u63a5\u8f6c\u6362\u6210Unicode<\/strong><\/span>\u201d\uff0c\u6240\u4ee5\u5c06\u5bf9\u5e94\u4ee3\u7801\u5904\u4fee\u6539\u4e3a\uff1a<br \/>\nreturn BeautifulSoup(response)\uff0c\u5373\u76f4\u63a5\u53bb\u6389\u540e\u9762\u7684\u53c2\u6570\u3002<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u53c2\u8003\u6587\u7ae0\uff1a<\/strong><\/span><\/p>\n<ul>\n<li>&#8220;AttributeError: type object &#8216;BeautifulSoup&#8217; has no attribute &#8216;HTML_ENTITIES'&#8221;<\/li>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/11856011\/beautifulsoup-has-no-attribute-html-entities\" target=\"_blank\">http:\/\/stackoverflow.com\/questions\/11856011\/beautifulsoup-has-no-attribute-html-entities<\/a><\/li>\n<li><a href=\"http:\/\/www.crummy.com\/software\/BeautifulSoup\/bs4\/doc\/#entities\" target=\"_blank\">http:\/\/www.crummy.com\/software\/BeautifulSoup\/bs4\/doc\/#entities<\/a><\/li>\n<li><a href=\"http:\/\/www.crummy.com\/software\/BeautifulSoup\/bs4\/doc\/#output-formatters\" target=\"_blank\">http:\/\/www.crummy.com\/software\/BeautifulSoup\/bs4\/doc\/#output-formatters<\/a><\/li>\n<\/ul>\n<h6>\u7b2c\u4e09\u6b21\u62a5\u9519\uff1a<\/h6>\n<pre class=\"lang:default decode:true\">&gt; python sinablog_download.py\n\u4f60\u8981\u4e0b\u8f7d\u7684\u662f(1)\u5168\u90e8\u6587\u7ae0\u8fd8\u662f(2)\u5355\u7bc7\u6587\u7ae0\uff0c\u8f93\u51651\u6216\u80052: 1\n\u8bf7\u8f93\u5165\u535a\u5ba2\u6587\u7ae0\u76ee\u5f55\u94fe\u63a5: http:\/\/blog.sina.com.cn\/s\/articlelist_1852149607_0_1.html\nTraceback (most recent call last):\n    File \"sinablog_download.py\", line 116, in &lt;module&gt;\n        articles = articlelist(articlelist_url)\n    File \"sinablog_download.py\", line 84, in articlelist\n        pages = page.find('ul', {'class':'SG_pages'}).span.string\nAttributeError: 'NoneType' object has no attribute 'string'<\/pre>\n<p>\u8fd9\u91cc\u6ca1\u6709\u76f4\u63a5\u5728\u7f51\u4e0a\u627e\u5230\u5bf9\u5e94\u7684\u9519\u8bef\u8bf4\u660e\uff0c\u4f46\u662f\uff0c\u56e0\u4e3a\u8fd9\u4e00\u9519\u8bef\u5bf9\u5e94\u7684\u4ee3\u7801\u6d89\u53ca\u5230\u4e86\u5b57\u7b26\u4e32\u67e5\u627e\u547d\u4ee4\uff0c\u7136\u540e\u5176\u4e2d\u7684NoneType\u8fd9\u4e2a\u5173\u952e\u5b57\u4e5f\u6bd4\u8f83\u6613\u61c2\uff0c\u4e8e\u662f\u6211\u5c31\u53bb\u67e5\u770b\u7f51\u9875\u6e90\u4ee3\u7801\uff0c\u53d1\u73b0\u5728\u9875\u9762\u201chttp:\/\/blog.sina.com.cn\/s\/articlelist_1852149607_0_1.html\u201d\u7684\u6e90\u7801\u4e2d\u67e5\u627e\u201cSG_pages\u201d\u5173\u952e\u5b57\u65f6\uff0c\u90a3\u4e00\u6bb5\u5185\u5bb9\u4e3a\u7a7a\uff0c\u7136\u540e\u6211\u5c31\u61c2\u4e86\uff0c\u56e0\u4e3a\u6211\u9009\u7684\u535a\u6587\u76ee\u5f55\u4e2d\u53ea\u67094\u7bc7\u6587\u7ae0\uff0c\u6839\u672c\u5c31\u6ca1\u6709\u7ffb\u9875\u7684\u529f\u80fd\uff0c\u53ef\u80fd\u662f\u8fd9\u4e2a\u5730\u65b9\u9519\u4e86\u3002\u4e8e\u662f\u53bb\u7f51\u4e0a\u627e\u4e86\u4e2a\u6587\u7ae0\u591a\u7684\u65b0\u6d6a\u535a\u5ba2\uff0c\u7136\u540e\u67e5\u770b\u7f51\u9875\u6e90\u4ee3\u7801\uff0c\u8fd0\u884c\u4e86\u4e00\u4e0b\u679c\u7136\u8fd8\u662f\u53ef\u4ee5\u7684\u3002<br \/>\n\u5bf9\u6bd4\uff1a<\/p>\n<p>http:\/\/blog.sina.com.cn\/s\/articlelist_1852149607_0_1.html<\/p>\n<p>\u548c<\/p>\n<p>http:\/\/blog.sina.com.cn\/s\/articlelist_1494759712_0_1.html<\/p>\n<p>\u5728\u7f51\u9875\u6e90\u7801\u4e2d\u67e5\u627e\u201cSG_pages\u201d\u7136\u540e\u5c31\u53ef\u4ee5\u76f4\u89c2\u770b\u5230\u95ee\u9898\u6240\u5728\u3002<\/p>\n<h6>\u7b2c\u56db\u6b21\u62a5\u9519\uff1a<\/h6>\n<pre class=\"lang:default decode:true\">&gt; python sinablog_download.py\n\u4f60\u8981\u4e0b\u8f7d\u7684\u662f(1)\u5168\u90e8\u6587\u7ae0\u8fd8\u662f(2)\u5355\u7bc7\u6587\u7ae0\uff0c\u8f93\u51651\u6216\u80052: 1\n\u8bf7\u8f93\u5165\u535a\u5ba2\u6587\u7ae0\u76ee\u5f55\u94fe\u63a5: http:\/\/blog.sina.com.cn\/s\/articlelist_1494759712_0_1.html\n\u751f\u6210\u7b2c1\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c2\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c3\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c4\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c5\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c6\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c7\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c8\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c9\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c10\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c11\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c12\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c13\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c14\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c15\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c16\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c17\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c18\u9875\u6587\u7ae0\u7d22\u5f15\n\u751f\u6210\u7b2c19\u9875\u6587\u7ae0\u7d22\u5f15\n\u5f00\u59cb\u4e0b\u8f7d\u6587\u7ae0\nTraceback (most recent call last):\n    File \"sinablog_download.py\", line 117, in &lt;module&gt;\n        blog_dld(articles)\n    File \"sinablog_download.py\", line 108, in blog_dld\n        formatContent(art_href, art_title)\n    File \"sinablog_download.py\", line 67, in formatContent\n        temp_data = filter(visible, content.findAll(text=True)) # \u9358\u7ed8\u5e00\u6d93\u5d85\u5f72\u7459\u4f78\u5393\u7ef1?\n    File \"sinablog_download.py\", line 25, in visible\n        elif re.match('&lt;!--.*--&gt;', str(element)):\nUnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)<\/pre>\n<p>\u641c\u7d22\u9519\u8bef\u539f\u56e0\u201c<strong><span style=\"color: #ff0000;\">UnicodeEncodeError: &#8216;ascii&#8217; codec can&#8217;t encode characters in position 0-6: ordinal not in range(128)<\/span><\/strong>\u201d\uff0c\u53ef\u4ee5\u5f88\u76f4\u63a5\u7684\u627e\u5230\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<p>\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre class=\"lang:default decode:true\">import sys\nreload(sys)\nsys.setdefaultencoding('utf8')<\/pre>\n<p>\u7136\u540e\u5c31\u53ef\u4ee5\u6b63\u5e38\u6267\u884c\u4e86\u3002<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u53c2\u8003\u6587\u7ae0\uff1a<\/strong><\/span><\/p>\n<ul>\n<li><a href=\"http:\/\/blog.csdn.net\/hewy0526\/article\/details\/7687972\" target=\"_blank\">http:\/\/blog.csdn.net\/hewy0526\/article\/details\/7687972<\/a><\/li>\n<li><a href=\"http:\/\/shirley-ren.iteye.com\/blog\/1018750\" target=\"_blank\">http:\/\/shirley-ren.iteye.com\/blog\/1018750<\/a><\/li>\n<\/ul>\n<hr \/>\n<h6>\u5b8c\u6574\u6d4b\u8bd5\uff1a<\/h6>\n<pre class=\"lang:default decode:true\">&gt; python sinablog_download.py\n\u4f60\u8981\u4e0b\u8f7d\u7684\u662f(1)\u5168\u90e8\u6587\u7ae0\u8fd8\u662f(2)\u5355\u7bc7\u6587\u7ae0\uff0c\u8f93\u51651\u6216\u80052: 1\n\u8bf7\u8f93\u5165\u535a\u5ba2\u6587\u7ae0\u76ee\u5f55\u94fe\u63a5: http:\/\/blog.sina.com.cn\/s\/articlelist_1494759712_0_1.html\n\u751f\u6210\u7b2c1\u9875\u6587\u7ae0\u7d22\u5f15\n...\n\u5f00\u59cb\u4e0b\u8f7d\u6587\u7ae0\n\u4fdd\u5b58\u5230\u76ee\u5f55 \u6708\u5149\u535a\u5ba2\n\u4fdd\u5b58\u6587\u7ae0 \u7f51\u7edc\u5730\u56fe\u56fd\u5bb6\u961f\u201c\u5929\u5730\u56fe\u201d\u536b\u661f\u56fe\u7247\u7591\u4e0e\u8c37\u6b4c\u5730\u56fe\u540c\u6e90_591839200100n1zv.txt\n...<\/pre>\n<p>\u5bf9\u5355\u7bc7\u6587\u7ae0\u7684\u4e0b\u8f7d\u5c31\u5f88\u987a\u5229\u4e86{\u811a\u672c\u4f1a\u5206\u522b\u4e3a\u6bcf\u4e00\u4e2a\u535a\u5ba2\u4f5c\u8005\u65b0\u5efa\u4e00\u4e2a\u76ee\u5f55\uff0c\u7136\u540e\u5c06\u4e0b\u8f7d\u7684txt\u6587\u4ef6\u653e\u5728\u8be5\u76ee\u5f55\u4e2d}\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update @ 2015-6-14 \u5efa\u8bae\u6709\u6279\u91cf\u4e0b\u8f7d\u65b0\u6d6a\u535a\u5ba2\u6587\u7ae0\u9700\u6c42\u7684\u540c\u5b66\u4f7f\u7528\u00a0https:\/\/github. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,12],"tags":[60,8],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-programing","category-tools","tag-beautifulsoup","tag-python"],"views":4630,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=59"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/59\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}