{"id":342922,"date":"2021-02-14T20:34:09","date_gmt":"2021-02-14T12:34:09","guid":{"rendered":"http:\/\/4563.org\/?p=342922"},"modified":"2021-02-14T20:34:09","modified_gmt":"2021-02-14T12:34:09","slug":"scrapy-%e9%87%87%e9%9b%86%e5%85%a5%e4%b8%ba%e5%ba%93-mysql-%e6%95%b0%e6%8d%ae%e5%ba%93%ef%bc%8c%e5%8f%aa%e6%9b%b4%e6%96%b0%e4%b8%80%e4%b8%aa%e5%ad%97%e6%ae%b5-%e6%8f%90%e7%a4%ba%e8%bf%99%e4%b8%aa","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=342922","title":{"rendered":"scrapy \u91c7\u96c6\u5165\u4e3a\u5e93 mysql \u6570\u636e\u5e93\uff0c\u53ea\u66f4\u65b0\u4e00\u4e2a\u5b57\u6bb5 \u63d0\u793a\u8fd9\u4e2a\u8bed\u6cd5\u9519\u8bef\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  scrapy \u91c7\u96c6\u5165\u4e3a\u5e93 mysql \u6570\u636e\u5e93\uff0c\u53ea\u66f4\u65b0\u4e00\u4e2a\u5b57\u6bb5 \u63d0\u793a\u8fd9\u4e2a\u8bed\u6cd5\u9519\u8bef\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : python30 <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5c31\u662f\u67e5\u8be2\u6709\u6ca1\u6709\u8fd9\u4e2a\u5b57\uff0c\u5982\u679c\u67e5\u5230\u8fd9\u4e2a\u5b57\u5c31\u66f4\u65b0\u8fd9\u4e2a\u5b57\u7684 bsmc \u5b57\u6bb5 \u8868\u662f news_topic \u63d2\u5165\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><code> def insert_into_info(self, conn, item):   print ('starts...')   ziinfo = item['zi']   conn.execute(\"\"\"select 1 from news_topic where zi = %s\"\"\", (ziinfo, ))   ret = conn.fetchone()   tp_id = int(conn.lastrowid)   print ('aaaaaaaaaaa')   if ret:    print(u'\u5f00\u59cb\u66f4\u65b0\u8fd9\u6761\u6570\u636e')    UPDATE news_topic SET bsmc = item['bsmc'] WHERE id = tp_id;    pass   else:    pass <\/code><\/pre>\n<p>\u63d0\u793a\u5982\u4e0b\u56fe\u9519\u8bef <\/p>\n<p> <img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/02\/20210219_602fdc0047991.jpg\" alt=\"scrapy \u91c7\u96c6\u5165\u4e3a\u5e93 mysql \u6570\u636e\u5e93\uff0c\u53ea\u66f4\u65b0\u4e00\u4e2a\u5b57\u6bb5 \u63d0\u793a\u8fd9\u4e2a\u8bed\u6cd5\u9519\u8bef\uff1f\" \/> <\/p>\n<p>\u4e0d\u77e5\u9053 mysql \u66f4\u65b0 \u8bed\u53e5\u662f\u4e0d\u662f\u6709\u95ee\u9898\uff1f<\/p>\n<p>\u8c22\u8c22<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5281464\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yeqizhang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             aa \u52a0\u5f15\u53f7                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5281465\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lpts007 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5565\u610f\u601d\uff0cpython \u91cc\u9762\u4e3a\u5565\u53ef\u4ee5\u76f4\u63a5\u5c31 update \u8bed\u53e5\uff1f<br \/>\u81ea\u5df1\u4e0d\u5947\u602a select \u5e26\u5f15\u53f7\u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5281466\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : superrichman <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u554a \u8fd9&#8230; python \u91cc\u76f4\u63a5\u5199 sql                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5281467\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : python30 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @yeqizhang <br \/>@lpts007 <br \/>@superrichman <br \/>\u53ea\u4f1a python \u4e0d\u4f1a sql \u554a<br \/>\u6b63\u786e\u7684\u8bed\u53e5\u600e\u4e48\u5199\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5281468\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lpts007 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @python30 \u53ea\u4f1a python \uff1f\u8bf4\u8fd9\u79cd\u8bdd\u4f60\u662f\u8ba4\u771f\u7684\uff1f<\/p>\n<p>\u4f60\u5148\u770b\u4e0b\u4f60\u8fd9\u4e2a\u51fd\u6570\u6709\u51e0\u4e2a sql \u8bed\u53e5\uff0c\u7136\u540e\u60f3\u4e00\u4e0b\u4e3a\u4ec0\u4e48\u7b2c\u4e00\u4e2a\u4e0d\u62a5\u9519\uff0c\u518d\u4eff\u7167\u7b2c\u4e00\u4e2a\u5199\u4e0d\u5c31\u884c\u4e86\u5417\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5281469\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jeeyong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @lpts007 \u6211\u4e0d\u7ba1\u6211\u4e0d\u7ba1, \u5582\u7ed9\u6211, \u5582\u7ed9\u6211&#8230;.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5281470\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ErwinCheung <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e0d\u7ba1\u6211\u4e0d\u7ba1, \u5582\u7ed9\u6211, \u5582\u7ed9\u6211&#8230;.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5281471\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : nuistzhou <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u6765\u662f\u4e2a\u5c0f newbee\uff0c \u4f60\u4e0b\u9762\u7684\u90a3\u53e5 update \u7684 sql \u8bed\u53e5\u8981\u653e\u5728 execute \u51fd\u6570\u91cc\u6267\u884c\u7684\uff0c\u800c\u4e14\u662f\u4f5c\u4e3a\u5b57\u7b26\u4e32\u4f20\u5165\u7684\uff0c\u6240\u4ee5\u8fd8\u5f97\u52a0\u5f15\u53f7\u3002\u5c31\u50cf\u4f60\u4e0a\u9762\u7b2c\u4e00\u53e5 sql \u8bed\u53e5\u4e00\u6837\u3002\u76f2\u731c\u524d\u534a\u90e8\u5206\u4ee3\u7801\u662f\u4f60 ctl<br \/>c + v \u8fc7\u6765\u7684\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5281472\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : python30 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @nuistzhou <br \/>@lpts007 <br \/>\u4eff\u4e86\u3002\u6b63\u5728\u8c03\u8bd5\u3002\u8c22\u8c22                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5281473\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : deplives <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u73b0\u5728\u8bf4 \u4f1a python \u7684\u95e8\u69db\u771f\u4f4e\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>scrapy \u91c7\u96c6\u5165\u4e3a\u5e93 mysq&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\/342922"}],"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=342922"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/342922\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=342922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=342922"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=342922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}