{"id":18124,"date":"2026-05-26T11:20:09","date_gmt":"2026-05-26T09:20:09","guid":{"rendered":"https:\/\/www.beseit.net\/?p=18124"},"modified":"2026-05-28T19:15:57","modified_gmt":"2026-05-28T17:15:57","slug":"llistres-de-reproduccio-de-youtube","status":"publish","type":"post","link":"https:\/\/www.beseit.net\/?p=18124","title":{"rendered":"Llistres de reproduccio de Youtube"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">YouTube permet visualitzar d&#8217;un cop 10, 30, 50 llistas. si tens mes de 50 la creaci\u00f3 de totes.htm sa de fer en fases totes1-50.htm, totes51-100.htm &#8230;fins aconseguir un totes.htm que contingui les nostres llistes per example 154 llistes. un cop es t\u00e9 el fitxer es fa el proc\u00e9s descrit.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1 salvar les llistes (pegades previament de youtube studio\/contingut\/llistes de reproducci\u00f3) a un document en blanc de word a S:\/0-llistes_you_tube\/totes.htm<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"286\" src=\"https:\/\/www.beseit.net\/wp-content\/uploads\/2026\/05\/image-7-1024x286.png\" alt=\"\" class=\"wp-image-18125\" srcset=\"https:\/\/www.beseit.net\/wp-content\/uploads\/2026\/05\/image-7-1024x286.png 1024w, https:\/\/www.beseit.net\/wp-content\/uploads\/2026\/05\/image-7-300x84.png 300w, https:\/\/www.beseit.net\/wp-content\/uploads\/2026\/05\/image-7-768x215.png 768w, https:\/\/www.beseit.net\/wp-content\/uploads\/2026\/05\/image-7-500x140.png 500w, https:\/\/www.beseit.net\/wp-content\/uploads\/2026\/05\/image-7.png 1469w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2 Traure la brosa del word amb l&#8217;escript :<strong> <mark style=\"background-color:rgba(0, 0, 0, 0);color:#f60e0e\" class=\"has-inline-color\"><a href=\"http:\/\/192.168.1.41\/0-llistes_you_tube\/netejar_paragrafs.php\/\">netejar_paragrafs.php<\/a><\/mark><\/strong> i <mark style=\"background-color:rgba(0, 0, 0, 0);color:#f61313\" class=\"has-inline-color\">aconseguir totes_net.htm<\/mark><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\/**\n * netejar_paragrafs.php\n * ----------------------\n * Llegeix un fitxer HTML exportat de Word (totes.htm), neteja els par\u00e0grafs\n * i genera:\n *\n *   - totes_net.htm  \u2192 HTML net\n *   - linies.txt     \u2192 nom\u00e9s les l\u00ednies \"linia N, nom_llista, ID, data, v\u00eddeos\"\n *\/\n\n$input  = \"totes.htm\";\n$output = \"totes_net.htm\";\n$output2 = \"linies.txt\";\n\n$in  = fopen($input, \"r\");\n$out = fopen($output, \"w\");\n$out2 = fopen($output2, \"w\");\n\n$buffer   = \"\";\n$inside_p = false;\n\n$anterior_es_numeric = null;\n$linia = 1;\n$hist = [];\n\n\/* -------------------------------\n   FUNCIONS D\u2019EXTRACCI\u00d3\n--------------------------------*\/\n\n\/\/ Extreu ID de playlist\nfunction extreure_id_playlist($text) {\n    if (preg_match('\/playlist\\\/(PL[A-Za-z0-9_-]+)\/', $text, $m)) {\n        return $m[1];\n    }\n    return \"\";\n}\n\n\/\/ Extreu nom_llista (6 l\u00ednies amunt)\nfunction extreure_nom_llista($hist) {\n    $index = count($hist) - 6;\n    if ($index &lt; 0) return \"(sense nom)\";\n    return strip_tags(trim($hist[$index]));\n}\n\n\/\/ Extreu data_creacio (2 l\u00ednies amunt)\nfunction extreure_data_creacio($hist) {\n    $index = count($hist) - 2;\n    if ($index &lt; 0) return \"(sense data)\";\n    return strip_tags(trim($hist[$index]));\n}\n\n\/\/ Extreu nombre de v\u00eddeos (1 l\u00ednia amunt)\nfunction extreure_num_videos($hist) {\n    $index = count($hist) - 1;\n    if ($index &lt; 0) return \"(sense v\u00eddeos)\";\n\n    $txt = strip_tags(trim($hist[$index]));\n\n    if (preg_match('\/(\\d+)\/', $txt, $m)) {\n        return $m[1];\n    }\n\n    return \"(sense v\u00eddeos)\";\n}\n\n\/* -------------------------------\n   PROC\u00c9S PRINCIPAL\n--------------------------------*\/\n\nwhile (($line = fgets($in)) !== false) {\n\n    $line = trim($line);\n    if ($line === \"\") continue;\n\n    \/\/ --- PAR\u00c0GRAF EN UNA SOLA L\u00cdNIA ---\n    if (preg_match('\/&lt;p\\b\/i', $line) &amp;&amp; stripos($line, '&lt;\/p>') !== false) {\n\n        $clean = $line;\n\n        \/\/ Neteja Word\n        $clean = preg_replace('\/&lt;o:p>.*?&lt;\\\/o:p>\/i', '', $clean);\n        $clean = preg_replace('\/&lt;!--\\s*\n\n\\[if.*?\n\n\\[endif\\]\n\n\\s*-->\/is', '', $clean);\n        $clean = preg_replace('\/\\s*mso-[^=]+=\"[^\"]*\"\/i', '', $clean);\n        $clean = preg_replace('\/\\s*mso-[^\\s>]+\/i', '', $clean);\n        $clean = preg_replace('\/\\s+\/', ' ', $clean);\n\n        \/\/ Text del par\u00e0graf\n        if (preg_match('\/&lt;p[^>]*>(.*?)&lt;\\\/p>\/i', $clean, $m)) {\n            $text_actual = trim($m[1]);\n        } else {\n            $text_actual = \"\";\n        }\n\n        $actual_es_numeric = is_numeric($text_actual);\n\n        \/\/ --- INSERCI\u00d3 DE LINIA N COMPLETA ---\n        if ($anterior_es_numeric === true &amp;&amp; $actual_es_numeric === true) {\n\n            $id           = extreure_id_playlist($hist[count($hist) - 6] ?? \"\");\n            $nom_llista   = extreure_nom_llista($hist);\n            $data_creacio = extreure_data_creacio($hist);\n            $num_videos   = extreure_num_videos($hist);\n\n            $linia_txt = \"&lt;p>linia $linia, $nom_llista, $id, $data_creacio, $num_videos&lt;\/p>\";\n\n            fwrite($out, $linia_txt . \"\\n\");\n            $hist[] = $linia_txt;\n\n            $linia++;\n        }\n\n        fwrite($out, trim($clean) . \"\\n\");\n        $hist[] = trim($clean);\n\n        $anterior_es_numeric = $actual_es_numeric;\n        continue;\n    }\n\n    \/\/ --- INICI PAR\u00c0GRAF MULTI-L\u00cdNIA ---\n    if (preg_match('\/&lt;p\\b\/i', $line)) {\n        $inside_p = true;\n        $buffer   = $line;\n        continue;\n    }\n\n    \/\/ --- CONTINUACI\u00d3 PAR\u00c0GRAF MULTI-L\u00cdNIA ---\n    if ($inside_p) {\n\n        $buffer .= ' ' . $line;\n\n        if (stripos($line, '&lt;\/p>') !== false) {\n\n            $clean = $buffer;\n\n            \/\/ Neteja Word\n            $clean = preg_replace('\/&lt;o:p>.*?&lt;\\\/o:p>\/i', '', $clean);\n            $clean = preg_replace('\/&lt;!--\\s*\n\n\\[if.*?\n\n\\[endif\\]\n\n\\s*-->\/is', '', $clean);\n            $clean = preg_replace('\/\\s*mso-[^=]+=\"[^\"]*\"\/i', '', $clean);\n            $clean = preg_replace('\/\\s*mso-[^\\s>]+\/i', '', $clean);\n            $clean = preg_replace('\/\\s+\/', ' ', $clean);\n\n            if (preg_match('\/&lt;p[^>]*>(.*?)&lt;\\\/p>\/i', $clean, $m)) {\n                $text_actual = trim($m[1]);\n            } else {\n                $text_actual = \"\";\n            }\n\n            $actual_es_numeric = is_numeric($text_actual);\n\n            \/\/ --- INSERCI\u00d3 DE LINIA N COMPLETA ---\n            if ($anterior_es_numeric === true &amp;&amp; $actual_es_numeric === true) {\n\n                $id           = extreure_id_playlist($hist[count($hist) - 6] ?? \"\");\n                $nom_llista   = extreure_nom_llista($hist);\n                $data_creacio = extreure_data_creacio($hist);\n                $num_videos   = extreure_num_videos($hist);\n\n                $linia_txt = \"&lt;p>linia $linia, $nom_llista, $id, $data_creacio, $num_videos&lt;\/p>\";\n\n                fwrite($out, $linia_txt . \"\\n\");\n                $hist[] = $linia_txt;\n\n                $linia++;\n            }\n\n            fwrite($out, trim($clean) . \"\\n\");\n            $hist[] = trim($clean);\n\n            $anterior_es_numeric = $actual_es_numeric;\n\n            $inside_p = false;\n            $buffer   = \"\";\n        }\n\n        continue;\n    }\n}\n\nfclose($in);\nfclose($out);\n\n\/* -------------------------------\n   GENERAR linies.txt\n--------------------------------*\/\n\nforeach ($hist as $h) {\n    if (strpos($h, \"&lt;p>linia \") === 0) {\n        fwrite($out2, strip_tags($h) . \"\\n\");\n    }\n}\n\nfclose($out2);\n\necho \"Fitxers generats:\\n - $output\\n - $output2\\n\";\n?>\n<\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>3 traure la brosa script <a href=\"http:\/\/192.168.1.41\/0-llistes\/netejar_crlf.php\">192.168.1.4 1\/0-llistes\/netejar_crlf.php<\/a><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">entrada: llistes2.htm <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sortida: llista2_final_corregit.htm<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sortida taula:i <strong>N de v\u00eddeos<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>num<\/th><th>Llista de reproducci\u00f3<\/th><th>link<\/th><th>data de creaci\u00f3<\/th><th>N de v\u00eddeos<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td><a href=\"https:\/\/studio.youtube.com\/playlist\/PLiEjFzGbAzg5LJoS6BVP2E5Ikrb_yH8Jn\/edit\" target=\"_blank\" rel=\"noreferrer noopener\">llit al sostre<\/a><\/td><td><code>https:\/\/studio.youtube.com\/playlist\/PLiEjFzGbAzg5LJoS6BVP2E5Ikrb_yH8Jn\/edit<\/code><\/td><td>24 de maig 2026<\/td><td>8<\/td><\/tr><tr><td>2<\/td><td><a href=\"https:\/\/studio.youtube.com\/playlist\/PLiEjFzGbAzg7IwdXNiWRXeijQQAvbiuWs\/edit\" target=\"_blank\" rel=\"noreferrer noopener\">Eines: fusta<\/a><\/td><td><code>https:\/\/studio.youtube.com\/playlist\/PLiEjFzGbAzg7IwdXNiWRXeijQQAvbiuWs\/edit<\/code><\/td><td>23 de maig 2026<\/td><td>1<\/td><\/tr><tr><td>3<\/td><td><a href=\"https:\/\/studio.youtube.com\/playlist\/PLiEjFzGbAzg4W9eJ64PH-2fStoHf2e_DL\/edit\" target=\"_blank\" rel=\"noreferrer noopener\">Exercices<\/a><\/td><td><code>https:\/\/studio.youtube.com\/playlist\/PLiEjFzGbAzg4W9eJ64PH-2fStoHf2e_DL\/edit<\/code><\/td><td>22 de maig 2026<\/td><td>1<\/td><\/tr><tr><td>4<\/td><td><a href=\"https:\/\/studio.youtube.com\/playlist\/PLiEjFzGbAzg6aGE3BeBWBqTdfR7ByuAF0\/edit\" target=\"_blank\" rel=\"noreferrer noopener\">valvulas \/ orkli<\/a><\/td><td><code>https:\/\/studio.youtube.com\/playlist\/PLiEjFzGbAzg6aGE3BeBWBqTdfR7ByuAF0\/edit<\/code><\/td><td>21 de maig 2026<\/td><td>1<\/td><\/tr><tr><td>5<\/td><td><a href=\"https:\/\/studio.youtube.com\/playlist\/PLiEjFzGbAzg5C3w9VjzDKUzqwsl-QBEpo\/edit\" target=\"_blank\" rel=\"noreferrer noopener\">Persiana<\/a><\/td><td><code>https:\/\/studio.youtube.com\/playlist\/PLiEjFzGbAzg5C3w9VjzDKUzqwsl-QBEpo\/edit<\/code><\/td><td>20 de maig 2026<\/td><td>1<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>YouTube permet visualitzar d&#8217;un cop 10, 30, 50 llistas. si tens mes de 50 la creaci\u00f3 de totes.htm sa de fer en fases totes1-50.htm, totes51-100.htm &#8230;fins aconseguir un totes.htm que contingui les nostres llistes per example 154 llistes. un cop &hellip; <a href=\"https:\/\/www.beseit.net\/?p=18124\">Continua llegint <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":3167,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-18124","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bloc-de-notes"],"_links":{"self":[{"href":"https:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts\/18124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=18124"}],"version-history":[{"count":19,"href":"https:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts\/18124\/revisions"}],"predecessor-version":[{"id":18160,"href":"https:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/posts\/18124\/revisions\/18160"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.beseit.net\/index.php?rest_route=\/wp\/v2\/media\/3167"}],"wp:attachment":[{"href":"https:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.beseit.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}