{"categories":["python"],"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftakuya-1st.hatenablog.jp%2Fentry%2F2017%2F03%2F30%2F013134\" title=\"python\u3067HTML\u3092\u30d1\u30fc\u30b9\u3057\u3066Xpath\u3059\u308b - \u305d\u308c\u30de\u30b0\u3067\uff01\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","height":"190","description":"python \u3067\u3082 xpath \u3057\u305f\u3044\u3002 libxml \u3067\u30d1\u30fc\u30b9\u3059\u308b\u306b\u306f\u3001lxml \u3092\u4f7f\u3046\u3068\u697d pip install lxml \u4f7f\u3044\u65b9\u3002 lxml.html \u3092\u4f7f\u3046\u3068\u78ba\u5b9f\u306b\u3001\u30d1\u30fc\u30b9\u3059\u308b\u4e8b\u304c\u3067\u304d\u308b\u3002parse \u306f IO \u3092\u53d6\u308b\u306e\u3067StringIO\u3092\u4f7f\u3046\u3053\u3068\u306b\u306a\u308b\u3002 lxml.html.parse(StringIO(page.html)) \u30b5\u30f3\u30d7\u30eb import lxml.html from io import StringIO, BytesIO def parse( node , idx ) : name = node.xpath(\".//*[@class='desc-title']//tex\u2026","author_url":"https://blog.hatena.ne.jp/takuya_1st/","blog_title":"\u305d\u308c\u30de\u30b0\u3067\uff01","provider_url":"https://hatena.blog","type":"rich","provider_name":"Hatena Blog","published":"2017-03-30 01:31:34","author_name":"takuya_1st","url":"https://takuya-1st.hatenablog.jp/entry/2017/03/30/013134","blog_url":"https://takuya-1st.hatenablog.jp/","version":"1.0","image_url":null,"title":"python\u3067HTML\u3092\u30d1\u30fc\u30b9\u3057\u3066Xpath\u3059\u308b","width":"100%"}