{"id":21,"date":"2021-10-17T22:46:02","date_gmt":"2021-10-17T14:46:02","guid":{"rendered":"https:\/\/linguopeng.top\/?p=21"},"modified":"2021-10-19T10:23:38","modified_gmt":"2021-10-19T02:23:38","slug":"%e7%88%ac%e5%8f%96%e8%8d%af%e7%9b%91%e7%bd%91%e7%ab%99%e5%85%ac%e5%8f%b8%e5%90%8d%e5%bd%95","status":"publish","type":"post","link":"https:\/\/linguopeng.top\/?p=21","title":{"rendered":"\u722c\u53d6\u836f\u76d1\u7f51\u7ad9\u516c\u53f8\u540d\u5f55"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>##\u6211\u7684\u7f51\u76d8\/\u535a\u5ba2\u7d20\u6750\/\u722c\u53d6\u836f\u76d1\n#\u722c\u53d6\u836f\u76d1\u603b\u5c40\u5316\u5986\u54c1\u751f\u4ea7\u8bb8\u53ef\u4f01\u4e1a\u540d\u79f0\nfrom selenium import webdriver\nfrom time import sleep\nfrom lxml import etree\nurl = 'http:\/\/scxk.nmpa.gov.cn:81\/xk\/'\nbro = webdriver.Chrome(executable_path='.\/chromedriver')\nbro.get(url)\npage_text_list = &#91;] #\u6bcf\u4e00\u9875\u9875\u9762\u6e90\u7801\u6570\u636e\nsleep(1)\n#\u6355\u83b7\u5f53\u524d\u9875\u9762\u6e90\u7801\u6570\u636e\npage_text = bro.page_source\npage_text_list.append(page_text)\n#\u70b9\u51fb\u4e0b\u4e00\u9875\nfor i in range(3):\n    next_page = bro.find_element_by_xpath('\/\/*&#91;@id=\"pageIto_next\"]')\n    next_page.click()\n    sleep(1)\n    page_text_list.append(bro.page_source) #\u83b7\u53d6\u6bcf\u4e00\u9875\u9875\u9762\u6e90\u7801\u6570\u636e\nfor page_text in page_text_list:   #\u5bf9\u6bcf\u4e00\u9875\u9875\u9762\u6e90\u7801\u6570\u636e\u8fdb\u884c\u89e3\u6790\n    tree = etree.HTML(page_text)\n    li_list = tree.xpath('\/\/*&#91;@id=\"gzlist\"]\/li')\n    for li in li_list:\n        name = li.xpath('.\/dl\/@title')&#91;0]\n        time = li.xpath('.\/em\/@title')&#91;0]\n        print(name)\n        print(time)\nsleep(1)\nbro.quit()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/linguopeng.top\/wp-content\/uploads\/2021\/10\/1-7.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1644\" height=\"1301\" data-original=\"https:\/\/linguopeng.top\/wp-content\/uploads\/2021\/10\/1-7.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-79\"  sizes=\"auto, (max-width: 1644px) 100vw, 1644px\" \/><\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":79,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5],"class_list":["post-21","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-2","tag-python"],"_links":{"self":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts\/21","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=21"}],"version-history":[{"count":2,"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts\/21\/revisions"}],"predecessor-version":[{"id":80,"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts\/21\/revisions\/80"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/media\/79"}],"wp:attachment":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}