{"id":763,"date":"2022-05-29T23:01:09","date_gmt":"2022-05-29T14:01:09","guid":{"rendered":"https:\/\/blog.srytk.com\/aquei\/?p=763"},"modified":"2022-05-29T23:01:11","modified_gmt":"2022-05-29T14:01:11","slug":"tver%e3%81%ae%e6%96%b0%e7%9d%80%e7%95%aa%e7%b5%84%e3%82%92rss%e3%81%a7%e8%a6%8b%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.srytk.com\/aquei\/763.html","title":{"rendered":"TVer\u306e\u65b0\u7740\u756a\u7d44\u3092RSS\u3067\u898b\u308b"},"content":{"rendered":"\n<p>\u65e5\u672c\u306e\u30c6\u30ec\u30d3\u653e\u9001\u306e\u516c\u5f0f\u898b\u9003\u3057\u914d\u4fe1\u3092\u884c\u3063\u3066\u3044\u308b<a href=\"https:\/\/tver.jp\/\">TVer<\/a>\u3068\u3044\u3046\u30b5\u30fc\u30d3\u30b9\u304c\u3042\u308b\u3002\u6bce\u65e5\u305f\u304f\u3055\u3093\u306e\u756a\u7d44\u3084\u30a8\u30d4\u30bd\u30fc\u30c9\u304c\u8ffd\u52a0\u3055\u308c\u308b\u305f\u3081\u65b0\u7740\u3092\u6f0f\u308c\u306a\u304f\u30c1\u30a7\u30c3\u30af\u3059\u308b\u306b\u306f\u516c\u5f0f\u30b5\u30a4\u30c8\u3067\u306f\u307b\u307c\u4e0d\u53ef\u80fd\u3068\u8a00\u3063\u3066\u3088\u3044\u72b6\u6cc1\u306b\u306a\u3063\u3066\u3044\u308b\u3002<br>\u300c\u30de\u30a4\u30da\u30fc\u30b8\u300d\u3084\u300c\u304a\u6c17\u306b\u5165\u308a\u300d\u3001\u300c\u5f8c\u3067\u898b\u308b\u300d\u7b49\u306e\u6a5f\u80fd\u304c\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u304a\u305d\u3089\u304fYouTube\u7684\u306a\u4f7f\u3044\u65b9\u3092\u60f3\u5b9a\u3057\u3066\u3044\u308b\u3068\u601d\u308f\u308c\u308b\u3002\u3057\u304b\u3057\u3001\u751f\u307e\u308c\u3066\u3053\u306e\u65b9\u3001\u30c6\u30ec\u30d3\u3068\u5171\u306b\u751f\u304d\u3066\u304d\u305f\u751f\u7c8b\u306e\u30c6\u30ec\u30d3\u3063\u5b50\uff08\u6b7b\u8a9e\uff09\u3068\u3057\u3066\u306f\u65b0\u7740\u306f\u3059\u3079\u3066\u628a\u63e1\u3057\u3066\u304a\u304d\u305f\u3044\u3002\u306a\u306b\u3088\u308a\u3001\u8840\u304c\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u6c42\u3081\u3066\u3044\u308b\u2026\u308f\u3051\u3067\u306f\u306a\u304f\u3001\u3046\u3063\u304b\u308a\u898b\u843d\u3068\u3057\u305f\u308a\u3001\u65b0\u7740\u3092\u8abf\u3079\u308b\u305f\u3081\u306b\u4f55\u5ea6\u3082\u30b5\u30a4\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u306e\u304c\u9762\u5012\u306a\u306e\u3060\u3002<\/p>\n\n\n\n<p>\u305d\u3053\u3067\u4ee5\u524d\u306fTVer\u306e\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u3092\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u3057\u3066RSS\u3067\u51fa\u529b\u3057\u3001RSS\u30ea\u30fc\u30c0\u30fc\u3067\u65b0\u7740\u306e\u7ba1\u7406\u3092\u3057\u3066\u3044\u305f\u306e\u3060\u304c\u3001\u4eca\u6625\u306bTVer\u306e\u6539\u4fee\u304c\u884c\u308f\u308c\u3066\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u304c\u5931\u6557\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002\u305d\u3053\u3067TVer\u306e\u516c\u5f0fTwitter\u30a2\u30ab\u30a6\u30f3\u30c8( @<a href=\"https:\/\/twitter.com\/TVer_official\">TVer_official<\/a> )\u304c\u65b0\u7740\u3092\u5ef6\u3005\u3068\u5410\u304d\u51fa\u3059BOT\u3060\u3063\u305f\u306e\u3067\u3001\u3053\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u3092RSS\u30ea\u30fc\u30c0\u30fc\u3067\u30c1\u30a7\u30c3\u30af\u3057\u3066\u51cc\u3044\u3067\u304d\u305f\u3002\u3057\u304b\u3057\u3001\u5148\u65e5\u304b\u3089\u30c9\u30e9\u30de\u51fa\u6f14\u8005\u3084\u30a2\u30cb\u30e1\u58f0\u512a\u306e\u8a95\u751f\u65e5\u304c\u3069\u3046\u306e\u3053\u3046\u306e\u3068\u3044\u3046\u30c4\u30a4\u30fc\u30c8\u3057\u304b\u3057\u306a\u3044\u3001\u305f\u3060\u306e\u5ba3\u4f1d\u30a2\u30ab\u30a6\u30f3\u30c8\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u3002\u8ab0\u3082\u5f97\u3057\u306a\u3044\u3001\u3072\u3069\u3044\u6539\u60aa\u3067\u3042\u308b\u3002<\/p>\n\n\n\n<p>\u3057\u304b\u305f\u306a\u304fRSS\u3092\u81ea\u524d\u3067\u7528\u610f\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u306e\u3060\u304c\u3001\u65b0\u3057\u3044TVer\u306fAPI\u30a2\u30af\u30bb\u30b9\u306b\u30c8\u30fc\u30af\u30f3\u304c\u5fc5\u8981\u3089\u3057\u304f\u3081\u3093\u3069\u304f\u3055\u305d\u3046\u3060\u3063\u305f\u3002\u3061\u3089\u3063\u3068\u691c\u7d22\u3057\u3066\u307f\u308b\u3068\u300c<a href=\"https:\/\/egg.5ch.net\/test\/read.cgi\/tvsaloon\/1649325664\/246\">TVer(\u30c6\u30a3\u30fc\u30d0\u30fc)\u306b\u3064\u3044\u3066\u8a9e\u308d\u3046 part5<\/a>\u300d\u3068\u3044\u30465\u3061\u3083\u3093\u306d\u308b\u306e\u30b9\u30ec\u30c3\u30c9\u306b\u5927\u5909\u6709\u7528\u306a\u66f8\u304d\u8fbc\u307f\u304c\u3042\u3063\u305f\u3002\u305d\u306e\u66f8\u304d\u8fbc\u307f\u3092\u53c2\u8003\u306bRSS\u3092\u51fa\u529b\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u3044\u305f\u3002\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u79c1\u3068\u540c\u3058\u304f\u751f\u7c8b\u306e\u30c6\u30ec\u30d3\u3063\u5b50\u306e\u305f\u3081\u306b\u3053\u3053\u306b\u516c\u958b\u3057\u3066\u304a\u304f\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/feeds.feedburner.com\/srytk\/XPdv\">https:\/\/feeds.feedburner.com\/srytk\/XPdv<\/a><\/p>\n\n\n\n<p>\u3053\u306eURL\u3092RSS\u30ea\u30fc\u30c0\u30fc\u306b\u767b\u9332\u3059\u308b\u3068\u65b0\u7740\u304c\u5ef6\u3005\u3068\u6d41\u308c\u3066\u304f\u308b\u3001\u3068\u601d\u3046\u3002\u3042\u3068\u5927\u6614\u306b\u66f8\u3044\u305f\u3082\u306e\u3092\u3082\u3068\u306b\u3057\u3066\u3044\u308b\u306e\u3067\u3050\u3061\u3083\u3050\u3061\u3083\u3060\u304c\u3001\u4e3b\u8981\u90e8\u5206\u306e\u30b3\u30fc\u30c9\u3092\u8f09\u305b\u3066\u304a\u304f\u3002cache-control\u3092\u8a2d\u5b9a\u3059\u308b\u90e8\u5206\u306f\u7701\u3044\u305f\u3002<\/p>\n\n\n\n<pre><code>&lt;?PHP\nnamespace tverrss;\n\n\/\/tver api end point\nconst TVER_CREATE = &apos;https:\/\/platform-api.tver.jp\/v2\/api\/platform_users\/browser\/create&apos;;\nconst TVER_SEARCH = &apos;https:\/\/platform-api.tver.jp\/service\/api\/v1\/callSearch&apos;;\n\n\/\/User-Agent\nconst UA = &apos;Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko\/20100101 Firefox\/100.0&apos;;\nconst CURL_TIMEOUT = 10000; #\u30df\u30ea\u79d2\n\n\/\/curl\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u30aa\u30d7\u30b7\u30e7\u30f3\nconst CURL_OPTIONS = [\n\tCURLOPT_FAILONERROR =&gt; True,\n\tCURLOPT_FOLLOWLOCATION =&gt; True,\n\tCURLOPT_RETURNTRANSFER =&gt; True,\n\tCURLOPT_CONNECTTIMEOUT_MS =&gt; CURL_TIMEOUT,\n\tCURLOPT_MAXREDIRS =&gt; 5,\n\tCURLOPT_TIMEOUT_MS =&gt; CURL_TIMEOUT,\n\tCURLOPT_USERAGENT =&gt; UA,\n];\n\nconst RSS2HEAD = &lt;&lt;&lt;&apos;HEAD&apos;\n&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;rss version=&quot;2.0&quot;&gt;\n&lt;channel&gt;\n&lt;title&gt;TVer\u306e\u756a\u7d44\u65b0\u7740\u30ea\u30b9\u30c8&lt;\/title&gt;\n&lt;link&gt;https:\/\/tver.jp\/&lt;\/link&gt;\n&lt;description&gt;tver.jp\u306eapi\u304b\u3089\u65b0\u7740\u3092\u304a\u77e5\u3089\u305b\u3057\u307e\u3059&lt;\/description&gt;\n&lt;language&gt;ja-jp&lt;\/language&gt;\nHEAD;\n\nconst RSS2FOOT = &lt;&lt;&lt;&apos;FOOT&apos;\n&lt;\/channel&gt;\n&lt;\/rss&gt;\nFOOT;\n\n\nfunction is_valid_url($url){\n    return false !== filter_var($url, FILTER_VALIDATE_URL) &amp;&amp; 0 === strpos($url, &quot;https:\/\/&quot;);\n}\n\nfunction h($s){\n\tif($s &amp;&amp; is_string($s)){\n\t\treturn htmlspecialchars($s, ENT_QUOTES|ENT_XML1);\n\t}else{\n\t\treturn &quot;&quot;;\n\t}\n}\n\nfunction dl(string $url, array $options=[]){\n\t\n\tif(!is_valid_url($url)){\n\t\tthrow new \\Exception(&quot;\u7121\u52b9\u306aURL&quot;);\n\t}\n\t\n\t$options = array_replace(CURL_OPTIONS, $options);\n\t$options[CURLOPT_URL] = $url;\n\n\t$ch = curl_init();\n\tcurl_setopt_array($ch, $options);\n\n\t$result = curl_exec($ch);\n\n\tif($result === False){\n\t\techo curl_error($ch);\n\t}\n\n\tcurl_close($ch);\n\n\treturn $result;\n}\n\nfunction create_userdata(){\n\tstatic $userdata = [];\n\n\tif ($userdata) {\n\t\treturn $userdata;\n\t}\n\n\t#\u65b0\u3057\u304fuser\u767b\u9332\n\t$options = [\n\t\tCURLOPT_POST =&gt; True,\n\t\tCURLOPT_POSTFIELDS =&gt; &apos;device_type=pc&apos;,\n\t\tCURLOPT_HTTPHEADER =&gt; [&apos;Accept: *\/*&apos;, &apos;Referer: https:\/\/s.tver.jp\/&apos;, &apos;Origin: https:\/\/s.tver.jp&apos;, &apos;Content-Type: application\/x-www-form-urlencoded&apos;, &apos;Connection: keep-alive&apos;, &apos;Sec-Fetch-Dest: empty&apos;, &apos;Sec-Fetch-Mode: cors&apos;, &apos;Sec-Fetch-Site: same-site&apos;],\n\t];\n\n\t$json = dl(TVER_CREATE, $options);\n\n\tif ($json){\n\t\t$data = json_decode($json, true);\n\t\t$userdata = $data[&quot;result&quot;];\n\t}\n\n\treturn $userdata;\n}\n\n\nfunction get_list(){\n\t$userdata = create_userdata();\n\t$query = http_build_query([\n\t\t&apos;platform_uid&apos; =&gt; $userdata[&apos;platform_uid&apos;],\n\t\t&apos;platform_token&apos; =&gt; $userdata[&apos;platform_token&apos;],\n\t\t&apos;keyword&apos; =&gt; &apos;&apos;,\n\t\t&apos;require_data&apos; =&gt; &apos;later&apos;,\n\t]);\n\n\t$url = TVER_SEARCH . &quot;?{$query}&quot;;\n\n\t$header = [\n\t\tCURLOPT_HTTPHEADER =&gt; [&apos;x-tver-platform-type: web&apos;],\n\t];\n\n\t$json = json_decode(dl($url, $header), true);\n\t\n\treturn $json[&quot;result&quot;][&quot;contents&quot;];\n}\n\nfunction get_rss2(array $data, int $max=100){\n\t$rss_head = RSS2HEAD;\n\t$rss_foot = RSS2FOOT;\n\t$items = &quot;&quot;;\n\t$count = 0;\n\n\tforeach($data as $d){\n\t\tif ($count &gt;= $max){\n\t\t\tbreak;\n\t\t}\n\t\t$count = $count + 1;\n\t\t$content = $d[&quot;content&quot;];\n\n\t\tif (!$content[&quot;isAvailable&quot;]) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t$title = h($content[&quot;title&quot;]);\n\t\t$series_title  = h($content[&quot;seriesTitle&quot;]);\n\t\t$id = h($content[&quot;id&quot;]);\n\t\t$version = h($content[&quot;version&quot;]);\n\t\tif (!$version) {\n\t\t\t$version = 5;\n\t\t}\n\t\tif (isset($content[&quot;broadcastDateLabel&quot;])){\n\t\t\t$date = h($content[&quot;broadcastDateLabel&quot;]);\n\t\t}else{\n\t\t\t$date = &quot;unknown&quot;;\n\t\t}\n\t\t$provider = h($content[&quot;productionProviderName&quot;]);\n\t\t$url = &quot;https:\/\/tver.jp\/episodes\/{$id}&quot;;\n\n\t\t$long_title = &quot;{$provider} - {$series_title} - {$title}&quot;;\n\t\t$images_tag = &quot;&lt;img src=&apos;https:\/\/statics.tver.jp\/images\/content\/thumbnail\/episode\/small\/{$id}.jpg?v={$version}&apos; alt=&apos;{$title}&apos;\/&gt;&quot;;\n\n\t\t$description = &lt;&lt;&lt;DESC\n&lt;a href=&quot;{$url}&quot;&gt;{$images_tag}&lt;\/a&gt;&lt;br\/&gt;\n&lt;h2&gt;&lt;a href=&quot;{$url}&quot;&gt;{$series_title} - {$title}&lt;\/a&gt;&lt;\/h2&gt;\nDESC;\n\t\t$description = h($description);\n\t\t$items .= &lt;&lt;&lt;EOD\n&lt;item&gt;\n&lt;title&gt;{$long_title}&lt;\/title&gt;\n&lt;link&gt;{$url}&lt;\/link&gt;\n&lt;guid isPermaLink=&quot;true&quot;&gt;{$url}&lt;\/guid&gt;\n&lt;description&gt;{$description}&lt;\/description&gt;\n&lt;\/item&gt;\nEOD;\n\t}\n\n\treturn &lt;&lt;&lt;EOC\n{$rss_head}\n{$items}\n{$rss_foot}\nEOC;\n}\n\nfunction rss_header(){\n\theader(&apos;Content-Type: application\/rss+xml&apos;);\n}\n\nfunction main(){\n\t$list = get_list();\n\trss_header();\n\techo get_rss2($list);\n}\n\nmain();<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u65e5\u672c\u306e\u30c6\u30ec\u30d3\u653e\u9001\u306e\u516c\u5f0f\u898b\u9003\u3057\u914d\u4fe1\u3092\u884c\u3063\u3066\u3044\u308bTVer\u3068\u3044\u3046\u30b5\u30fc\u30d3\u30b9\u304c\u3042\u308b\u3002\u6bce\u65e5\u305f\u304f\u3055\u3093\u306e\u756a\u7d44\u3084\u30a8\u30d4\u30bd\u30fc\u30c9\u304c\u8ffd\u52a0\u3055\u308c\u308b\u305f\u3081\u65b0\u7740\u3092\u6f0f\u308c\u306a\u304f\u30c1\u30a7\u30c3\u30af\u3059\u308b\u306b\u306f\u516c\u5f0f\u30b5\u30a4\u30c8\u3067\u306f\u307b\u307c\u4e0d\u53ef\u80fd\u3068\u8a00\u3063\u3066\u3088\u3044\u72b6\u6cc1\u306b\u306a\u3063\u3066\u3044\u308b\u3002\u300c\u30de\u30a4\u30da\u30fc\u30b8\u300d\u3084 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"local","activitypub_max_image_attachments":5,"footnotes":""},"categories":[4],"tags":[182,88,7],"class_list":["post-763","post","type-post","status-publish","format-standard","hentry","category-4","tag-php","tag-rss","tag-tver"],"_links":{"self":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/comments?post=763"}],"version-history":[{"count":1,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/763\/revisions"}],"predecessor-version":[{"id":764,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/763\/revisions\/764"}],"wp:attachment":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/media?parent=763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/categories?post=763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/tags?post=763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}