﻿{"id":505,"date":"2020-08-28T05:50:03","date_gmt":"2020-08-27T21:50:03","guid":{"rendered":"https:\/\/byy3.com\/?p=505"},"modified":"2021-01-09T10:14:01","modified_gmt":"2021-01-09T02:14:01","slug":"python%e7%88%ac%e8%99%ab%ef%bc%9a%e5%a6%82%e4%bd%95%e5%9c%a8%e4%b8%80%e4%b8%aa%e6%9c%88%e5%86%85%e5%ad%a6%e4%bc%9a%e7%88%ac%e5%8f%96%e5%a4%a7%e8%a7%84%e6%a8%a1%e6%95%b0%e6%8d%ae%ef%bc%9f%e6%96%b0","status":"publish","type":"post","link":"https:\/\/byy3.com\/?p=505","title":{"rendered":"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66"},"content":{"rendered":"<div class=\"col-2-article-header\">\n<div class=\"article-infos-wrap\">\n<div class=\"article-infos-extra\"><\/div>\n<\/div>\n<\/div>\n<div class=\"com-markdown-collpase\">\n<div class=\"com-markdown-collpase-main\">\n<div class=\"rno-markdown J-articleContent\">\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/us3uqoc9bz.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe\" \/><\/div>\n<p><strong>Python\u722c\u866b\u4e3a\u4ec0\u4e48\u53d7\u6b22\u8fce<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u4ed4\u7ec6\u89c2\u5bdf\uff0c\u5c31\u4e0d\u96be\u53d1\u73b0\uff0c\u61c2\u722c\u866b\u3001\u5b66\u4e60\u722c\u866b\u7684\u4eba\u8d8a\u6765\u8d8a\u591a\uff0c\u4e00\u65b9\u9762\uff0c\u4e92\u8054\u7f51\u53ef\u4ee5\u83b7\u53d6\u7684\u6570\u636e\u8d8a\u6765\u8d8a\u591a\uff0c\u53e6\u4e00\u65b9\u9762\uff0c\u50cf Python\u8fd9\u6837\u7684\u7f16\u7a0b\u8bed\u8a00\u63d0\u4f9b\u8d8a\u6765\u8d8a\u591a\u7684\u4f18\u79c0\u5de5\u5177\uff0c\u8ba9\u722c\u866b\u53d8\u5f97\u7b80\u5355\u3001\u5bb9\u6613\u4e0a\u624b\u3002<\/p>\n<p>\u5229\u7528\u722c\u866b\u6211\u4eec\u53ef\u4ee5\u83b7\u53d6\u5927\u91cf\u7684\u4ef7\u503c\u6570\u636e\uff0c\u4ece\u800c\u83b7\u5f97\u611f\u6027\u8ba4\u8bc6\u4e2d\u4e0d\u80fd\u5f97\u5230\u7684\u4fe1\u606f\uff0c<br \/>\n<strong>\u8fd9\u91cc\u8981\u6ce8\u610f<\/strong>\uff1a\u4e0d\u7ba1\u4f60\u662f\u4e3a\u4e86Python\u5c31\u4e1a\u8fd8\u662f\u5174\u8da3\u7231\u597d\uff0c\u8bb0\u4f4f\uff1a\u9879\u76ee\u5f00\u53d1\u7ecf\u9a8c\u6c38\u8fdc\u662f\u6838\u5fc3\uff0c\u5982\u679c\u4f60\u6ca1\u67092020\u6700\u65b0python\u5165\u95e8\u5230\u9ad8\u7ea7\u5b9e\u6218\u89c6\u9891\u6559\u7a0b\uff0c\u53ef\u4ee5\u53bb\u5c0f\u7f16\u7684Python\u4ea4\u6d41.\u88d9 \uff1a\u4e03\u8863\u8863\u4e5d\u4e03\u4e03\u5df4\u800c\u4e94\uff08\u6570\u5b57\u7684\u8c10\u97f3\uff09\u8f6c\u6362\u4e0b\u53ef\u4ee5\u627e\u5230\u4e86\uff0c\u91cc\u9762\u5f88\u591a\u65b0python\u6559\u7a0b\u9879\u76ee\uff0c\u8fd8\u53ef\u4ee5\u8ddf\u8001\u53f8\u673a\u4ea4\u6d41\u8ba8\u6559\uff01<\/p>\n<p>\u6bd4\u5982\uff1a<\/p>\n<blockquote><p><strong>\u77e5\u4e4e\uff1a<\/strong>\u722c\u53d6\u4f18\u8d28\u7b54\u6848\uff0c\u4e3a\u4f60\u7b5b\u9009\u51fa\u5404\u8bdd\u9898\u4e0b\u6700\u4f18\u8d28\u7684\u5185\u5bb9\u3002\u00a0<strong>\u6dd8\u5b9d\u3001\u4eac\u4e1c\uff1a<\/strong>\u6293\u53d6\u5546\u54c1\u3001\u8bc4\u8bba\u53ca\u9500\u91cf\u6570\u636e\uff0c\u5bf9\u5404\u79cd\u5546\u54c1\u53ca\u7528\u6237\u7684\u6d88\u8d39\u573a\u666f\u8fdb\u884c\u5206\u6790\u3002\u00a0<strong>\u5b89\u5c45\u5ba2\u3001\u94fe\u5bb6<\/strong>\uff1a\u6293\u53d6\u623f\u4ea7\u4e70\u5356\u53ca\u79df\u552e\u4fe1\u606f\uff0c\u5206\u6790\u623f\u4ef7\u53d8\u5316\u8d8b\u52bf\u3001\u505a\u4e0d\u540c\u533a\u57df\u7684\u623f\u4ef7\u5206\u6790\u3002\u00a0<strong>\u62c9\u52fe\u7f51\u3001\u667a\u8054\uff1a<\/strong>\u722c\u53d6\u5404\u7c7b\u804c\u4f4d\u4fe1\u606f\uff0c\u5206\u6790\u5404\u884c\u4e1a\u4eba\u624d\u9700\u6c42\u60c5\u51b5\u53ca\u85aa\u8d44\u6c34\u5e73\u3002\u00a0<strong>\u96ea\u7403\u7f51\uff1a<\/strong>\u6293\u53d6\u96ea\u7403\u9ad8\u56de\u62a5\u7528\u6237\u7684\u884c\u4e3a\uff0c\u5bf9\u80a1\u7968\u5e02\u573a\u8fdb\u884c\u5206\u6790\u548c\u9884\u6d4b\u3002<\/p><\/blockquote>\n<p><strong>\u722c\u866b\u662f\u5165\u95e8Python\u6700\u597d\u7684\u65b9\u5f0f\uff0c\u6ca1\u6709\u4e4b\u4e00\u3002<\/strong>Python\u6709\u5f88\u591a\u5e94\u7528\u7684\u65b9\u5411\uff0c\u6bd4\u5982\u540e\u53f0\u5f00\u53d1\u3001web\u5f00\u53d1\u3001\u79d1\u5b66\u8ba1\u7b97\u7b49\u7b49\uff0c\u4f46\u722c\u866b\u5bf9\u4e8e\u521d\u5b66\u8005\u800c\u8a00\u66f4\u53cb\u597d\uff0c\u539f\u7406\u7b80\u5355\uff0c\u51e0\u884c\u4ee3\u7801\u5c31\u80fd\u5b9e\u73b0\u57fa\u672c\u7684\u722c\u866b\uff0c\u5b66\u4e60\u7684\u8fc7\u7a0b\u66f4\u52a0\u5e73\u6ed1\uff0c\u4f60\u80fd\u4f53\u4f1a\u66f4\u5927\u7684\u6210\u5c31\u611f\u3002<\/p>\n<p>\u638c\u63e1\u57fa\u672c\u7684\u722c\u866b\u540e\uff0c\u4f60\u518d\u53bb\u5b66\u4e60Python\u6570\u636e\u5206\u6790\u3001web\u5f00\u53d1\u751a\u81f3\u673a\u5668\u5b66\u4e60\uff0c\u90fd\u4f1a\u66f4\u5f97\u5fc3\u5e94\u624b\u3002\u56e0\u4e3a\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0cPython\u57fa\u672c\u8bed\u6cd5\u3001\u5e93\u7684\u4f7f\u7528\uff0c\u4ee5\u53ca\u5982\u4f55\u67e5\u627e\u6587\u6863\u4f60\u90fd\u975e\u5e38\u719f\u6089\u4e86\u3002<\/p>\n<p>\u5bf9\u4e8e\u5c0f\u767d\u6765\u8bf4\uff0c\u722c\u866b\u53ef\u80fd\u662f\u4e00\u4ef6\u975e\u5e38\u590d\u6742\u3001\u6280\u672f\u95e8\u69db\u5f88\u9ad8\u7684\u4e8b\u60c5\u3002\u6bd4\u5982\u6709\u4eba\u8ba4\u4e3a\u5b66\u722c\u866b\u5fc5\u987b\u7cbe\u901a Python\uff0c\u7136\u540e<strong>\u54fc\u54e7\u54fc\u54e7\u7cfb\u7edf\u5b66\u4e60 Python \u7684\u6bcf\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5f88\u4e45\u4e4b\u540e\u53d1\u73b0\u4ecd\u7136\u722c\u4e0d\u4e86\u6570\u636e<\/strong>\uff1b\u6709\u7684\u4eba\u5219\u8ba4\u4e3a\u5148\u8981\u638c\u63e1\u7f51\u9875\u7684\u77e5\u8bc6\uff0c\u9042<strong>\u5f00\u59cb HTML\\CSS\uff0c\u7ed3\u679c\u5165\u4e86\u524d\u7aef\u7684\u5751<\/strong>\uff0c\u7601\u2026\u2026<\/p>\n<p>\u4f46\u638c\u63e1\u6b63\u786e\u7684\u65b9\u6cd5\uff0c\u5728\u77ed\u65f6\u95f4\u5185\u505a\u5230\u80fd\u591f\u722c\u53d6\u4e3b\u6d41\u7f51\u7ad9\u7684\u6570\u636e\uff0c\u5176\u5b9e\u975e\u5e38\u5bb9\u6613\u5b9e\u73b0\uff0c\u4f46\u5efa\u8bae\u4f60\u4ece<strong>\u4e00\u5f00\u59cb\u5c31\u8981\u6709\u4e00\u4e2a\u5177\u4f53\u7684\u76ee\u6807\u3002<\/strong><\/p>\n<p>\u5728\u76ee\u6807\u7684\u9a71\u52a8\u4e0b\uff0c\u4f60\u7684\u5b66\u4e60\u624d\u4f1a\u66f4\u52a0\u7cbe\u51c6\u548c\u9ad8\u6548\u3002<strong>\u90a3\u4e9b\u6240\u6709\u4f60\u8ba4\u4e3a\u5fc5\u987b\u7684\u524d\u7f6e\u77e5\u8bc6\uff0c\u90fd\u662f\u53ef\u4ee5\u5728\u5b8c\u6210\u76ee\u6807\u7684\u8fc7\u7a0b\u4e2d\u5b66\u5230\u7684\u3002<\/strong>\u8fd9\u91cc\u7ed9\u4f60\u4e00\u6761\u5e73\u6ed1\u7684\u3001\u96f6\u57fa\u7840\u5feb\u901f\u5165\u95e8\u7684\u5b66\u4e60\u8def\u5f84\u3002<\/p>\n<blockquote><p>1.\u5b66\u4e60 Python \u5305\u5e76\u5b9e\u73b0\u57fa\u672c\u7684\u722c\u866b\u8fc7\u7a0b 2.\u4e86\u89e3\u975e\u7ed3\u6784\u5316\u6570\u636e\u7684\u5b58\u50a8 3.\u5b66\u4e60scrapy\uff0c\u642d\u5efa\u5de5\u7a0b\u5316\u722c\u866b 4.\u5b66\u4e60\u6570\u636e\u5e93\u77e5\u8bc6\uff0c\u5e94\u5bf9\u5927\u89c4\u6a21\u6570\u636e\u5b58\u50a8\u4e0e\u63d0\u53d6 5.\u638c\u63e1\u5404\u79cd\u6280\u5de7\uff0c\u5e94\u5bf9\u7279\u6b8a\u7f51\u7ad9\u7684\u53cd\u722c\u63aa\u65bd 6.\u5206\u5e03\u5f0f\u722c\u866b\uff0c\u5b9e\u73b0\u5927\u89c4\u6a21\u5e76\u53d1\u91c7\u96c6\uff0c\u63d0\u5347\u6548\u7387<\/p><\/blockquote>\n<p>- \u2776 -<\/p>\n<p><strong>\u5b66\u4e60 Python \u5305\u5e76\u5b9e\u73b0\u57fa\u672c\u7684\u722c\u866b\u8fc7\u7a0b<\/strong><\/p>\n<p>\u5927\u90e8\u5206\u722c\u866b\u90fd\u662f\u6309<strong>\u201c\u53d1\u9001\u8bf7\u6c42\u2014\u2014\u83b7\u5f97\u9875\u9762\u2014\u2014\u89e3\u6790\u9875\u9762\u2014\u2014\u62bd\u53d6\u5e76\u50a8\u5b58\u5185\u5bb9\u201d<\/strong>\u8fd9\u6837\u7684\u6d41\u7a0b\u6765\u8fdb\u884c\uff0c\u8fd9\u5176\u5b9e\u4e5f\u662f\u6a21\u62df\u4e86\u6211\u4eec\u4f7f\u7528\u6d4f\u89c8\u5668\u83b7\u53d6\u7f51\u9875\u4fe1\u606f\u7684\u8fc7\u7a0b\u3002<\/p>\n<p>Python\u4e2d\u722c\u866b\u76f8\u5173\u7684\u5305\u5f88\u591a\uff1aurllib\u3001requests\u3001bs4\u3001scrapy\u3001pyspider \u7b49\uff0c<strong>\u5efa\u8bae\u4ecerequests+Xpath \u5f00\u59cb<\/strong>\uff0crequests \u8d1f\u8d23\u8fde\u63a5\u7f51\u7ad9\uff0c\u8fd4\u56de\u7f51\u9875\uff0cXpath \u7528\u4e8e\u89e3\u6790\u7f51\u9875\uff0c\u4fbf\u4e8e\u62bd\u53d6\u6570\u636e\u3002<\/p>\n<p>\u5982\u679c\u4f60\u7528\u8fc7 BeautifulSoup\uff0c\u4f1a\u53d1\u73b0 Xpath \u8981\u7701\u4e8b\u4e0d\u5c11\uff0c\u4e00\u5c42\u4e00\u5c42\u68c0\u67e5\u5143\u7d20\u4ee3\u7801\u7684\u5de5\u4f5c\uff0c\u5168\u90fd\u7701\u7565\u4e86\u3002\u8fd9\u6837\u4e0b\u6765\u57fa\u672c\u5957\u8def\u90fd\u5dee\u4e0d\u591a\uff0c<strong>\u4e00\u822c\u7684\u9759\u6001\u7f51\u7ad9\u6839\u672c\u4e0d\u5728\u8bdd\u4e0b\uff0c\u8c46\u74e3\u3001\u7cd7\u4e8b\u767e\u79d1\u3001\u817e\u8baf\u65b0\u95fb\u7b49\u57fa\u672c\u4e0a\u90fd\u53ef\u4ee5\u4e0a\u624b\u4e86<\/strong>\u3002<\/p>\n<p>\u5f53\u7136\u5982\u679c\u4f60\u9700\u8981\u722c\u53d6\u5f02\u6b65\u52a0\u8f7d\u7684\u7f51\u7ad9\uff0c\u53ef\u4ee5\u5b66\u4e60\u6d4f\u89c8\u5668<strong>\u6293\u5305\u5206\u6790\u771f\u5b9e\u8bf7\u6c42\u6216\u8005\u5b66\u4e60Selenium\u6765\u5b9e\u73b0\u81ea\u52a8\u5316\uff0c\u8fd9\u6837\uff0c\u77e5\u4e4e\u3001\u65f6\u5149\u7f51\u3001\u732b\u9014\u9e70\u8fd9\u4e9b\u52a8\u6001\u7684\u7f51\u7ad9\u4e5f\u53ef\u4ee5\u8fce\u5203\u800c\u89e3<\/strong>\u3002<\/p>\n<p>- \u2777 -<\/p>\n<p><strong>\u4e86\u89e3\u975e\u7ed3\u6784\u5316\u6570\u636e\u7684\u5b58\u50a8<\/strong><\/p>\n<p>\u722c\u56de\u6765\u7684\u6570\u636e\u53ef\u4ee5\u76f4\u63a5\u7528\u6587\u6863\u5f62\u5f0f\u5b58\u5728\u672c\u5730\uff0c\u4e5f\u53ef\u4ee5\u5b58\u5165\u6570\u636e\u5e93\u4e2d\u3002<\/p>\n<p>\u5f00\u59cb\u6570\u636e\u91cf\u4e0d\u5927\u7684\u65f6\u5019\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5<strong>\u901a\u8fc7 Python \u7684\u8bed\u6cd5\u6216 pandas \u7684\u65b9\u6cd5\u5c06\u6570\u636e\u5b58\u4e3acsv\u8fd9\u6837\u7684\u6587\u4ef6<\/strong>\u3002<\/p>\n<p>\u5f53\u7136\u4f60\u53ef\u80fd\u53d1\u73b0\u722c\u56de\u6765\u7684\u6570\u636e\u5e76\u4e0d\u662f\u5e72\u51c0\u7684\uff0c\u53ef\u80fd\u4f1a\u6709\u7f3a\u5931\u3001\u9519\u8bef\u7b49\u7b49\uff0c\u4f60\u8fd8\u9700\u8981\u5bf9\u6570\u636e\u8fdb\u884c\u6e05\u6d17\uff0c\u53ef\u4ee5<strong>\u5b66\u4e60 pandas \u5305\u7684\u57fa\u672c\u7528\u6cd5\u6765\u505a\u6570\u636e\u7684\u9884\u5904\u7406<\/strong>\uff0c\u5f97\u5230\u66f4\u5e72\u51c0\u7684\u6570\u636e\u3002<\/p>\n<p>- \u2778 -<\/p>\n<p><strong>\u5b66\u4e60 scrapy\uff0c\u642d\u5efa\u5de5\u7a0b\u5316\u7684\u722c\u866b<\/strong><\/p>\n<p>\u638c\u63e1\u524d\u9762\u7684\u6280\u672f\u4e00\u822c\u91cf\u7ea7\u7684\u6570\u636e\u548c\u4ee3\u7801\u57fa\u672c\u6ca1\u6709\u95ee\u9898\u4e86\uff0c\u4f46\u662f\u5728\u9047\u5230\u975e\u5e38\u590d\u6742\u7684\u60c5\u51b5\uff0c\u53ef\u80fd\u4ecd\u7136\u4f1a\u529b\u4e0d\u4ece\u5fc3\uff0c\u8fd9\u4e2a\u65f6\u5019\uff0c\u5f3a\u5927\u7684 scrapy \u6846\u67b6\u5c31\u975e\u5e38\u6709\u7528\u4e86\u3002<\/p>\n<p>scrapy \u662f\u4e00\u4e2a\u529f\u80fd\u975e\u5e38\u5f3a\u5927\u7684\u722c\u866b\u6846\u67b6\uff0c\u5b83\u4e0d\u4ec5\u80fd\u4fbf\u6377\u5730\u6784\u5efarequest\uff0c\u8fd8\u6709\u5f3a\u5927\u7684 selector \u80fd\u591f\u65b9\u4fbf\u5730\u89e3\u6790 response\uff0c\u7136\u800c\u5b83\u6700\u8ba9\u4eba\u60ca\u559c\u7684\u8fd8\u662f\u5b83\u8d85\u9ad8\u7684\u6027\u80fd\uff0c\u8ba9\u4f60\u53ef\u4ee5\u5c06\u722c\u866b\u5de5\u7a0b\u5316\u3001\u6a21\u5757\u5316\u3002<\/p>\n<p><strong>\u5b66\u4f1a scrapy\uff0c\u4f60\u53ef\u4ee5\u81ea\u5df1\u53bb\u642d\u5efa\u4e00\u4e9b\u722c\u866b\u6846\u67b6\uff0c\u4f60\u5c31\u57fa\u672c\u5177\u5907\u722c\u866b\u5de5\u7a0b\u5e08\u7684\u601d\u7ef4\u4e86\u3002<\/strong><\/p>\n<p>- \u2779 -<\/p>\n<p><strong>\u5b66\u4e60\u6570\u636e\u5e93\u57fa\u7840\uff0c\u5e94\u5bf9\u5927\u89c4\u6a21\u6570\u636e\u5b58\u50a8<\/strong><\/p>\n<p>\u722c\u56de\u6765\u7684\u6570\u636e\u91cf\u5c0f\u7684\u65f6\u5019\uff0c\u4f60\u53ef\u4ee5\u7528\u6587\u6863\u7684\u5f62\u5f0f\u6765\u5b58\u50a8\uff0c\u4e00\u65e6\u6570\u636e\u91cf\u5927\u4e86\uff0c\u8fd9\u5c31\u6709\u70b9\u884c\u4e0d\u901a\u4e86\u3002\u6240\u4ee5\u638c\u63e1\u4e00\u79cd\u6570\u636e\u5e93\u662f\u5fc5\u987b\u7684\uff0c\u5b66\u4e60\u76ee\u524d\u6bd4\u8f83\u4e3b\u6d41\u7684\u00a0<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.tencent.com\/product\/mongodb?from=10680\" target=\"_blank\" rel=\"noopener noreferrer\" data-text-link=\"28_1087487\" data-from=\"10680\" rel=\"nofollow\" >MongoDB<\/a>\u00a0\u5c31OK\u3002<\/p>\n<p><strong>MongoDB \u53ef\u4ee5\u65b9\u4fbf\u4f60\u53bb\u5b58\u50a8\u4e00\u4e9b\u975e\u7ed3\u6784\u5316\u7684\u6570\u636e\uff0c\u6bd4\u5982\u5404\u79cd\u8bc4\u8bba\u7684\u6587\u672c\uff0c\u56fe\u7247\u7684\u94fe\u63a5\u7b49\u7b49\u3002<\/strong>\u4f60\u4e5f\u53ef\u4ee5\u5229\u7528PyMongo\uff0c\u66f4\u65b9\u4fbf\u5730\u5728Python\u4e2d\u64cd\u4f5cMongoDB\u3002<\/p>\n<p>\u56e0\u4e3a\u8fd9\u91cc\u8981\u7528\u5230\u7684\u6570\u636e\u5e93\u77e5\u8bc6\u5176\u5b9e\u975e\u5e38\u7b80\u5355\uff0c\u4e3b\u8981\u662f<strong>\u6570\u636e\u5982\u4f55\u5165\u5e93\u3001\u5982\u4f55\u8fdb\u884c\u63d0\u53d6<\/strong>\uff0c\u5728\u9700\u8981\u7684\u65f6\u5019\u518d\u5b66\u4e60\u5c31\u884c\u3002<\/p>\n<p>- \u277a -<\/p>\n<p><strong>\u638c\u63e1\u5404\u79cd\u6280\u5de7\uff0c\u5e94\u5bf9\u7279\u6b8a\u7f51\u7ad9\u7684\u53cd\u722c\u63aa\u65bd<\/strong><\/p>\n<p>\u5f53\u7136\uff0c\u722c\u866b\u8fc7\u7a0b\u4e2d\u4e5f\u4f1a\u7ecf\u5386\u4e00\u4e9b\u7edd\u671b\u554a\uff0c\u6bd4\u5982\u88ab\u7f51\u7ad9\u5c01IP\u3001\u6bd4\u5982\u5404\u79cd\u5947\u602a\u7684\u9a8c\u8bc1\u7801\u3001userAgent\u8bbf\u95ee\u9650\u5236\u3001\u5404\u79cd\u52a8\u6001\u52a0\u8f7d\u7b49\u7b49\u3002<\/p>\n<p>\u9047\u5230\u8fd9\u4e9b\u53cd\u722c\u866b\u7684\u624b\u6bb5\uff0c\u5f53\u7136\u8fd8\u9700\u8981\u4e00\u4e9b\u9ad8\u7ea7\u7684\u6280\u5de7\u6765\u5e94\u5bf9\uff0c\u5e38\u89c4\u7684\u6bd4\u5982<strong>\u8bbf\u95ee\u9891\u7387\u63a7\u5236\u3001\u4f7f\u7528\u4ee3\u7406IP\u6c60\u3001\u6293\u5305\u3001\u9a8c\u8bc1\u7801\u7684OCR\u5904\u7406\u7b49\u7b49<\/strong>\u3002<\/p>\n<p>\u5f80\u5f80\u7f51\u7ad9\u5728\u9ad8\u6548\u5f00\u53d1\u548c\u53cd\u722c\u866b\u4e4b\u95f4\u4f1a\u504f\u5411\u524d\u8005\uff0c\u8fd9\u4e5f\u4e3a\u722c\u866b\u63d0\u4f9b\u4e86\u7a7a\u95f4\uff0c<strong>\u638c\u63e1\u8fd9\u4e9b\u5e94\u5bf9\u53cd\u722c\u866b\u7684\u6280\u5de7\uff0c\u7edd\u5927\u90e8\u5206\u7684\u7f51\u7ad9\u5df2\u7ecf\u96be\u4e0d\u5230\u4f60\u4e86<\/strong>\u3002<\/p>\n<p>- \u277b -<\/p>\n<p><strong>\u5206\u5e03\u5f0f\u722c\u866b\uff0c\u5b9e\u73b0\u5927\u89c4\u6a21\u5e76\u53d1\u91c7\u96c6<\/strong><\/p>\n<p>\u722c\u53d6\u57fa\u672c\u6570\u636e\u5df2\u7ecf\u4e0d\u662f\u95ee\u9898\u4e86\uff0c\u4f60\u7684\u74f6\u9888\u4f1a\u96c6\u4e2d\u5230\u722c\u53d6\u6d77\u91cf\u6570\u636e\u7684\u6548\u7387\u3002\u8fd9\u4e2a\u65f6\u5019\uff0c\u76f8\u4fe1\u4f60\u4f1a\u5f88\u81ea\u7136\u5730\u63a5\u89e6\u5230\u4e00\u4e2a\u5f88\u5389\u5bb3\u7684\u540d\u5b57\uff1a<strong>\u5206\u5e03\u5f0f\u722c\u866b<\/strong>\u3002<\/p>\n<p>\u5206\u5e03\u5f0f\u8fd9\u4e2a\u4e1c\u897f\uff0c\u542c\u8d77\u6765\u5f88\u6050\u6016\uff0c<strong>\u4f46\u5176\u5b9e\u5c31\u662f\u5229\u7528\u591a\u7ebf\u7a0b\u7684\u539f\u7406\u8ba9\u591a\u4e2a\u722c\u866b\u540c\u65f6\u5de5\u4f5c\uff0c\u9700\u8981\u4f60\u638c\u63e1 Scrapy + MongoDB +\u00a0<\/strong><a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/cloud.tencent.com\/product\/crs?from=10680\" target=\"_blank\" rel=\"noopener noreferrer\" data-text-link=\"27_1087487\" data-from=\"10680\" rel=\"nofollow\" ><strong>Redis<\/strong><\/a><strong>\u00a0\u8fd9\u4e09\u79cd\u5de5\u5177<\/strong>\u3002<\/p>\n<p>Scrapy \u524d\u9762\u6211\u4eec\u8bf4\u8fc7\u4e86\uff0c\u7528\u4e8e\u505a\u57fa\u672c\u7684\u9875\u9762\u722c\u53d6\uff0cMongoDB \u7528\u4e8e\u5b58\u50a8\u722c\u53d6\u7684\u6570\u636e\uff0cRedis \u5219\u7528\u6765\u5b58\u50a8\u8981\u722c\u53d6\u7684\u7f51\u9875\u961f\u5217\uff0c\u4e5f\u5c31\u662f\u4efb\u52a1\u961f\u5217\u3002<\/p>\n<p>\u6240\u4ee5\u6709\u4e9b\u4e1c\u897f\u770b\u8d77\u6765\u5f88\u5413\u4eba\uff0c\u4f46\u5176\u5b9e\u5206\u89e3\u5f00\u6765\uff0c\u4e5f\u4e0d\u8fc7\u5982\u6b64\u3002\u5f53\u4f60\u80fd\u591f\u5199\u5206\u5e03\u5f0f\u7684\u722c\u866b\u7684\u65f6\u5019\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u53bb\u5c1d\u8bd5\u6253\u9020\u4e00\u4e9b\u57fa\u672c\u7684\u722c\u866b\u67b6\u6784\u4e86\uff0c\u5b9e\u73b0\u4e00\u4e9b\u66f4\u52a0\u81ea\u52a8\u5316\u7684\u6570\u636e\u83b7\u53d6\u3002<\/p>\n<p>\u4f60\u770b\uff0c\u8fd9\u4e00\u6761\u5b66\u4e60\u8def\u5f84\u4e0b\u6765\uff0c\u4f60\u5df2\u7136\u53ef\u4ee5\u6210\u4e3a\u8001\u53f8\u673a\u4e86\uff0c\u975e\u5e38\u7684\u987a\u7545\u3002\u6240\u4ee5\u5728\u4e00\u5f00\u59cb\u7684\u65f6\u5019\uff0c<strong>\u5c3d\u91cf\u4e0d\u8981\u7cfb\u7edf\u5730\u53bb\u5543\u4e00\u4e9b\u4e1c\u897f\uff0c\u627e\u4e00\u4e2a\u5b9e\u9645\u7684\u9879\u76ee\uff08\u5f00\u59cb\u53ef\u4ee5\u4ece\u8c46\u74e3\u3001\u5c0f\u732a\u8fd9\u79cd\u7b80\u5355\u7684\u5165\u624b\uff09\uff0c\u76f4\u63a5\u5f00\u59cb\u5c31\u597d<\/strong>\u3002<\/p>\n<p>\u56e0\u4e3a\u722c\u866b\u8fd9\u79cd\u6280\u672f\uff0c\u65e2\u4e0d\u9700\u8981\u4f60\u7cfb\u7edf\u5730\u7cbe\u901a\u4e00\u95e8\u8bed\u8a00\uff0c\u4e5f\u4e0d\u9700\u8981\u591a\u4e48\u9ad8\u6df1\u7684\u6570\u636e\u5e93\u6280\u672f\uff0c<strong>\u9ad8\u6548\u7684\u59ff\u52bf\u5c31\u662f\u4ece\u5b9e\u9645\u7684\u9879\u76ee\u4e2d\u53bb\u5b66\u4e60\u8fd9\u4e9b\u96f6\u6563\u7684\u77e5\u8bc6\u70b9\uff0c\u4f60\u80fd\u4fdd\u8bc1\u6bcf\u6b21\u5b66\u5230\u7684\u90fd\u662f\u6700\u9700\u8981\u7684\u90a3\u90e8\u5206\u3002<\/strong><\/p>\n<p>\u5f53\u7136\u552f\u4e00\u9ebb\u70e6\u7684\u662f\uff0c\u5728\u5177\u4f53\u7684\u95ee\u9898\u4e2d\uff0c\u5982\u4f55\u627e\u5230\u5177\u4f53\u9700\u8981\u7684\u90a3\u90e8\u5206\u5b66\u4e60\u8d44\u6e90\u3001\u5982\u4f55\u7b5b\u9009\u548c\u7504\u522b\uff0c\u662f\u5f88\u591a\u521d\u5b66\u8005\u9762\u4e34\u7684\u4e00\u4e2a\u5927\u95ee\u9898\u3002<\/p>\n<p>\u4e0d\u8fc7\u4e0d\u7528\u62c5\u5fc3\uff0c\u6211\u4eec\u51c6\u5907\u4e86\u4e00\u95e8\u975e\u5e38\u7cfb\u7edf\u7684\u722c\u866b\u8bfe\u7a0b\uff0c\u9664\u4e86\u4e3a\u4f60\u63d0\u4f9b\u4e00\u6761\u6e05\u6670\u7684\u5b66\u4e60\u8def\u5f84\uff0c\u6211\u4eec\u7504\u9009\u4e86<strong>\u6700\u5b9e\u7528\u7684\u5b66\u4e60\u8d44\u6e90<\/strong>\u4ee5\u53ca<strong>\u5e9e\u5927\u7684\u4e3b\u6d41\u722c\u866b\u6848\u4f8b\u5e93<\/strong>\u3002\u77ed\u65f6\u95f4\u7684\u5b66\u4e60\uff0c\u4f60\u5c31\u80fd\u591f\u5f88\u597d\u5730\u638c\u63e1\u722c\u866b\u8fd9\u4e2a\u6280\u80fd\uff0c\u83b7\u53d6\u4f60\u60f3\u5f97\u5230\u7684\u6570\u636e\u3002<\/p>\n<p>\u7ecf\u8fc7\u77ed\u65f6\u95f4\u7684\u5b66\u4e60\uff0c\u4e0d\u5c11\u540c\u5b66\u90fd\u53d6\u5f97\u4e86\u4ece0\u52301\u7684\u8fdb\u6b65\uff0c\u80fd\u591f\u5199\u51fa\u81ea\u5df1\u7684\u722c\u866b\uff0c\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\u3002\u4e0b\u9762\u662f\u51e0\u4f4d\u540c\u5b66\u7684<strong>\u4f5c\u4e1a\u5408\u96c6\u5206\u4eab<\/strong>\uff1a<\/p>\n<p>\u722cLOL\u82f1\u96c4\u76ae\u80a4\u9ad8\u6e05\u56fe\u7247<\/p>\n<p>@\u6c89\u9ed8\u5c0f\u718a\u732b<\/p>\n<p>\u722c\u53d6\u4e86\u5f53\u524d\u6bd4\u8f83\u706b\u7684\u6e38\u620f\u58c1\u7eb8\uff0cMOBA\u6e38\u620f\u300a\u82f1\u96c4\u8054\u76df\u300b\uff0c\u624b\u6e38\u300a\u738b\u8005\u8363\u8000\u300b\u3001\u300a\u9634\u9633\u5e08\u300b\uff0cFPS\u6e38\u620f\u300a\u7edd\u5730\u6c42\u751f\u300b\uff0c\u5176\u4e2d\u300a\u82f1\u96c4\u8054\u76df\u300b\u7684\u58c1\u7eb8\u6700\u96be\u722c\u53d6\uff0c\u8fd9\u91cc\u5c55\u793a\u722c\u53d6\u300a\u82f1\u96c4\u8054\u76df\u300b\u5168\u90e8\u82f1\u96c4\u58c1\u7eb8\u7684\u8fc7\u7a0b\u3002<\/p>\n<p>\u5148\u770b\u4e00\u4e0b\u6700\u7ec8\u722c\u53d6\u7684\u6548\u679c\uff0c\u6bcf\u4e2a\u82f1\u96c4\u7684\u58c1\u7eb8\u90fd\u88ab\u722c\u53d6\u4e0b\u6765\u4e86\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/c7dslg8bic.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe1\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe1\" \/><\/div>\n<p>139\u4e2a\u82f1\u96c4\u58c1\u7eb8\u6587\u4ef6\u5939<\/p>\n<p>\u201c\u9ed1\u6697\u4e4b\u5973 \u5b89\u59ae\u201d\u768412\u5f20\u58c1\u7eb8\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/j6ulrqgygm.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe2\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe2\" \/><\/div>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/w4go5ts3v7.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe3\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe3\" \/><\/div>\n<p>\u5c0f\u7ea2\u5e3d \u5b89\u59ae \u9ad8\u6e05\u5927\u56fe<\/p>\n<p>1.\u722c\u866b\u6d41\u7a0b\u56fe<\/p>\n<p>\u81f3\u6b64\u5bf9\u6211\u8981\u722c\u53d6\u7684\u5bf9\u8c61\u5df2\u7ecf\u6709\u4e86\u4e00\u5b9a\u7684\u4e86\u89e3\uff0c\u5bf9\u4e8e\u5177\u4f53\u722c\u53d6\u65b9\u6cd5\u4e5f\u6709\u4e86\u60f3\u6cd5\uff0c\u53ef\u4ee5\u8bbe\u8ba1\u5982\u4e0b\u722c\u866b\u6d41\u7a0b\u56fe\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/rp23umye04.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe4\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe4\" \/><\/div>\n<p>2.\u8bbe\u8ba1\u4ee3\u7801\u6574\u4f53\u6846\u67b6<\/p>\n<p>\u6839\u636e\u722c\u866b\u6d41\u7a0b\u56fe\uff0c\u6211\u8bbe\u8ba1\u4e86\u5982\u4e0b\u4ee3\u7801\u6846\u67b6\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/vu8t36qz2b.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe5\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe5\" \/><\/div>\n<p>\u8fd9\u4e2a\u4ee3\u7801\u6846\u67b6\u975e\u5e38\u5bb9\u6613\u8bfb\u61c2\uff0c\u4e3b\u8981\u5c31\u662frun()\u51fd\u6570\uff0crun()\u51fd\u6570\u5b8c\u6210\u4e86\u8fd9\u6837\u4e00\u5957\u5de5\u4f5c\uff1a\u521b\u5efaLOL\u6587\u4ef6\u5939\u2014\u2014\u83b7\u5f97\u952e\u76d8\u8f93\u5165\u7684\u4fe1\u606f\u2014\u2014\u82e5\u4fe1\u606f\u4e3a\u201cAll\u201d\u5219\u722c\u53d6\u5168\u90e8\u82f1\u96c4\u58c1\u7eb8\uff0c\u5426\u5219\u722c\u53d6\u5355\u4e2a\u82f1\u96c4\u58c1\u7eb8\u3002<\/p>\n<p>3.\u722c\u53d6\u6240\u6709\u82f1\u96c4\u4fe1\u606f<\/p>\n<p>\u9996\u5148\u6211\u4eec\u8981\u89e3\u6790champion.js\u6587\u4ef6\uff0c\u5f97\u5230\u82f1\u96c4\u82f1\u6587\u540d\u4e0eid\u7684\u4e00\u4e00\u5bf9\u5e94\u5173\u7cfb\u3002<\/p>\n<p>\u5bf9\u4e8e\u5b98\u7f51\u7f51\u7ad9\u4e0a\u7684\u6240\u6709\u82f1\u96c4\u4fe1\u606f\u9875\u9762\uff0c\u7531\u4e8e\u662f\u7528 JavaScript \u52a0\u8f7d\u51fa\u6765\u7684\uff0c\u666e\u901a\u65b9\u6cd5\u5e76\u4e0d\u597d\u722c\u53d6\uff0c\u6211\u4f7f\u7528\u4e86 Selenium+PhantomJS \u7684\u65b9\u6cd5\u6765\u52a8\u6001\u52a0\u8f7d\u82f1\u96c4\u4fe1\u606f\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/hrypcu0znu.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe6\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe6\" \/><\/div>\n<p>\u89e3\u6790\u7684\u82f1\u96c4\u4fe1\u606f<\/p>\n<p>4.\u722c\u53d6\u82f1\u96c4\u58c1\u7eb8<\/p>\n<p>\u5f97\u5230\u6bcf\u4e00\u4e2a\u82f1\u96c4\u7684\u4fe1\u606f\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5f00\u59cb\u6109\u5feb\u7684\u722c\u53d6\u5b83\u4eec\u7684\u58c1\u7eb8\u5566~\u5b9a\u4e49get_image(heroid,heroframe) \u51fd\u6570\uff0c\u7528\u4e8e\u722c\u53d6\u5355\u4e2a\u82f1\u96c4\u7684\u5168\u90e8\u58c1\u7eb8\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/nlmvba507k.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe7\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe7\" \/><\/div>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/ui5i8as5r3.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe8\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe8\" \/><\/div>\n<p>\u8fd0\u884c\u4ee3\u7801\u65f6\u6ce8\u610f\u4fdd\u6301\u7f51\u7edc\u7545\u901a\uff0c\u5982\u679c\u7f51\u901f\u592a\u6162\u53ef\u80fd\u4f1a\u722c\u53d6\u5931\u8d25\u3002\u57283\u5146\u6709\u7ebf\u7f51\u7684\u7f51\u901f\u4e0b\u722c\u53d6\u5168\u90e8139\u4e2a\u82f1\u96c4\u7684\u5168\u90e8\u9ad8\u6e05\u58c1\u7eb8\uff08\u7ea6\u4e00\u5343\u5f20\u56fe\uff09\u5927\u6982\u89813-4\u5206\u949f\u3002<\/p>\n<p>\u300a\u738b\u8005\u8363\u8000\u300b\u3001\u300a\u9634\u9633\u5e08\u300b\u3001\u300a\u7edd\u5730\u6c42\u751f\u300b\u7b49\u5176\u4ed6\u6e38\u620f\u7684\u58c1\u7eb8\u4e5f\u662f\u540c\u6837\u9053\u7406\u5c31\u53ef\u4ee5\u722c\u53d6\u4e86\uff0c\u636e\u6211\u5b9e\u8df5\uff0c\u300a\u82f1\u96c4\u8054\u76df\u300b\u7684\u722c\u53d6\u96be\u5ea6\u662f\u6700\u9ad8\u7684\uff0c\u56e0\u6b64\u5c06\u4e0a\u8ff0\u8fc7\u7a0b\u5f04\u61c2\u4e86\uff0c\u81ea\u5df1\u518d\u7f16\u5199\u4ee3\u7801\u722c\u5176\u4ed6\u6e38\u620f\u5c31\u6613\u5982\u53cd\u638c\u4e86\u3002<\/p>\n<p>\u5361\u7247\u91cc\u9762\u5185\u5bb9\u53ef\u4ee5\u6ed1\u52a8<\/p>\n<p>\u7f8e\u56e2\u7f51\u9910\u996e\u5546\u5bb6\u7684\u4fe1\u606f\u722c\u53d6<\/p>\n<p>@Chenchen<\/p>\n<p>\u672c\u6b21\u5bf9\u3010\u5e38\u5dde\u7f8e\u98df\u3011\u5168\u90e8\u7f8e\u98df\u63a8\u8350 \u8fdb\u884c\u4e00\u6b21\u722c\u866b\u5b9e\u8df5\uff0c\u4e3b\u8981\u60f3\u722c\u53d6\u7684\u4fe1\u606f\u6709\uff1a\u9910\u5385\u7684\u540d\u79f0\u3001\u9910\u5385\u7684\u8bc4\u5206\u3001\u9910\u5385\u8bc4\u8bba\u6570\u3001\u9910\u5385\u7684\u5730\u5740\u3001\u4eba\u5747\u6d88\u8d39\u4ef7\u683c\u2026\u2026<\/p>\n<p>\u6700\u7ec8\u722c\u4e0b\u6765\u7684\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u5982\u4e0b\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/3qyuctxxhp.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe9\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe9\" \/><\/div>\n<p>\u7f8e\u56e2\u4f7f\u7528\u4e86\u53cd\u722c\u866b\u673a\u5236\uff0c\u8981\u6a21\u62df\u6d4f\u89c8\u5668\u6765\u8fdb\u884c\u722c\u53d6\u3002\u7ecf\u8fc7\u51e0\u6b21\u5c1d\u8bd5\uff0c\u53d1\u73b0\u53ea\u5bf9 Cookie \u548c User-Agent \u8fdb\u884c\u6821\u9a8c\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/ytiby0iv6q.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe10\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe10\" \/><\/div>\n<p>\u722c\u5230\u7b2c\u4e00\u7ec4\u6570\u636e<\/p>\n<p>\u722c\u5230\u7b2c\u4e00\u7ec4\u6570\u636e\u4e4b\u540e\uff0c\u63a5\u7740\u5c31\u662f\u60f3\u7ffb\u9875\u7684\u4e8b\u60c5\u3002\u7ffb\u9875\u7279\u522b\u7b80\u5355\uff0c\u4e8e\u662f\u53c8\u722c\u53d6\u4e86\u5546\u5bb6\u7535\u8bdd\u3001\u8425\u4e1a\u65f6\u95f4\u7b49\u4fe1\u606f\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/hdrydtr3hk.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe11\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe11\" \/><\/div>\n<p>\u6253\u5305\u5199\u4e2a\u51fd\u6570<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/upbmw3x8yk.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe12\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe12\" \/><\/div>\n<p>\u6210\u529f\u5730\u722c\u5230\u4e86\u76f8\u5e94\u7684\u4fe1\u606f<\/p>\n<p>\u4f46\u597d\u666f\u4e0d\u957f\uff0c\u722c\u5230\u4e00\u534a\u7684\u65f6\u5019\u88ab403\u4e86\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/x2lelwqoom.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe13\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe13\" \/><\/div>\n<p>\u56e0\u4e3a\u88ab\u5c01\u4e86\uff0c\u6211\u4eec\u53ea\u80fd\u7528\u65e0\u75d5\u65b9\u5f0f\u6765\u8bbf\u95ee\u4e86?\u3002\u770b\u4e86\u4e0b\uff0c\u51b3\u5b9a\u91c7\u7528\u591a\u4e2a Cookie \u7136\u540e\u968f\u673a\u8c03\u7528\u7684\u65b9\u5f0f\u6765\u907f\u514d\u88ab\u5c01\u4e86\u3002\u6700\u7ec8\u4f7f\u7528\u4e8617\u4e2acookie\uff0c\u7ecf\u8fc7\u6d4b\u8bd5\uff0c\u53ef\u4ee5\u9ad8\u901f\u722c\u53d6\u4e0d\u88ab\u5c01\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/cgya5lfjd5.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe14\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe14\" \/><\/div>\n<p>\u8fd9\u6b21\u7684\u722c\u53d6\u5728\u8fd9\u91cc\u7ed3\u675f\u4e86\uff0c\u4f46\u662f\u722c\u56de\u6765\u7684\u6570\u636e\u53ef\u4ee5\u505a\u5f88\u591a\u5206\u6790\uff0c\u6bd4\u5982\u5728\u4e0d\u540c\u7684\u5730\u6bb5\u5916\u5356\u7684\u60c5\u51b5\uff0c\u5546\u5bb6\u7684\u5206\u5e03\u7b49\u7b49\u3002<\/p>\n<p>\u722c\u5f53\u5f53\u7f51\u5404\u5206\u7c7b\u6240\u6709\u4e94\u661f\u56fe\u4e66<\/p>\n<p>@ZhuNewNew<\/p>\n<p>\u8fd9\u6b21\u4f5c\u4e1a\u9009\u62e9\u722c\u53d6\u7684\u7f51\u7ad9\u662f\u5f53\u5f53\u7f51\uff0c\u5f53\u5f53\u6709\u6bd4\u8f83\u591a\u7684\u56fe\u4e66\u6570\u636e\uff0c\u7279\u522b\u662f\u4e94\u661f\u56fe\u4e66\uff0c\u5305\u542b\u4e86\u5404\u4e2a\u9886\u57df\u6700\u53d7\u6b22\u8fce\u7684\u56fe\u4e66\u4fe1\u606f\uff0c\u5bf9\u4e8e\u5bfb\u627e\u6709\u4ef7\u503c\u7684\u56fe\u4e66\u3001\u5206\u6790\u597d\u4e66\u7684\u9500\u552e\u60c5\u51b5\u5177\u6709\u4e00\u5b9a\u7684\u4ef7\u503c\u3002<\/p>\n<p>\u6700\u7ec8\u722c\u53d6\u7684\u6570\u636e\u5982\u4e0b\uff0c\u603b\u517110000+\u884c\u6570\u636e\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/8ewafz82nx.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe15\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe15\" \/><\/div>\n<p>\u6211\u60f3\u722c\u53d6\u7684\u6570\u636e\u662f\u5404\u5206\u7c7b\uff08\u5c0f\u8bf4\u3001\u4e2d\u5c0f\u5b66\u6559\u8f85\u3001\u6587\u5b66\u3001\u6210\u529f\/\u52b1\u5fd7\u2026\u2026\uff09\u4e0b\u9762\u7684\u4e94\u661f\u56fe\u4e66\u4fe1\u606f\uff08\u4e66\u540d\u3001\u8bc4\u8bba\u6570\u3001\u4f5c\u8005\u3001\u51fa\u7248\u793e\u3001\u51fa\u7248\u65f6\u95f4\u3001\u4e94\u661f\u8bc4\u5206\u6b21\u6570\u3001\u4ef7\u683c\u3001\u7535\u5b50\u4e66\u4ef7\u683c\u7b49\u7b49\uff09\u3002<\/p>\n<p>\u4e3a\u4e86\u6293\u5404\u5206\u7c7b\u4e0b\u7684\u56fe\u4e66\u4fe1\u606f\uff0c\u9996\u5148\u770b\u770b\u70b9\u51fb\u5404\u5206\u7c7b\u7684\u65f6\u5019\uff0c\u94fe\u63a5\u662f\u5426\u53d1\u751f\u53d8\u5316\u3002\u7ecf\u8fc7\u6d4b\u8bd5\uff0c\u5728\u4e0d\u540c\u7684\u5206\u7c7b\uff0c\u94fe\u63a5\u90fd\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u4e8b\u5b9e\u8bc1\u660e\u4e0d\u662fJS\u52a0\u8f7d\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/ulxqjaoxoh.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe16\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe16\" \/><\/div>\n<p>\u6253\u5370\u4e4b\u540e\u6b63\u5e38\u8fd4\u56de\u6570\u636e<\/p>\n<p>\u5230\u8fd9\u91cc\u57fa\u672c\u53ef\u4ee5\u77e5\u9053\uff0c\u5f53\u5f53\u7f51\u7684\u53cd\u722c\u786e\u5b9e\u4e0d\u4e25\u683c\uff0c\u6211\u751a\u81f3\u8fd8\u6ca1\u6709\u8bbe\u7f6eHeaders\u7684\u4fe1\u606f\uff0c\u7adf\u7136\u4e5f\u53ef\u4ee5\u722c\u53d6\u5230\u60f3\u8981\u7684\u6570\u636e\u3002\u4f46\u6700\u540e\u5728\u5b8c\u6574\u7684\u4ee3\u7801\u4e2d\uff0c\u8fd8\u662f\u628aheaders\u52a0\u4e0a\u4e86\uff0c\u4fdd\u9669\u8d77\u89c1\u5427\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u5c31\u662f\u5206\u522b\u722c\u53d6\u6bcf\u4e2a\u5206\u7c7b\u4e0b\u7684\u56fe\u4e66\u4fe1\u606f\uff0c\u4ee5\u201c\u5c0f\u8bf4\u201d\u4e3a\u4f8b\uff0c\u5176\u5b9e\u7ffb\u9875\u7279\u522b\u7b80\u5355\uff0c\u7ed9\u51e0\u4e2a\u6bd4\u8f83\u5982\u4e0b\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/93unm6b5ze.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe17\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe17\" \/><\/div>\n<p>\u7ffb\u9875\u4e5f\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u4e0d\u8fc7\u6709\u4e00\u70b9\u70b9\u5751\u7684\u662f\uff0c\u722c\u56de\u6765\u7684\u94fe\u63a5\u5728\u4ee3\u7801\u4e2d\uff0c\u9700\u8981\u5bf9\u5176\u7ffb\u9875\uff0c\u5c31\u9700\u8981\u628a\u94fe\u63a5\u6784\u9020\u51fa\u6765\u3002\u5bf9\u8fd4\u56de\u6765\u7684\u94fe\u63a5\u8fdb\u884c\u5206\u6790\uff0c\u53d1\u73b0\u4ec5\u4ec5\u662f\u4e2d\u95f4\u6709\u56db\u4e2a\u6570\u5b57\u4e0d\u4e00\u6837\u3002\u4e8e\u662f\u6211\u628a\u8fd9\u51e0\u4e2a\u6570\u636e\u53d6\u51fa\u6765\uff0c\u5728\u8fde\u63a5\u4e2d\u4f20\u8fdb\u53bb\uff0c\u8fd9\u6837\u53ef\u4ee5\u6784\u9020\u901a\u7528\u7684\u94fe\u63a5\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/em7ht47nyq.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe18\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe18\" \/><\/div>\n<p>\u6784\u9020\u7684\u7ffb\u9875\u94fe\u63a5<\/p>\n<p>\u63a5\u4e0b\u6765\u5c31\u662f\u53bb\u6293\u53d6\u4e0d\u540c\u9875\u9762\u7684\u4fe1\u606f\uff0c\u6ca1\u6709\u5f02\u6b65\u52a0\u8f7d\uff0c\u6240\u4ee5\u76f4\u63a5\u7528xpath\u5b9a\u4f4d\u5c31OK\u3002\u5f53\u7136\u4e2d\u95f4\u6709\u4e00\u4e9b\u5c0f\u5730\u65b9\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6bcf\u672c\u4e66\u6240\u5305\u542b\u7684\u4fe1\u606f\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u6240\u4ee5\u7528xpath\u53bb\u83b7\u53d6\u7684\u65f6\u5019\u4e0d\u4e00\u5b9a\u80fd\u83b7\u53d6\u5230\uff0c\u5c31\u4f1a\u51fa\u9519\u3002\u4e8e\u662f\u7528\u5230try\u2026\u2026except\u8bed\u53e5\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/b6yh3kt2q1.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe19\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe19\" \/><\/div>\n<p>\u6700\u540e\u603b\u5171\u722c\u523010000\u591a\u884c\u6570\u636e\uff0c\u5bf9\u5e94\u4e0d\u540c\u9886\u57df\u768410000\u591a\u672c\u9ad8\u8bc4\u5206\u7684\u4e66\u7c4d\uff0c\u5f53\u7136\u4f1a\u6709\u4e00\u4e9b\u91cd\u590d\u8ba1\u7b97\uff0c\u6bd4\u5982\u5c0f\u8bf4\u548c\u6587\u5b66\uff0c\u5c31\u6709\u4e0d\u5c11\u4e66\u662f\u540c\u65f6\u5728\u8fd9\u4e24\u4e2a\u7c7b\u76ee\u7684\u3002<\/p>\n<p>\u5f53\u5f53\u7f51\u672c\u8eab\u6ca1\u6709\u4ec0\u4e48\u53cd\u722c\u673a\u5236\uff0c\u6240\u4ee5\u722c\u53d6\u4e5f\u6bd4\u8f83\u987a\u5229\u3002\u552f\u4e00\u7684\u5c0f\u9ebb\u70e6\u5c31\u662f\u6293\u56de\u6765\u7684\u94fe\u63a5\u7ee7\u7eed\u7ffb\u9875\u548c\u5176\u4e2d\u4e00\u4e9b\u4e66\u7c4d\u4e2d\u90e8\u5206\u4fe1\u606f\u7f3a\u5931\u7684\u5904\u7406\u3002<\/p>\n<p>\u722c\u62c9\u52fe\u7f51\u804c\u4f4d\u4fe1\u606f<\/p>\n<p>@\u6960\u751f<\/p>\n<p>\u672c\u6765\u5c31\u60f3\u4ece\u4e8b\u201c\u6570\u636e\u5206\u6790\u5e08\u201d\u8fd9\u4e2a\u5c97\u4f4d\uff0c\u6240\u4ee5\u5c31\u60f3\u4e86\u89e3\u8fd9\u4e2a\u5c97\u4f4d\u7684\u85aa\u8d44\u3001\u8981\u6c42\u3001\u4ee5\u53ca\u5728\u6211\u6240\u751f\u6d3b\u57ce\u5e02\u7684\u4e3b\u8981\u5206\u5e03\u70b9\uff0c\u800c\u62c9\u52fe\u7f51\u662f\u6743\u5a01\u7684\u4e92\u8054\u7f51\u884c\u4e1a\u62db\u8058\u5e73\u53f0\uff0c\u6240\u4ee5\u722c\u53d6\u62c9\u52fe\u7f51\u4e0a\u7684\u201c\u6570\u636e\u5206\u6790\u5e08\u201d\u804c\u4f4d\u4fe1\u606f\u6709\u5f88\u597d\u7684\u4ee3\u8868\u6027\u3002<\/p>\n<p>\u6700\u7ec8\u722c\u5230\u7684\u6570\u636e\u5b58\u5728MongoDB\u4e2d\u5982\u4e0b\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/hua41d1win.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe20\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe20\" \/><\/div>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/gnezmpuzdn.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe21\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe21\" \/><\/div>\n<p>\u5b66\u4e60\u7ffb\u9875\u7684\u65f6\u5019\u628a\u5f15\u53f7\u6dfb\u4e0a\u8fd0\u884c\u65f6\u62a5\u4e86JSONDecodeError\u7684\u9519\uff0c\u672c\u4eba\u88ab\u5f15\u53f7\u6298\u817e\u4e86\u8bb8\u4e45\uff0c\u5206\u4eab\u51fa\u6765\u5e0c\u671b\u5927\u5bb6\u5f15\u4ee5\u4e3a\u6212\u3002<\/p>\n<p>\u8e29\u4e86\u4e24\u4e2a\u5751\u4e4b\u540e\uff0c\u5c31\u5f00\u59cb\u505a\u8bfe\u540e\u4f5c\u4e1a\u4e86\uff0c\u6ca1\u60f3\u5230\u5bf9\u4e8e\u4e00\u4e2a\u65b0\u624b\u6765\u8bf4\u56f0\u96be\u4e00\u832c\u832c\u3002\u5f00\u59cb\u6211\u7684\u601d\u8def\u662f\u627e\u8fde\u63a5\uff0c\u4f46\u662f\u91c7\u96c6\u7684\u6570\u636e\u91cc\u6ca1\u6709\u8fde\u63a5\uff0c\u6240\u4ee5\u5c31\u70b9\u51fb\u8fdb\u5165\u8be6\u60c5\u9875\u9762\uff0c\u770b\u6709\u4ec0\u4e48\u89c4\u5f8b\u6ca1\uff1f\u7136\u540e\u5c31\u5c1d\u8bd5\u7740\u591a\u6b21\u70b9\u51fb\u5404\u8be6\u60c5\u9875\u9762\uff0c\u53d1\u73b0\u9875\u9762\u7684\u6570\u5b57\u548c\u91c7\u96c6\u7684\u67d0\u4e2a\u6570\u636e\u80fd\u5339\u914d\u3002\u4f8b\u5982\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/kuihzh6n9u.png?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe22\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe22\" \/><\/div>\n<p>\u67d0\u4e2a\u8be6\u60c5\u9875\u9762<\/p>\n<p>\u627e\u5230\u7a81\u7834\u53e3\u5c31\u5f00\u59cb\u884c\u52a8\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/m5ahk3azxe.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe23\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe23\" \/><\/div>\n<p>DOC<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/yyv8imke2j.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe24\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe24\" \/><\/div>\n<p>request url\\request method<\/p>\n<p>\u591a\u6b21\u5c1d\u8bd5\uff08\u8fd8\u662f\u8d39\u4e86\u4e00\u4e9b\u65f6\u95f4\uff09\uff1arequest url\u548c\u7f51\u5740\u662f\u4e00\u6837\u7684\uff0c\u90a3\u7a81\u7834\u53e3\u5c31\u7b97\u627e\u5230\uff0c\u6570\u636e\u662fDOC\u683c\u5f0f\uff0crequest method :get,\u90a3\u5c31\u662f\u53c8\u56de\u5230\u4e86\u719f\u6089\u7684\u6218\u573a\u4e86\u3002<\/p>\n<p>\u601d\u8def\uff1a\u904d\u5386positionId\uff0c\u7528format,\u5982\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/t8tynva538.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe25\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe25\" \/><\/div>\n<p>\u8be6\u60c5\u7f51\u9875<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/hxdzr7y1ep.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe26\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe26\" \/><\/div>\n<p>xpath\u65b9\u6cd5\u83b7\u53d6\u6570\u636e<\/p>\n<p>\u90e8\u5206\u6570\u636e\uff1a<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/lj3nxrqq2r.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe27\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe27\" \/><\/div>\n<p>\u4e00\u6b21\u6b21\u5c1d\u8bd5\uff0c\u4f18\u5316\u540e\u7684\u4ee3\u7801\uff0c\u8fd9\u4e2a\u4e3b\u8981\u662f\u5b66\u4e60\u548c\u521b\u4f5c\u7684\u8fc7\u7a0b\uff08\u722c\u53d6\u8be6\u60c5\u9875\u9762\u662f\u6211\u7684\u6770\u4f5c)\u3002<\/p>\n<p><strong>- \u9ad8\u6548\u7684\u5b66\u4e60\u8def\u5f84 -<\/strong><\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/ymb64gu0cd.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe28\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe28\" \/><\/div>\n<p>\u4e00\u4e0a\u6765\u5c31\u8bb2\u7406\u8bba\u3001\u8bed\u6cd5\u3001\u7f16\u7a0b\u8bed\u8a00\u662f\u975e\u5e38\u4e0d\u5408\u7406\u7684\uff0c\u6211\u4eec\u4f1a<strong>\u76f4\u63a5\u4ece\u5177\u4f53\u7684\u6848\u4f8b\u5165\u624b\uff0c\u901a\u8fc7\u5b9e\u9645\u7684\u64cd\u4f5c\uff0c\u5b66\u4e60\u5177\u4f53\u7684\u77e5\u8bc6\u70b9<\/strong>\u3002\u6211\u4eec\u4e3a\u4f60\u89c4\u5212\u4e86\u4e00\u6761\u7cfb\u7edf\u7684\u5b66\u4e60\u8def\u5f84\uff0c\u8ba9\u4f60\u4e0d\u518d\u9762\u5bf9\u96f6\u6563\u7684\u77e5\u8bc6\u70b9\u3002<\/p>\n<p>\u8bf4\u70b9\u5177\u4f53\u7684\uff0c\u6bd4\u5982\u6211\u4eec\u4f1a\u76f4\u63a5\u7528 lxml+Xpath\u53d6\u4ee3 BeautifulSoup \u6765\u8fdb\u884c\u7f51\u9875\u89e3\u6790\uff0c\u51cf\u5c11\u4f60\u4e0d\u5fc5\u8981\u7684\u68c0\u67e5\u7f51\u9875\u5143\u7d20\u7684\u64cd\u4f5c\uff0c<strong>\u591a\u79cd\u5de5\u5177\u90fd\u80fd\u5b8c\u6210\u7684\uff0c\u6211\u4eec\u4f1a\u7ed9\u4f60\u6700\u7b80\u5355\u7684\u65b9\u6cd5<\/strong>\uff0c\u8fd9\u4e9b\u770b\u4f3c\u7ec6\u8282\uff0c\u4f46\u53ef\u80fd\u662f\u5f88\u591a\u4eba\u90fd\u4f1a\u8e29\u7684\u5751\u3002<\/p>\n<p><strong>\u300aPython\u722c\u866b\uff1a\u5165\u95e8+\u8fdb\u9636\u300b\u5927\u7eb2<\/strong><\/p>\n<p><strong>\u7b2c\u4e00\u7ae0\uff1aPython \u722c\u866b\u5165\u95e8<\/strong><\/p>\n<p><strong>1\u3001\u4ec0\u4e48\u662f\u722c\u866b<\/strong><\/p>\n<p>\u7f51\u5740\u6784\u6210\u548c\u7ffb\u9875\u673a\u5236<\/p>\n<p>\u7f51\u9875\u6e90\u7801\u7ed3\u6784\u53ca\u7f51\u9875\u8bf7\u6c42\u8fc7\u7a0b<\/p>\n<p>\u722c\u866b\u7684\u5e94\u7528\u53ca\u57fa\u672c\u539f\u7406<\/p>\n<p><strong>2\u3001\u521d\u8bc6Python\u722c\u866b<\/strong><\/p>\n<p>Python\u722c\u866b\u73af\u5883\u642d\u5efa<\/p>\n<p>\u521b\u5efa\u7b2c\u4e00\u4e2a\u722c\u866b\uff1a\u722c\u53d6\u767e\u5ea6\u9996\u9875<\/p>\n<p>\u722c\u866b\u4e09\u6b65\u9aa4\uff1a\u83b7\u53d6\u6570\u636e\u3001\u89e3\u6790\u6570\u636e\u3001\u4fdd\u5b58\u6570\u636e<\/p>\n<p><strong>3\u3001\u4f7f\u7528Requests\u722c\u53d6\u8c46\u74e3\u77ed\u8bc4<\/strong><\/p>\n<p>Requests\u7684\u5b89\u88c5\u548c\u57fa\u672c\u7528\u6cd5<\/p>\n<p>\u7528Requests \u722c\u53d6\u8c46\u74e3\u77ed\u8bc4\u4fe1\u606f<\/p>\n<p>\u4e00\u5b9a\u8981\u77e5\u9053\u7684\u722c\u866b\u534f\u8bae<\/p>\n<p><strong>4\u3001\u4f7f\u7528Xpath\u89e3\u6790\u8c46\u74e3\u77ed\u8bc4<\/strong><\/p>\n<p>\u89e3\u6790\u795e\u5668Xpath\u7684\u5b89\u88c5\u53ca\u4ecb\u7ecd<\/p>\n<p>Xpath\u7684\u4f7f\u7528\uff1a\u6d4f\u89c8\u5668\u590d\u5236\u548c\u624b\u5199<\/p>\n<p>\u5b9e\u6218\uff1a\u7528 Xpath \u89e3\u6790\u8c46\u74e3\u77ed\u8bc4\u4fe1\u606f<\/p>\n<p><strong>5\u3001\u4f7f\u7528pandas\u4fdd\u5b58\u8c46\u74e3\u77ed\u8bc4\u6570\u636e<\/strong><\/p>\n<p>pandas \u7684\u57fa\u672c\u7528\u6cd5\u4ecb\u7ecd<\/p>\n<p>pandas\u6587\u4ef6\u4fdd\u5b58\u3001\u6570\u636e\u5904\u7406<\/p>\n<p>\u5b9e\u6218\uff1a\u4f7f\u7528pandas\u4fdd\u5b58\u8c46\u74e3\u77ed\u8bc4\u6570\u636e<\/p>\n<p><strong>6\u3001\u6d4f\u89c8\u5668\u6293\u5305\u53caheaders\u8bbe\u7f6e\uff08\u6848\u4f8b\u4e00\uff1a\u722c\u53d6\u77e5\u4e4e\uff09<\/strong><\/p>\n<p>\u722c\u866b\u7684\u4e00\u822c\u601d\u8def\uff1a\u6293\u53d6\u3001\u89e3\u6790\u3001\u5b58\u50a8<\/p>\n<p>\u6d4f\u89c8\u5668\u6293\u5305\u83b7\u53d6Ajax\u52a0\u8f7d\u7684\u6570\u636e<\/p>\n<p>\u8bbe\u7f6eheaders \u7a81\u7834\u53cd\u722c\u866b\u9650\u5236<\/p>\n<p>\u5b9e\u6218\uff1a\u722c\u53d6\u77e5\u4e4e\u7528\u6237\u6570\u636e<\/p>\n<p><strong>7\u3001\u6570\u636e\u5165\u5e93\u4e4bMongoDB\uff08\u6848\u4f8b\u4e8c\uff1a\u722c\u53d6\u62c9\u52fe\uff09<\/strong><\/p>\n<p>MongoDB\u53caRoboMongo\u7684\u5b89\u88c5\u548c\u4f7f\u7528<\/p>\n<p>\u8bbe\u7f6e\u7b49\u5f85\u65f6\u95f4\u548c\u4fee\u6539\u4fe1\u606f\u5934<\/p>\n<p>\u5b9e\u6218\uff1a\u722c\u53d6\u62c9\u52fe\u804c\u4f4d\u6570\u636e<\/p>\n<p>\u5c06\u6570\u636e\u5b58\u50a8\u5728MongoDB\u4e2d<\/p>\n<p>\u8865\u5145\u5b9e\u6218\uff1a\u722c\u53d6\u5fae\u535a\u79fb\u52a8\u7aef\u6570\u636e<\/p>\n<p><strong>8\u3001Selenium\u722c\u53d6\u52a8\u6001\u7f51\u9875\uff08\u6848\u4f8b\u4e09\uff1a\u722c\u53d6\u6dd8\u5b9d\uff09<\/strong><\/p>\n<p>\u52a8\u6001\u7f51\u9875\u722c\u53d6\u795e\u5668Selenium\u642d\u5efa\u4e0e\u4f7f\u7528<\/p>\n<p>\u5206\u6790\u6dd8\u5b9d\u5546\u54c1\u9875\u9762\u52a8\u6001\u4fe1\u606f<\/p>\n<p>\u5b9e\u6218\uff1a\u7528Selenium \u722c\u53d6\u6dd8\u5b9d\u7f51\u9875\u4fe1\u606f<\/p>\n<p><strong>\u7b2c\u4e8c\u7ae0\uff1aPython\u722c\u866b\u4e4bScrapy\u6846\u67b6<\/strong><\/p>\n<p><strong>1\u3001\u722c\u866b\u5de5\u7a0b\u5316\u53caScrapy\u6846\u67b6\u521d\u7aa5<\/strong><\/p>\n<p>html\u3001css\u3001js\u3001\u6570\u636e\u5e93\u3001http\u534f\u8bae\u3001\u524d\u540e\u53f0\u8054\u52a8<\/p>\n<p>\u722c\u866b\u8fdb\u9636\u7684\u5de5\u4f5c\u6d41\u7a0b<\/p>\n<p>Scrapy\u7ec4\u4ef6\uff1a\u5f15\u64ce\u3001\u8c03\u5ea6\u5668\u3001\u4e0b\u8f7d\u4e2d\u95f4\u4ef6\u3001\u9879\u76ee\u7ba1\u9053\u7b49<\/p>\n<p>\u5e38\u7528\u7684\u722c\u866b\u5de5\u5177\uff1a\u5404\u79cd\u6570\u636e\u5e93\u3001\u6293\u5305\u5de5\u5177\u7b49<\/p>\n<p><strong>2\u3001Scrapy\u5b89\u88c5\u53ca\u57fa\u672c\u4f7f\u7528<\/strong><\/p>\n<p>Scrapy\u5b89\u88c5<\/p>\n<p>Scrapy\u7684\u57fa\u672c\u65b9\u6cd5\u548c\u5c5e\u6027<\/p>\n<p>\u5f00\u59cb\u7b2c\u4e00\u4e2aScrapy\u9879\u76ee<\/p>\n<p><strong>3\u3001Scrapy\u9009\u62e9\u5668\u7684\u7528\u6cd5<\/strong><\/p>\n<p>\u5e38\u7528\u9009\u62e9\u5668\uff1acss\u3001xpath\u3001re\u3001pyquery<\/p>\n<p>css\u7684\u4f7f\u7528\u65b9\u6cd5<\/p>\n<p>xpath\u7684\u4f7f\u7528\u65b9\u6cd5<\/p>\n<p>re\u7684\u4f7f\u7528\u65b9\u6cd5<\/p>\n<p>pyquery\u7684\u4f7f\u7528\u65b9\u6cd5<\/p>\n<p><strong>4\u3001Scrapy\u7684\u9879\u76ee\u7ba1\u9053<\/strong><\/p>\n<p>Item Pipeline\u7684\u4ecb\u7ecd\u548c\u4f5c\u7528<\/p>\n<p>Item Pipeline\u7684\u4e3b\u8981\u51fd\u6570<\/p>\n<p>\u5b9e\u6218\u4e3e\u4f8b\uff1a\u5c06\u6570\u636e\u5199\u5165\u6587\u4ef6<\/p>\n<p>\u5b9e\u6218\u4e3e\u4f8b\uff1a\u5728\u7ba1\u9053\u91cc\u8fc7\u6ee4\u6570\u636e<\/p>\n<p><strong>5\u3001Scrapy\u7684\u4e2d\u95f4\u4ef6<\/strong><\/p>\n<p>\u4e0b\u8f7d\u4e2d\u95f4\u4ef6\u548c\u8718\u86db\u4e2d\u95f4\u4ef6<\/p>\n<p>\u4e0b\u8f7d\u4e2d\u95f4\u4ef6\u7684\u4e09\u5927\u51fd\u6570<\/p>\n<p>\u7cfb\u7edf\u9ed8\u8ba4\u63d0\u4f9b\u7684\u4e2d\u95f4\u4ef6<\/p>\n<p><strong>6\u3001Scrapy\u7684Request\u548cResponse\u8be6\u89e3<\/strong><\/p>\n<p>Request\u5bf9\u8c61\u57fa\u7840\u53c2\u6570\u548c\u9ad8\u7ea7\u53c2\u6570<\/p>\n<p>Request\u5bf9\u8c61\u65b9\u6cd5<\/p>\n<p>Response\u5bf9\u8c61\u53c2\u6570\u548c\u65b9\u6cd5<\/p>\n<p>Response\u5bf9\u8c61\u65b9\u6cd5\u7684\u7efc\u5408\u5229\u7528\u8be6\u89e3<\/p>\n<p><strong>\u7b2c\u4e09\u7ae0\uff1aPython\u722c\u866b\u8fdb\u9636\u64cd\u4f5c<\/strong><\/p>\n<p><strong>1\u3001\u7f51\u7edc\u8fdb\u9636\u4e4b\u8c37\u6b4c\u6d4f\u89c8\u5668\u6293\u5305\u5206\u6790<\/strong><\/p>\n<p>http\u8bf7\u6c42\u8be6\u7ec6\u5206\u6790<\/p>\n<p>\u7f51\u7edc\u9762\u677f\u7ed3\u6784<\/p>\n<p>\u8fc7\u6ee4\u8bf7\u6c42\u7684\u5173\u952e\u5b57\u65b9\u6cd5<\/p>\n<p>\u590d\u5236\u3001\u4fdd\u5b58\u548c\u6e05\u9664\u7f51\u7edc\u4fe1\u606f<\/p>\n<p>\u67e5\u770b\u8d44\u6e90\u53d1\u8d77\u8005\u548c\u4f9d\u8d56\u5173\u7cfb<\/p>\n<p><strong>2\u3001\u6570\u636e\u5165\u5e93\u4e4b\u53bb\u91cd\u4e0e\u6570\u636e\u5e93<\/strong><\/p>\n<p>\u6570\u636e\u53bb\u91cd<\/p>\n<p>\u6570\u636e\u5165\u5e93MongoDB<\/p>\n<p><strong>\u7b2c\u56db\u7ae0\uff1a\u5206\u5e03\u5f0f\u722c\u866b\u53ca\u5b9e\u8bad\u9879\u76ee<\/strong><\/p>\n<p><strong>1\u3001\u5927\u89c4\u6a21\u5e76\u53d1\u91c7\u96c6\u2014\u2014\u5206\u5e03\u5f0f\u722c\u866b\u7684\u7f16\u5199<\/strong><\/p>\n<p>\u5206\u5e03\u5f0f\u722c\u866b\u4ecb\u7ecd<\/p>\n<p>Scrapy\u5206\u5e03\u5f0f\u722c\u53d6\u539f\u7406<\/p>\n<p>Scrapy-Redis\u7684\u4f7f\u7528<\/p>\n<p>Scrapy\u5206\u5e03\u5f0f\u90e8\u7f72\u8be6\u89e3<\/p>\n<p><strong>2\u3001\u5b9e\u8bad\u9879\u76ee\uff08\u4e00\uff09\u2014\u201458\u540c\u57ce\u4e8c\u624b\u623f\u76d1\u63a7<\/strong><\/p>\n<p><strong>3\u3001\u5b9e\u8bad\u9879\u76ee\uff08\u4e8c\uff09\u2014\u2014\u53bb\u54ea\u513f\u7f51\u6a21\u62df\u767b\u9646<\/strong><\/p>\n<p><strong>4\u3001\u5b9e\u8bad\u9879\u76ee\uff08\u4e09\uff09\u2014\u2014\u4eac\u4e1c\u5546\u54c1\u6570\u636e\u6293\u53d6<\/strong><\/p>\n<p><strong>- \u6bcf\u8bfe\u90fd\u6709\u5b66\u4e60\u8d44\u6599 -<\/strong><\/p>\n<p>\u4f60\u53ef\u80fd\u6536\u96c6\u4e86\u4ee5G\u8ba1\u7684\u7684\u5b66\u4e60\u8d44\u6e90\uff0c\u4f46\u4fdd\u5b58\u540e\u4ece\u6765\u6ca1\u6253\u5f00\u8fc7\uff1f<strong>\u6211\u4eec\u5df2\u7ecf\u5e2e\u4f60\u627e\u5230\u4e86\u6700\u6709\u7528\u7684\u90a3\u90e8\u5206\uff0c\u5e76\u4e14\u7528\u6700\u7b80\u5355\u7684\u5f62\u5f0f\u63cf\u8ff0\u51fa\u6765<\/strong>\uff0c\u5e2e\u52a9\u4f60\u5b66\u4e60\uff0c\u4f60\u53ef\u4ee5\u628a\u66f4\u591a\u7684\u65f6\u95f4\u7528\u4e8e\u7ec3\u4e60\u548c\u5b9e\u8df5\u3002<\/p>\n<p>\u8003\u8651\u5230\u5404\u79cd\u5404\u6837\u7684\u95ee\u9898\uff0c\u6211\u4eec\u5728\u6bcf\u4e00\u8282\u90fd\u51c6\u5907\u4e86\u8bfe\u540e\u8d44\u6599\uff0c\u5305\u542b\u56db\u4e2a\u90e8\u5206\uff1a<\/p>\n<p>1.\u8bfe\u7a0b\u91cd\u70b9\u7b14\u8bb0\uff0c\u8be6\u7ec6\u9610\u8ff0\u91cd\u70b9\u77e5\u8bc6\uff0c\u5e2e\u52a9\u4f60\u7406\u89e3\u548c\u540e\u7eed\u5feb\u901f\u590d\u4e60\uff1b<\/p>\n<p>2.\u9ed8\u8ba4\u4f60\u662f\u5c0f\u767d\uff0c\u8865\u5145\u6240\u6709\u57fa\u7840\u77e5\u8bc6\uff0c\u54ea\u6015\u662f\u8f6f\u4ef6\u7684\u5b89\u88c5\u4e0e\u57fa\u672c\u64cd\u4f5c\uff1b<\/p>\n<p>3.\u8bfe\u5185\u5916\u6848\u4f8b\u63d0\u4f9b\u53c2\u8003\u4ee3\u7801\u5b66\u4e60\uff0c\u8ba9\u4f60\u8f7b\u677e\u5e94\u5bf9\u4e3b\u6d41\u7f51\u7ad9\u722c\u866b\uff1b<\/p>\n<p>4.\u8d85\u591a\u5ef6\u4f38\u77e5\u8bc6\u70b9\u548c\u66f4\u591a\u95ee\u9898\u7684\u89e3\u51b3\u601d\u8def\uff0c\u8ba9\u4f60\u6709\u80fd\u529b\u53bb\u89e3\u51b3\u5b9e\u9645\u4e2d\u9047\u5230\u7684\u4e00\u4e9b\u7279\u6b8a\u95ee\u9898\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/4m9nrbwtnh.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe29\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe29\" \/><\/div>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/8b3rwvan4u.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe30\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe30\" \/><\/div>\n<p>\u67d0\u8282\u90e8\u5206\u8bfe\u540e\u8d44\u6599<\/p>\n<p><strong>- \u8d85\u591a\u6848\u4f8b\uff0c\u8986\u76d6\u4e3b\u6d41\u7f51\u7ad9 -<\/strong><\/p>\n<p>\u8bfe\u7a0b\u4e2d\u63d0\u4f9b\u4e86\u76ee\u524d\u6700\u5e38\u89c1\u7684\u7f51\u7ad9\u722c\u866b\u6848\u4f8b\uff1a\u8c46\u74e3\u3001\u767e\u5ea6\u3001\u77e5\u4e4e\u3001\u6dd8\u5b9d\u3001\u4eac\u4e1c\u3001\u5fae\u535a\u2026\u2026<strong>\u6bcf\u4e2a\u6848\u4f8b\u5728\u8bfe\u7a0b\u89c6\u9891\u4e2d\u90fd\u6709\u8be6\u7ec6\u5206\u6790\uff0c\u8001\u5e08\u5e26\u4f60\u5b8c\u6210\u6bcf\u4e00\u6b65\u64cd\u4f5c<\/strong>\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u6211\u4eec\u8fd8\u4f1a\u8865\u5145\u6bd4\u5982\u5c0f\u732a\u3001\u94fe\u5bb6\u300158\u540c\u57ce\u3001\u7f51\u6613\u4e91\u97f3\u4e50\u3001\u5fae\u4fe1\u597d\u53cb\u7b49\u6848\u4f8b\uff0c\u63d0\u4f9b\u601d\u8def\u4e0e\u4ee3\u7801\u3002<\/p>\n<p>\u591a\u6b21\u7684\u6a21\u4eff\u548c\u7ec3\u4e60\u4e4b\u540e\uff0c\u4f60\u53ef\u4ee5\u5f88\u8f7b\u677e\u5730\u5199\u51fa\u81ea\u5df1\u7684\u722c\u866b\u4ee3\u7801\uff0c\u5e76\u80fd\u591f\u8f7b\u677e\u722c\u53d6\u8fd9\u4e9b\u4e3b\u6d41\u7f51\u7ad9\u7684\u6570\u636e\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/7b6c8tw0cb.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe31\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe31\" \/><\/div>\n<p><strong>- \u6280\u80fd\u62d3\u5c55\uff1a\u53cd\u722c\u866b\u53ca\u6570\u636e\u5b58\u50a8\u3001\u5904\u7406 -<\/strong><\/p>\n<p>\u61c2\u5f97\u57fa\u672c\u7684\u722c\u866b\u662f\u8fdc\u8fdc\u4e0d\u591f\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u4f1a\u7528\u5b9e\u9645\u7684\u6848\u4f8b\uff0c\u5e26\u4f60\u4e86\u89e3\u4e00\u4e9b\u7f51\u7ad9\u7684\u53cd\u722c\u866b\u63aa\u65bd\uff0c\u5e76\u4e14\u7528\u5177\u4f53\u7684\u6280\u672f\u7ed5\u8fc7\u9650\u5236\u3002<strong>\u6bd4\u5982\u5f02\u6b65\u52a0\u8f7d\u3001IP\u9650\u5236\u3001headers\u9650\u5236\u3001\u9a8c\u8bc1\u7801\u7b49\u7b49<\/strong>\uff0c\u8fd9\u4e9b\u6bd4\u8f83\u5e38\u89c1\u7684\u53cd\u722c\u866b\u624b\u6bb5\uff0c\u4f60\u90fd\u53ef\u4ee5\u5f88\u597d\u5730\u89c4\u907f\u3002<\/p>\n<p>\u5de5\u7a0b\u5316\u7684\u722c\u866b\u3001\u53ca\u5206\u5e03\u5f0f\u722c\u866b\u6280\u672f\uff0c\u8ba9\u4f60\u6709\u83b7\u53d6\u5927\u89c4\u6a21\u6570\u636e\u7684\u53ef\u80fd\u3002<strong>\u9664\u4e86\u722c\u866b\u7684\u5185\u5bb9\uff0c\u4f60\u8fd8\u5c06\u4e86\u89e3\u6570\u636e\u5e93\uff08Mongodb\uff09\u3001pandas \u7684\u57fa\u672c\u77e5\u8bc6\uff0c\u5e2e\u4f60\u5b58\u50a8\u722c\u53d6\u7684\u6570\u636e\uff0c\u540c\u65f6\u53ef\u4ee5\u5bf9\u6570\u636e\u8fdb\u884c\u7ba1\u7406\u548c\u6e05\u6d17<\/strong>\uff0c\u4f60\u53ef\u4ee5\u83b7\u5f97\u66f4\u5e72\u51c0\u7684\u6570\u636e\uff0c\u4ee5\u4fbf\u540e\u7eed\u7684\u5206\u6790\u548c\u5904\u7406\u3002<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/9uyracvg5s.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe32\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe32\" \/><\/div>\n<p>\u7528 Scrapy \u722c\u53d6\u79df\u623f\u4fe1\u606f<\/p>\n<div class=\"image-block\"><img decoding=\"async\" data-original=\"https:\/\/ask.qcloudimg.com\/http-save\/yehe-1557966\/iol6nx0uhh.jpeg?imageView2\/2\/w\/1620\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" title=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe33\" alt=\"Python\u722c\u866b\uff1a\u5982\u4f55\u5728\u4e00\u4e2a\u6708\u5185\u5b66\u4f1a\u722c\u53d6\u5927\u89c4\u6a21\u6570\u636e\uff1f\u65b0\u624b\u5fc5\u5b66\u63d2\u56fe33\" \/><\/div>\n<p>\u722c\u53d6\u62c9\u52fe\u62db\u8058\u6570\u636e\u5e76\u7528 MongoDB \u5b58\u50a8\u00a0 \u6700\u540e\u6ce8\u610f\u4e0d\u7ba1\u4f60\u662f\u4e3a\u4e86Python\u5c31\u4e1a\u8fd8\u662f\u5174\u8da3\u7231\u597d\uff0c\u8bb0\u4f4f\uff1a\u9879\u76ee\u5f00\u53d1\u7ecf\u9a8c\u6c38\u8fdc\u662f\u6838\u5fc3\uff0c\u5982\u679c\u4f60\u6ca1\u67092020\u6700\u65b0python\u5165\u95e8\u5230\u9ad8\u7ea7\u5b9e\u6218\u89c6\u9891\u6559\u7a0b\uff0c\u53ef\u4ee5\u53bb\u5c0f\u7f16\u7684Python\u4ea4\u6d41.\u88d9 \uff1a\u4e03\u8863\u8863\u4e5d\u4e03\u4e03\u5df4\u800c\u4e94\uff08\u6570\u5b57\u7684\u8c10\u97f3\uff09\u8f6c\u6362\u4e0b\u53ef\u4ee5\u627e\u5230\u4e86\uff0c\u91cc\u9762\u5f88\u591a\u65b0python\u6559\u7a0b\u9879\u76ee\uff0c\u8fd8\u53ef\u4ee5\u8ddf\u8001\u53f8\u673a\u4ea4\u6d41\u8ba8\u6559\uff01<\/p>\n<p>\u672c\u6587\u7684\u6587\u5b57\u53ca\u56fe\u7247\u6765\u6e90\u4e8e\u7f51\u7edc\u52a0\u4e0a\u81ea\u5df1\u7684\u60f3\u6cd5,\u4ec5\u4f9b\u5b66\u4e60\u3001\u4ea4\u6d41\u4f7f\u7528,\u4e0d\u5177\u6709\u4efb\u4f55\u5546\u4e1a\u7528\u9014,\u7248\u6743\u5f52\u539f\u4f5c\u8005\u6240\u6709,\u5982\u6709\u95ee\u9898\u8bf7\u53ca\u65f6\u8054\u7cfb\u6211\u4eec\u4ee5\u4f5c\u5904\u7406\u3002<\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Python\u722c\u866b\u4e3a\u4ec0\u4e48\u53d7\u6b22\u8fce \u5982\u679c\u4f60\u4ed4\u7ec6\u89c2\u5bdf\uff0c\u5c31\u4e0d\u96be\u53d1\u73b0\uff0c\u61c2\u722c\u866b\u3001\u5b66\u4e60\u722c\u866b\u7684\u4eba\u8d8a\u6765\u8d8a\u591a\uff0c\u4e00\u65b9\u9762\uff0c\u4e92\u8054\u7f51\u53ef\u4ee5\u83b7\u53d6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,20],"tags":[353,352],"class_list":["post-505","post","type-post","status-publish","format-standard","hentry","category-linux","category-python","tag-linux","tag-python"],"_links":{"self":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=505"}],"version-history":[{"count":0,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/505\/revisions"}],"wp:attachment":[{"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}