{"id":216342,"date":"2020-11-20T17:57:37","date_gmt":"2020-11-20T09:57:37","guid":{"rendered":"http:\/\/4563.org\/?p=216342"},"modified":"2020-11-20T17:57:37","modified_gmt":"2020-11-20T09:57:37","slug":"%e7%94%a8%e4%b8%ad%e6%96%87-api-%e8%ae%a9%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e6%9b%b4%e6%98%93%e8%af%bb%e5%86%99%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=216342","title":{"rendered":"\u7528\u4e2d\u6587 API \u8ba9\u6b63\u5219\u8868\u8fbe\u5f0f\u66f4\u6613\u8bfb\u5199\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u7528\u4e2d\u6587 API \u8ba9\u6b63\u5219\u8868\u8fbe\u5f0f\u66f4\u6613\u8bfb\u5199\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuanwu <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u539f\u6587\uff1a\u300a\u7528\u4e2d\u6587 API \u8ba9\u6b63\u5219\u8868\u8fbe\u5f0f\u66f4\u6613\u8bfb\u5199\uff1f\u300b<\/p>\n<p>\u6728\u5170\u8bed\u8a00\u91cd\u73b0\u9879\u76ee\u4e2d\u7528\u5230\u4e86\u4e0d\u5c11\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u5176\u4e2d\u4e0d\u4e4f\u4e0d\u90a3\u4e48\u4e00\u76ee\u4e86\u7136\u7684\uff08 Python \u5b9e\u73b0\uff09\uff1a<\/p>\n<pre><code>\u6807\u8bc6\u7b26\uff1ar'$?[_a-zA-Zu4e00-u9fa5][_a-zA-Z0-9u4e00-u9fa5]*'    \u53cc\u5f15\u53f7\u5b57\u7b26\u4e32\uff1ar'(\")((?&lt;!\\)\\1|.)*?1'  \u5b57\u7b26\u4e32\u63d2\u503c\u76f8\u5173\uff1ar'\\(([^\\)]*)\\)|`([^`]*)`' <\/code><\/pre>\n<p>\u7531\u6b64\u60f3\u5230\u662f\u5426\u6709 API \u80fd\u591f\u6784\u5efa\u6b63\u5219\u8868\u8fbe\u5f0f\u3002\u627e\u5230 PythonVerbalExpressions\uff0c\u5b83\u9996\u9875\u4e0a\u4e00\u4e2a\u793a\u4f8b\u5982\u4e0b:<\/p>\n<pre><code>verbal_expression. start_of_line(). find('http'). maybe('s'). find(':\/\/'). maybe('www.'). anything_but(' '). end_of_line() <\/code><\/pre>\n<p>\u5bf9\u5e94\u6b63\u5219: <code>^( http)(s)?(:\/\/)(www.)?([^ ]*)$<\/code><\/p>\n<p>\u770b\u8d77\u6765\u7684\u786e\u6bd4\u8f83\u53ef\u8bfb\uff0c\u800c\u4e14\u5982\u679c\u6539\u4e3a\u4e2d\u6587 API \u7684\u8bdd\uff0c\u547d\u540d\u4f1a\u66f4\u7b80\u77ed:<\/p>\n<pre><code>\u5f00\u5934(). \u5bfb\u627e('http'). \u6216\u8bb8('s'). \u5bfb\u627e(':\/\/'). \u6216\u8bb8('www.'). \u9664\u4e86(' '). \u7ed3\u5c3e() <\/code><\/pre>\n<p>\u95ee\u9898\u662f\u8fd9\u4e2a\u5e93\u7684\u529f\u80fd\u4f3c\u4e4e\u6709\u9650\uff0c\u4ec5\u652f\u6301\u5c0f\u90e8\u5206\u6b63\u5219\u8bed\u6cd5\uff0c\u4e8e\u662f\u8003\u8651\u6539\u8fdb\u3002<\/p>\n<h2>\u8bbe\u60f3\u4e2d\u7684 API \u793a\u4f8b<\/h2>\n<p>\u4ee5\u5f00\u5934\u7684\u6728\u5170\u5b9e\u73b0\u4e2d\u7684\u51e0\u4e2a\u6b63\u5219\u4e3a\u4f8b\uff0c\u7528\u8bbe\u60f3\u4e2d\u7684 API \u8868\u8fbe\u540e\u8fdb\u884c\u5bf9\u6bd4<\/p>\n<p>\u6807\u8bc6\u7b26\uff1a<\/p>\n<pre><code>\u81f3\u591a\u4e00\u4e2a(\"$\").\u4e00\u4e2a(\"_\", \u5927\u5c0f\u5199\u82f1\u6587, \u4e2d\u6587).\u4efb\u610f\u4e2a(\"_\", \u5927\u5c0f\u5199\u82f1\u6587, \u6570\u5b57, \u4e2d\u6587)  \u539f\u59cb\u6b63\u5219\u8868\u8fbe\u5f0f\u5bf9\u6bd4\uff1ar'$?[_a-zA-Zu4e00-u9fa5][_a-zA-Z0-9u4e00-u9fa5]*'        <\/code><\/pre>\n<p>\u53cc\u5f15\u53f7\u5b57\u7b26\u4e32\uff1a<\/p>\n<pre><code>\u5206\u7ec4(\u53cc\u5f15\u53f7)   .\u6700\u5c0f\u5339\u914d(     \u4efb\u610f\u4e2a(       \u5206\u7ec4(         \u7686\u53ef(           \u524d\u9762\u4e0d\u662f(\u53cd\u659c\u6760).\u4e00\u4e2a(\u53cd\u659c\u6760).\u4e00\u4e2a(\u5f15\u7528\u5206\u7ec4(1)),           \u4e00\u4e2a(\u975e\u6362\u884c\u5b57\u7b26))       )     )   )   .\u5f15\u7528\u5206\u7ec4(1)  r'(\")((?&lt;!\\)\\1|.)*?1' <\/code><\/pre>\n<p>\u5b57\u7b26\u4e32\u63d2\u503c\u76f8\u5173\uff1a<\/p>\n<pre><code>\u7686\u53ef(   \u4e00\u4e2a(\u53cd\u659c\u6760).\u4e00\u4e2a(\u5de6\u5c0f\u62ec\u53f7).\u5206\u7ec4(\u4efb\u610f\u4e2a(\u4e0d\u662f(\u53cd\u659c\u6760, \u53f3\u5c0f\u62ec\u53f7))).\u4e00\u4e2a(\u53cd\u659c\u6760).\u4e00\u4e2a(\u53f3\u5c0f\u62ec\u53f7),   \u4e00\u4e2a(\u53cd\u5f15\u53f7).\u5206\u7ec4(\u4efb\u610f\u4e2a(\u4e0d\u662f(\u53cd\u5f15\u53f7))).\u4e00\u4e2a(\u53cd\u5f15\u53f7) )  r'\\(([^\\)]*)\\)|`([^`]*)`' <\/code><\/pre>\n<p>\u76f8\u5bf9\u539f\u59cb\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u5728\u53ef\u8bfb\u6027\u4e4b\u5916\u8fd8\u6709\u51e0\u4e2a\u4f18\u52bf:<\/p>\n<ul>\n<li>\u4e0d\u9700\u4e3a\u6b63\u5219\u7684\u7279\u6b8a\u610f\u4e49\u5b57\u7b26\u52a0\u53cd\u659c\u6760\uff0c\u5982 \uff0c(\uff0c) \u7b49<\/li>\n<li>\u660e\u786e\u8fd0\u7b97\u4f18\u5148\u7ea7\uff0c\u6bd4\u5982\u53cc\u5f15\u53f7\u5b57\u7b26\u4e32\u4e2d\u7684 | \u548c (?&lt;!)&#8230;<\/li>\n<\/ul>\n<p>\u5728\u6613\u5199\u65b9\u9762\uff0c\u76f8\u5bf9\u4e8e\u6b63\u5219\u7684\u7b26\u53f7\u8bed\u6cd5\uff0cAPI \u8bed\u4e49\u66f4\u52a0\u76f4\u767d\u3002<\/p>\n<p>\u6b22\u8fce\u610f\u89c1\u5efa\u8bae\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>0<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u7528\u4e2d\u6587 API \u8ba9\u6b63\u5219\u8868\u8fbe\u5f0f\u66f4\u6613\u8bfb&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\/216342"}],"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=216342"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/216342\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=216342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=216342"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=216342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}