{"id":298,"date":"2018-11-14T21:20:48","date_gmt":"2018-11-14T13:20:48","guid":{"rendered":"http:\/\/www.eait.co\/?p=298"},"modified":"2018-11-14T21:20:48","modified_gmt":"2018-11-14T13:20:48","slug":"%e5%87%a0%e8%a1%8cpython%e4%bb%a3%e7%a0%81%e8%8e%b7%e5%8f%96%e8%b1%86%e7%93%a3%e5%9b%be%e7%89%87%e6%89%b9%e9%87%8f%e4%b8%8b%e8%bd%bd","status":"publish","type":"post","link":"https:\/\/notes.coremix.net\/?p=298","title":{"rendered":"\u51e0\u884cpython\u4ee3\u7801\u83b7\u53d6\u8c46\u74e3\u56fe\u7247\u6279\u91cf\u4e0b\u8f7d"},"content":{"rendered":"<pre>import requests\r\nfrom bs4 import BeautifulSoup\r\nimport urllib.request\r\nimport lxml\r\nx = 1\r\n#\u83b7\u53d6\u8c46\u74e3\u7f51\u59b9\u5b50\u56fe\u7247\r\ndef getGirlsImage(page = 1):\r\n    url = \"https:\/\/www.dbmeinv.com\/dbgroup\/show.htm?cid=4&amp;pager_offset={}\".format(page)\r\n    #\u6b64\u51fd\u6570\u5728url\u4e2d\u4f20\u5165page,\u7528\u6765\u7ffb\u9875\r\n    response = requests.get(url)\r\n    html = response.text\r\n    #\u521b\u5efa\u5bf9\u8c61,\u89e3\u6790\u7f51\u9875lxml\r\n    soup = BeautifulSoup(html,\"html.parser\")\r\n    girl = soup.find_all(\"img\")\r\n\r\n    for i in girl:\r\n        global x #\u6b64\u5904\u8981\u7528\u5168\u5c40\u53d8\u91cf\r\n        imgsrc = i.get((\"src\"))\r\n\r\n        print(\"\u6b63\u5728\u4e0b\u8f7d{}\".format(x))\r\n        urllib.request.urlretrieve(imgsrc,'C:\/image\/%s.jpg'%x)\r\n        x+=1\r\n\r\n#\u4e0b\u8f7d\u56fe\u7247\r\ndef download():\r\n    for i in range(1,11):\r\n        print('\u6b63\u5728\u4e0b\u8f7d\u7b2c{}\u9875\u56fe\u7247'.format(i))\r\n\r\n        getGirlsImage(i)\r\ndownload()<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>import requests from bs4 import BeautifulSoup import ur [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[12],"class_list":["post-298","post","type-post","status-publish","format-standard","hentry","category-python","tag-it"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=298"}],"version-history":[{"count":1,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/298\/revisions"}],"predecessor-version":[{"id":299,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/298\/revisions\/299"}],"wp:attachment":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}