{"id":193203,"date":"2020-11-15T05:14:00","date_gmt":"2020-11-14T21:14:00","guid":{"rendered":"http:\/\/4563.org\/?p=193203"},"modified":"2020-11-15T05:14:00","modified_gmt":"2020-11-14T21:14:00","slug":"%e5%b8%b8%e8%a7%81%e7%9a%84-python-%e7%88%ac%e8%99%ab%e6%9e%b6%e6%9e%84%e6%9c%89%e5%93%aa%e4%ba%9b","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=193203","title":{"rendered":"\u5e38\u89c1\u7684 Python \u722c\u866b\u67b6\u6784\u6709\u54ea\u4e9b?"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5e38\u89c1\u7684 Python \u722c\u866b\u67b6\u6784\u6709\u54ea\u4e9b?               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : fanqieip <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u76ee\u524d\u5b9e\u73b0\u722c\u866b\u6280\u672f\u7684\u7f16\u7a0b\u73af\u5883\u6709\u5f88\u591a\u79cd\uff0cJava \u3001Python \u3001C++\u7b49\u90fd\u53ef\u4ee5\u7528\u6765\u5199\u722c\u866b\u3002\u4f46\u5f88\u591a\u4eba\u9009\u62e9 Python \u6765\u5199\u722c\u866b\uff0c\u539f\u56e0\u662f Python \u786e\u5b9e\u5f88\u9002\u5408\u505a\u722c\u866b\uff0c\u4e30\u5bcc\u7684\u7b2c\u4e09\u65b9\u5e93\u5341\u5206\u5f3a\u5927\uff0c\u7b80\u5355\u51e0\u884c\u4ee3\u7801\u4fbf\u53ef\u5b9e\u73b0\u4f60\u60f3\u8981\u7684\u529f\u80fd\u3002\u66f4\u91cd\u8981\u7684\uff0cPython \u4e5f\u662f\u6570\u636e\u6316\u6398\u548c\u5206\u6790\u7684\u597d\u80fd\u624b\u3002\u90a3\u4e48\uff0c\u5e38\u89c1\u7684 Python \u722c\u866b\u67b6\u6784\u6709\u54ea\u4e9b\u5462?\u4eca\u5929\u756a\u8304\u52a0\u901f\u5c31\u6765\u8ddf\u5927\u5bb6\u804a\u4e00\u804a\u3002<\/p>\n<p>1 \u3001Scrapy<\/p>\n<p>Scrapy \u662f\u4e00\u4e2a\u4e3a\u4e86\u722c\u53d6\u7f51\u7ad9\u6570\u636e\uff0c\u63d0\u53d6\u7ed3\u6784\u6027\u6570\u636e\u800c\u7f16\u5199\u7684\u5e94\u7528\u6846\u67b6\u3002 \u53ef\u4ee5\u5e94\u7528\u5728\u5305\u62ec\u6570\u636e\u6316\u6398\uff0c\u4fe1\u606f\u5904\u7406\u6216\u5b58\u50a8\u5386\u53f2\u6570\u636e\u7b49\u4e00\u7cfb\u5217\u7684\u7a0b\u5e8f\u4e2d\u3002\u5b83\u662f\u5f88\u5f3a\u5927\u7684\u722c\u866b\u6846\u67b6\uff0c\u53ef\u4ee5\u6ee1\u8db3\u7b80\u5355\u7684\u9875\u9762\u722c\u53d6\uff0c\u6bd4\u5982\u53ef\u4ee5\u660e\u786e\u83b7\u77e5 url pattern \u7684\u60c5\u51b5\u3002\u7528\u8fd9\u4e2a\u6846\u67b6\u53ef\u4ee5\u8f7b\u677e\u722c\u4e0b\u6765\u5982\u4e9a\u9a6c\u900a\u5546\u54c1\u4fe1\u606f\u4e4b\u7c7b\u7684\u6570\u636e\u3002\u4f46\u662f\u5bf9\u4e8e\u7a0d\u5fae\u590d\u6742\u4e00\u70b9\u7684\u9875\u9762\uff0c\u5982 weibo \u7684\u9875\u9762\u4fe1\u606f\uff0c\u8fd9\u4e2a\u6846\u67b6\u5c31\u6ee1\u8db3\u4e0d\u4e86\u9700\u6c42\u4e86\u3002\u5b83\u7684\u7279\u6027\u6709\uff1aHTML, XML \u6e90\u6570\u636e \u9009\u62e9\u53ca\u63d0\u53d6 \u7684\u5185\u7f6e\u652f\u6301;\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u5728 spider \u4e4b\u95f4\u5171\u4eab\u7684\u53ef\u590d\u7528\u7684\u8fc7\u6ee4\u5668(\u5373 Item Loaders)\uff0c\u5bf9\u667a\u80fd\u5904\u7406\u722c\u53d6\u6570\u636e\u63d0\u4f9b\u4e86\u5185\u7f6e\u652f\u6301\u3002<\/p>\n<p>2 \u3001Beautiful Soup<\/p>\n<p>\u540d\u6c14\u5927\uff0c\u6574\u5408\u4e86\u4e00\u4e9b\u5e38\u7528\u722c\u866b\u9700\u6c42\u3002\u5b83\u662f\u4e00\u4e2a\u53ef\u4ee5\u4ece HTML \u6216 XML \u6587\u4ef6\u4e2d\u63d0\u53d6\u6570\u636e\u7684 Python \u5e93\u3002\u5b83\u80fd\u591f\u901a\u8fc7\u4f60\u559c\u6b22\u7684\u8f6c\u6362\u5668\u5b9e\u73b0\u60ef\u7528\u7684\u6587\u6863\u5bfc\u822a,\u67e5\u627e,\u4fee\u6539\u6587\u6863\u7684\u5f0f.Beautiful Soup \u4f1a\u5e2e\u4f60\u8282\u7701\u6570\u5c0f\u65f6\u751a\u81f3\u6570\u5929\u7684\u5de5\u4f5c\u65f6\u95f4\u3002Beautiful Soup \u7684\u7f3a\u70b9\u662f\u4e0d\u80fd\u52a0\u8f7d JS \u3002<\/p>\n<p>3 \u3001selenium<\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u8c03\u7528\u6d4f\u89c8\u5668\u7684 driver\uff0c\u901a\u8fc7\u8fd9\u4e2a\u5e93\u4f60\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528\u6d4f\u89c8\u5668\u5b8c\u6210\u67d0\u4e9b\u64cd\u4f5c\uff0c\u6bd4\u5982\u8f93\u5165\u9a8c\u8bc1\u7801\u3002Selenium \u662f\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\uff0c\u5b83\u652f\u6301\u5404\u79cd\u6d4f\u89c8\u5668\uff0c\u5305\u62ec Chrome\uff0cSafari\uff0cFirefox \u7b49\u4e3b\u6d41\u754c\u9762\u5f0f\u6d4f\u89c8\u5668\uff0c\u5982\u679c\u5728\u8fd9\u4e9b\u6d4f\u89c8\u5668\u91cc\u9762\u5b89\u88c5\u4e00\u4e2a Selenium \u7684\u63d2\u4ef6\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5b9e\u73b0 Web \u754c\u9762\u7684\u6d4b\u8bd5. Selenium \u652f\u6301\u6d4f\u89c8\u5668\u9a71\u52a8\u3002Selenium \u652f\u6301\u591a\u79cd\u8bed\u8a00\u5f00\u53d1\uff0c\u6bd4\u5982 Java\uff0cC\uff0cRuby \u7b49\u7b49\uff0cPhantomJS \u7528\u6765\u6e32\u67d3\u89e3\u6790 JS\uff0cSelenium \u7528\u6765\u9a71\u52a8\u4ee5\u53ca\u4e0e Python \u7684\u5bf9\u63a5\uff0cPython \u8fdb\u884c\u540e\u671f\u7684\u5904\u7406\u3002<\/p>\n<p>4 \u3001Portia<\/p>\n<p>\u662f\u4e00\u4e2a\u5f00\u6e90\u53ef\u89c6\u5316\u722c\u866b\u5de5\u5177\uff0c\u53ef\u8ba9\u4f7f\u7528\u8005\u5728\u4e0d\u9700\u8981\u4efb\u4f55\u7f16\u7a0b\u77e5\u8bc6\u7684\u60c5\u51b5\u4e0b\u722c\u53d6\u7f51\u7ad9!\u7b80\u5355\u5730\u6ce8\u91ca\u81ea\u5df1\u611f\u5174\u8da3\u7684\u9875\u9762\uff0cPortia \u5c06\u521b\u5efa\u4e00\u4e2a\u8718\u86db\u6765\u4ece\u7c7b\u4f3c\u7684\u9875\u9762\u63d0\u53d6\u6570\u636e\u3002\u7b80\u5355\u6765\u8bb2\uff0c\u5b83\u662f\u57fa\u4e8e scrapy \u5185\u6838;\u53ef\u89c6\u5316\u722c\u53d6\u5185\u5bb9\uff0c\u4e0d\u9700\u8981\u4efb\u4f55\u5f00\u53d1\u4e13\u4e1a\u77e5\u8bc6;\u52a8\u6001\u5339\u914d\u76f8\u540c\u6a21\u677f\u7684\u5185\u5bb9\u3002<\/p>\n<p>5 \u3001cola<\/p>\n<p>\u662f\u4e00\u4e2a\u5206\u5e03\u5f0f\u7684\u722c\u866b\u6846\u67b6\uff0c\u5bf9\u4e8e\u7528\u6237\u6765\u8bf4\uff0c\u53ea\u9700\u7f16\u5199\u51e0\u4e2a\u7279\u5b9a\u7684\u51fd\u6570\uff0c\u800c\u65e0\u9700\u5173\u6ce8\u5206\u5e03\u5f0f\u8fd0\u884c\u7684\u7ec6\u8282\u3002\u4efb\u52a1\u4f1a\u81ea\u52a8\u5206\u914d\u5230\u591a\u53f0\u673a\u5668\u4e0a\uff0c\u6574\u4e2a\u8fc7\u7a0b\u5bf9\u7528\u6237\u662f\u900f\u660e\u7684\u3002\u9879\u76ee\u6574\u4f53\u8bbe\u8ba1\u6709\u70b9\u7cdf\uff0c\u6a21\u5757\u95f4\u8026\u5408\u5ea6\u8f83\u9ad8\u3002<\/p>\n<p>6 \u3001PySpider<\/p>\n<p>\u4e00\u4e2a\u56fd\u4eba\u7f16\u5199\u7684\u5f3a\u5927\u7684\u7f51\u7edc\u722c\u866b\u7cfb\u7edf\u5e76\u5e26\u6709\u5f3a\u5927\u7684 WebUI \u3002\u91c7\u7528 Python \u8bed\u8a00\u7f16\u5199\uff0c\u5206\u5e03\u5f0f\u67b6\u6784\uff0c\u652f\u6301\u591a\u79cd\u6570\u636e\u5e93\u540e\u7aef\uff0c\u5f3a\u5927\u7684 WebUI \u652f\u6301\u811a\u672c\u7f16\u8f91\u5668\uff0c\u4efb\u52a1\u76d1\u89c6\u5668\uff0c\u9879\u76ee\u7ba1\u7406\u5668\u4ee5\u53ca\u7ed3\u679c\u67e5\u770b\u5668\u3002Python \u811a\u672c\u63a7\u5236\uff0c\u53ef\u4ee5\u7528\u4efb\u4f55\u4f60\u559c\u6b22\u7684 html \u89e3\u6790\u5305\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u516d\u79cd\u6bd4\u8f83\u5e38\u89c1\u7684 Python \u722c\u866b\u6846\u67b6\uff0c\u4f60\u76ee\u524d\u4f7f\u7528\u7684\u662f\u54ea\u4e00\u6b3e\u5462?<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>1<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4178360\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tikazyq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ca1\u4ec0\u4e48\u67b6\u6784\uff0c\u9762\u5411\u76d1\u72f1\u5c31\u5bf9\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5e38\u89c1\u7684 Python \u722c\u866b\u67b6\u6784\u6709\u54ea&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/193203"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=193203"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/193203\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=193203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=193203"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=193203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}