{"id":132569,"date":"2024-03-25T23:44:30","date_gmt":"2024-03-25T14:44:30","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/"},"modified":"2024-04-04T17:39:48","modified_gmt":"2024-04-04T08:39:48","slug":"mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/","title":{"rendered":"MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b"},"content":{"rendered":"<p>MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u89e3\u6790\u3059\u308b\u306b\u306f\u3001\u307e\u305aPython\u306emshtml\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"hljs-keyword\">import<\/span> mshtml\r\n<\/code><\/pre>\n<p>\u6b21\u306b\u3001mshtml\u30e2\u30b8\u30e5\u30fc\u30eb\u306eHTMLDocument\u30af\u30e9\u30b9\u3092\u4f7f\u7528\u3057\u3066\u3001HTML\u30da\u30fc\u30b8\u3092\u89e3\u6790\u3067\u304d\u307e\u3059\u3002\u307e\u305a\u3001HTML\u30da\u30fc\u30b8\u3092HTMLDocument\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u30ed\u30fc\u30c9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>html = <span class=\"hljs-string\">\"\"\"\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;title&gt;Example Page&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;h1&gt;Welcome&lt;\/h1&gt;\r\n&lt;p&gt;This is an example page.&lt;\/p&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n\"\"\"<\/span>\r\ndoc = mshtml.HTMLDocument()\r\ndoc.write(html)\r\n<\/code><\/pre>\n<p>HTMLDocument\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u3063\u3066\u3001HTML\u8981\u7d20\u306e\u30a2\u30af\u30bb\u30b9\u3068\u64cd\u4f5c\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u4f8b\u3048\u3070\u3001\u30da\u30fc\u30b8\u306e\u30bf\u30a4\u30c8\u30eb\u3092\u53d6\u5f97\u3059\u308b\u306b\u306fget_title\u30e1\u30bd\u30c3\u30c9\u304c\u5229\u7528\u3067\u304d\u307e\u3059\uff1a<\/p>\n<pre class=\"post-pre\"><code>title = doc.get_title()\r\n<span class=\"hljs-built_in\">print<\/span>(title)  <span class=\"hljs-comment\"># Output: Example Page<\/span>\r\n<\/code><\/pre>\n<p>getElementsByTagName\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u30da\u30fc\u30b8\u5185\u306eh1\u898b\u51fa\u3057\u3068p\u6bb5\u843d\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>h1 = doc.getElementsByTagName(<span class=\"hljs-string\">'h1'<\/span>)[<span class=\"hljs-number\">0<\/span>].innerHTML\r\np = doc.getElementsByTagName(<span class=\"hljs-string\">'p'<\/span>)[<span class=\"hljs-number\">0<\/span>].innerHTML\r\n<span class=\"hljs-built_in\">print<\/span>(h1)  <span class=\"hljs-comment\"># Output: Welcome<\/span>\r\n<span class=\"hljs-built_in\">print<\/span>(p)   <span class=\"hljs-comment\"># Output: This is an example page.<\/span>\r\n<\/code><\/pre>\n<p>HTML \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u5168\u4f53\u3092\u53cd\u5fa9\u51e6\u7406\u3057\u3001\u7279\u5b9a\u306e\u7a2e\u985e\u306e\u8981\u7d20\u3092\u691c\u7d22\u3057\u3066\u305d\u308c\u3089\u3092\u64cd\u4f5c\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001\u6b21\u306e\u30b3\u30fc\u30c9\u306f\u3001\u3059\u3079\u3066\u306e\u30ea\u30f3\u30af\u3092\u691c\u7d22\u3057\u3066\u3001\u305d\u308c\u3089\u306e\u30c6\u30ad\u30b9\u30c8\u3068 URL \u3092\u5370\u5237\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>links = doc.getElementsByTagName(<span class=\"hljs-string\">'a'<\/span>)\r\n<span class=\"hljs-keyword\">for<\/span> link <span class=\"hljs-keyword\">in<\/span> links:\r\ntext = link.innerHTML\r\nurl = link.href\r\n<span class=\"hljs-built_in\">print<\/span>(text, url)\r\n<\/code><\/pre>\n<p>\u3053\u308c\u306f MSHTML\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u6a5f\u80fd\u306e\u4e00\u90e8\u306b\u904e\u304e\u305a\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u3001\u4ed6\u306e\u30e1\u30bd\u30c3\u30c9\u3084\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f7f\u7528\u3057\u3066HTML\u30da\u30fc\u30b8\u3092\u89e3\u6790\u3001\u64cd\u4f5c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u89e3\u6790\u3059\u308b\u306b\u306f\u3001\u307e\u305aPython\u306emshtml\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002 import mshtml \u6b21\u306b\u3001mshtml\u30e2\u30b8\u30e5\u30fc\u30eb\u306eHTMLDocument\u30af\u30e9\u30b9\u3092\u4f7f\u7528\u3057\u3066\u3001HTML\u30da\u30fc\u30b8 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-132569","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/mshtml\u3067html\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b\" \/>\n<meta property=\"og:description\" content=\"MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u89e3\u6790\u3059\u308b\u306b\u306f\u3001\u307e\u305aPython\u306emshtml\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002 import mshtml \u6b21\u306b\u3001mshtml\u30e2\u30b8\u30e5\u30fc\u30eb\u306eHTMLDocument\u30af\u30e9\u30b9\u3092\u4f7f\u7528\u3057\u3066\u3001HTML\u30da\u30fc\u30b8 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/mshtml\u3067html\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-25T14:44:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-04T08:39:48+00:00\" \/>\n<meta name=\"author\" content=\"\u967d, \u5411\u5b87\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u967d, \u5411\u5b87\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/\",\"name\":\"MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2024-03-25T14:44:30+00:00\",\"dateModified\":\"2024-04-04T08:39:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4aef6196128551a0f5d66db46c42866c\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4aef6196128551a0f5d66db46c42866c\",\"name\":\"\u967d, \u5411\u5b87\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ad96b120e219751fa368cbd7d2c48ca01b59185e6ed394449bac72614a760bf3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ad96b120e219751fa368cbd7d2c48ca01b59185e6ed394449bac72614a760bf3?s=96&d=mm&r=g\",\"caption\":\"\u967d, \u5411\u5b87\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/hinatasora\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/mshtml\u3067html\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b\/","og_locale":"ja_JP","og_type":"article","og_title":"MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b","og_description":"MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u89e3\u6790\u3059\u308b\u306b\u306f\u3001\u307e\u305aPython\u306emshtml\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u307e\u3059\u3002 import mshtml \u6b21\u306b\u3001mshtml\u30e2\u30b8\u30e5\u30fc\u30eb\u306eHTMLDocument\u30af\u30e9\u30b9\u3092\u4f7f\u7528\u3057\u3066\u3001HTML\u30da\u30fc\u30b8 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/mshtml\u3067html\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2024-03-25T14:44:30+00:00","article_modified_time":"2024-04-04T08:39:48+00:00","author":"\u967d, \u5411\u5b87","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u967d, \u5411\u5b87","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"1\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/","name":"MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2024-03-25T14:44:30+00:00","dateModified":"2024-04-04T08:39:48+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4aef6196128551a0f5d66db46c42866c"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"MSHTML\u3067HTML\u30da\u30fc\u30b8\u3092\u30d1\u30fc\u30b9\u3059\u308b"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/4aef6196128551a0f5d66db46c42866c","name":"\u967d, \u5411\u5b87","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ad96b120e219751fa368cbd7d2c48ca01b59185e6ed394449bac72614a760bf3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ad96b120e219751fa368cbd7d2c48ca01b59185e6ed394449bac72614a760bf3?s=96&d=mm&r=g","caption":"\u967d, \u5411\u5b87"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/hinatasora\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/mshtml%e3%81%a7html%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%83%91%e3%83%bc%e3%82%b9%e3%81%99%e3%82%8b\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/132569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=132569"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/132569\/revisions"}],"predecessor-version":[{"id":285803,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/132569\/revisions\/285803"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=132569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=132569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=132569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}