#author("2024-02-19T03:25:35+00:00","","")
#author("2024-02-19T03:27:48+00:00","","")
[[FrontPage]]

**[[平井の研究会]] [#x156ce8d]

**[[本論_ポスター]] [#x156ce8d]

**[[ファイル]] [#x156ce8d]
#ref(修士研究.zip,,プログラムファイル)

**[[平井のゼミ]] [#x156ce8d]

&ref(平井/BB8.gif,35%);
&ref(平井/B_yoda.gif,45%);


*B4 後期授業スケジュール [#b29b5943]

|>|>|>|>|>|CENTER:COLOR(white):BGCOLOR(red):|c
||&size(13){月曜日};|&size(13){火曜日};|&size(13){水曜日};|&size(13){木曜日};|&size(13){金曜日};|
|BGCOLOR(#5c5c5c):COLOR(white):|>|>|>|>|COLOR(white):BGCOLOR(white):CENTER:60|c
|BGCOLOR(#999999):COLOR(white):|>|>|>|>|COLOR(white):BGCOLOR(white):CENTER:60|c
|CENTER:&size(20){1-2};||||||
|CENTER:&size(20){3-4};||||||
|CENTER:&size(20){5-6};||||||
|CENTER:&size(20){7-8};|BGCOLOR(blue):&size(13){卒業研究1};|||||
|CENTER:&size(20){9-10};||||||
|CENTER:&size(20){11-12};||||||

*研究日誌 [#s8e2ce55]
#calendar2()

**[[専門ゼミ(平井)]] [#x156ce8d]
**[[引継ぎ・flask(清水)]] [#x156ce8d]
[[平井さんの卒業研究]]
**[[平井さん卒論]] [#kac48c42]

*章立て [#b29b5943]
#memo(タイトル: 特許情報からの文章のベクトル化を用いた3D有向グラフによる発想支援\n\nタイトル2: IPランドスケープによる経営戦略支援のための共起語ネットワーク作成\n\n\n\nタイトル3: IPランドスケープ支援のための特許情報のベクトル化を用いた共起語ネットワーク作成システム\n\n\n1.初めに\n1.1本研究の概要(1ページ)参考文献最低5個\n1.2本研究の目的(1ページ)参考文献最低5個\n1.3本論文の概要(1ページ)参考文献最低5個\n本研究の新規性について書く\n有用性について書く\n\n2.\n2.1.知的財産戦略(3ページ)参考文献最低5個\n2.2.特許情報処理(3ページ)参考文献最低5個\n2.3.自然言語処理(テキストマイニング)(3ページ)参考文献最低5個\n\n3.\n3.1.スクレイピングによる特許情報のベクトル化(3ページ)参考文献最低5個\n3.2.次元圧縮とクラスタリング手法(3ページ)参考文献最低5個\n3.3.単語間のつながりと共起ネットワーク(3ページ)参考文献最低5個\n\n4.提案手法\n4.1.Google Patentsからの取得,分類,抽出の高速化(3ページ)分散処理\n4.2.トピックからの3Dグラフによる可視化(3ページ)参考文献最低5個\n4.3.IPL(Intellectual Property Landscape)への活用(3ページ)参考文献最低5個\n\n5.数値実験並びに考察\n5.1(3ページ)\n5.2(3ページ)\n6.おわりに(1ページ)\n\n\n\n\n\n\n\nタイトル: \n1.初めに\n1.1本研究の概要\n1.2本研究の目的\n1.3本論文の概要\n本研究の新規性について書く\n有用性について書く\n\n2.従来の研究\n2.1.レビューデータ分析\n2.2.スクレイピングによるレビューデータの収集\n2.3.従来のトピックモデル(LDAなど)\n\n3.\n3.1.Sentence-BERTによる文章のベクトル化\n3.2.UMAPとHDBSCANによる文章ベクトルの圧縮とクラスタリング\n3.3.c-TF-IDFによるクラスタ毎の重要単語抽出\n\n4.提案手法\n4.1.スクレイピングによるレビューデータ収集\n4.2.BERTopicを用いたレビューのトピック推定\n4.3.トピックから地域の印象分析\n\n5.数値実験並びに考察\n6.おわりに\n\n\n\n\nタイトル: トピックモデルを用いた推薦\n\n1.初めに\n1.1本研究の概要\n1.2本研究の目的\n1.3本論文の概要\n本研究の新規性について書く\n有用性について書く\n\n2.従来の研究\n2.1.アイテム推薦\n2.2.評判におけるトピックモデルの適用\n2.3.評価と感情の関係\n\n3.\n3.1.文章の感情分析\n     (Bidirectional Encoder Representations from Transformers:BERT)\n3.2.文章の属性を考慮したトピックモデル\n    (Structured Topic Model:STM)\n3.3.特徴ベクトルから予測評価値計算\n\n\n4.提案手法\n4.1.\n4.2.\n4.3.\n\n\n5.数値実験並びに考察\n6.おわりに)

*メモ [#b29b5943]
#memo(散らばり具合\n産業別の分類\n\n共起ネットワーク\n\nクラスタリングの数\n ベイズ情報量基準(BIC)\n\n【知財戦略】\n≪IPランドスケープ≫\n「なぜ必要なのか」\n→コロナ化をはじめ,サステナビリティやESG(環境,会社,ガバナンス)の推進など,昨今の社会変化に手対応していくためには多面的な視点から経営戦略を策定することが不可欠,そこには攻めの知財情報活用であるIPランドスケープが有効である.加えて,コーポレートガバナンス・コードに初めて「知的財産」ということが入ったことも重要.これにより自社の経営課題に対して知財がどう貢献しているのかということを適切に開示する必要があるため,各企業でIPランドスケープが推進される大きなきっかけになる.\n\n「現状」\n→2021年に特許庁が公表した「経営戦略に資する知財情報分析・活用に関する調査研究」では国内企業等1,515者に対してアンケート調査を行い,IPランドスケープを実施し,その結果を経営層等に共有できていると答えた人は10%程だった.一方で,役80%がIPランドスケープは必要と答えており,「必要性はわかっているがなかなか実施に至らない」という企業が多い実態がわかる.\n\n「目的」\n→①現行事業の強化,②新規事業創出,③M&Aの候補先の調査\n★会社が持っている技術の利用価値を探るために「特許マップ」を作成したところ,競合他社はまだそこに目を向けていないことが分かった.\n\n★今後に向けてのディスカッション.世界のイノベーションをけん引するGAFAの特許解析データや自社の特許マップを作製したところ.気づきの連鎖が起き,たくさんのアイディアが生まれた.\n\n【知財報告書】\n\nすでにある技術を,さらに有効活用できるマーケットを探る\n→ポジション分析\n\n足下の課題解決につながるような研究開発テーマを探りたい\n→課題解決手法\n\nライセンス先・提携先の候補を探りたい\n→類似技術分析\n\n【所持している技術の有望用途を探りたい】\n事例:A社が開発した技術\n step1:A社「特徴分野」を特許出願件数ランキングで特定\n →特定の分野を特徴候補とする\n step2:A社(及びパートナーのB大学)の位置づけを特許出願件数により確認\n →トップにランクインしている同業社(C社)をベンチマーク(重要競合)として特定\n step3:C社の傾注分野/開発時期を特許出願分野/出願時期により確認\n step4:関連キーワードでウェブ検索をし,C社の試作商材をベンチマークとして特定\n step5:市場性調整をう\n step6:A社およびB大学の商機を分析\n →C社に対するA社およびB大学の強み(特徴)から,技術を使用できることが確認され,同等性能であることが検証できれば,後発ながら既存技術からの代替が狙い得る.\n\n【課題を解決する技術を探りたい】\n事例:会社が抱えている問題\n step:1母集団の課題を調査\n →キーワードに関連する特許出願の「発明が解決しようとする課題」に記載された文章をテキストマイニングし,係り受け関係のある言葉をランキング\n step:2キーワードから言葉ネットワーク分析を実施\n →言葉同士の類似性,近似性を俯瞰\n step:3キーワードを含む発明を抽出\n step:4分野における利用可能性があることがわかる\n\n\n【スライド】\n・3ページ目→3つの箇条書きを大きくする\n・4ページ目→白い部分が多いため図の文字を大きくする(縦に3つ並べる)\n・5ページ目→すべて読むと長くなってしまう・バブルの大きさ詳しくする\n・6ページ目→ボールドフォントや太字などにする\n・11ページ目→「共起語ネットワークの大きさ」とは??\n・13ページ目→対象者を入れる・「実践」を「検証」\n・14ページ目→3Dなので近くにあるのが太字に見える?(なぜこの単語を選んだ?・色等を変える)\n・15ページ目→知識発見に繋がっていることを入れる(29日までに)\n・16ページ目→Q9/10の「新たな知見」は有用であることを示す\n\n\nk-medoidsサイト\n\nhttps://www.dskomei.com/entry/2018/04/03/004543\n\n3Dグラフサイト\nhttps://vasturiano.github.io/3d-force-graph/\ncount_id = count_list_df.stack().drop_duplicates().tolist())

*コピー用_3d [#b29b5943]
#memo(<!DOCTYPE html>\n<html lang=&#x22;en&#x22;>\n	<meta charset=&#x22;utf-8&#x22;>\n	<style>body{margin: 0px; padding: 0px;}</style>\n</head>\n<body>\n	<div id=&#x22;three&#x22; style=&#x22;background-color: aliceblue;&#x22;></div>\n	<!-- <script type=&#x22;module&#x22; src=&#x22;https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.js&#x22; defer></script> -->\n    <script type=&#x22;module&#x22; src=&#x22;https://unpkg.com/three@0.158.0/build/three.js&#x22; defer></script>\n    <!-- <script src=&#x22;//unpkg.com/3d-force-graph&#x22;></script> -->\n    <!-- <script type=&#x22;module&#x22; src=&#x22;https://unpkg.com/3d-force-graph@1.43.4/dist/3d-force-graph.min.js&#x22; defer></script> -->\n    <script type=&#x22;module&#x22; src=&#x22;https://unpkg.com/3d-force-graph@1.73.0/dist/3d-force-graph.min.js&#x22; defer></script>\n    <!-- <script src=&#x22;./main.js&#x22; defer></script> -->\n    <script type=&#x22;module&#x22; src=&#x22;https://unpkg.com/three-spritetext@1.8.1/dist/three-spritetext.min.js&#x22; defer></script>\n    <!-- <script src=&#x22;./main2.js&#x22; charset=&#x22;utf-8&#x22; defer></script> -->\n    <script src=&#x22;./main.js&#x22; charset=&#x22;utf-8&#x22; defer></script>\n    <!-- <div id=&#x22;3d-graph&#x22;></div> -->\n</body>\n</html>\n\n########  NEW  ########\n####### html ######\n\n<!DOCTYPE html>\n<html lang=&#x22;en&#x22;>\n	<meta charset=&#x22;utf-8&#x22;>\n	<style>body{margin: 0px; padding: 0px;}</style>\n</head>\n<body>\n  <button type=&#x22;button&#x22; onclick=&#x22;history.back()&#x22;>戻る</button>\n	<div id=&#x22;three&#x22; style=&#x22;background-color: aliceblue;&#x22;></div>\n    <!-- <script type=&#x22;importmap&#x22;>\n        {\n          &#x22;imports&#x22;: {\n            &#x22;three&#x22;: &#x22;https://unpkg.com/three@0.152.2/build/three.module.js&#x22;\n          }\n        }\n      </script> -->\n	<!-- <script type=&#x22;module&#x22; src=&#x22;https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.js&#x22; defer></script> -->\n    <script type=&#x22;module&#x22; src=&#x22;https://unpkg.com/three@0.158.0/build/three.js&#x22; defer></script>\n    <!-- <script src=&#x22;//unpkg.com/3d-force-graph&#x22;></script> -->\n    <!-- <script type=&#x22;module&#x22; src=&#x22;https://unpkg.com/3d-force-graph@1.43.4/dist/3d-force-graph.min.js&#x22; defer></script> -->\n    <script type=&#x22;module&#x22; src=&#x22;https://unpkg.com/3d-force-graph@1.73.0/dist/3d-force-graph.min.js&#x22; defer></script>\n    <!-- <script src=&#x22;./main.js&#x22; defer></script> -->\n    <script type=&#x22;module&#x22; src=&#x22;https://unpkg.com/three-spritetext@1.8.1/dist/three-spritetext.min.js&#x22; defer></script>\n    <script src=&#x22;./static/main2.js&#x22; charset=&#x22;utf-8&#x22; defer></script>\n    <!-- <script src=&#x22;./static/main.js&#x22; charset=&#x22;utf-8&#x22; defer></script> -->\n    <!-- <script src=&#x22;./main.js&#x22; charset=&#x22;utf-8&#x22; defer></script> -->\n    <!-- <div id=&#x22;3d-graph&#x22;></div> -->\n</body>\n</html>\n\n\n########  .js #########\nconst highlightLinks = new Set();\nconst highlightNodes = new Set();\nlet hoverNode = null;\n\nconst Graph = ForceGraph3D()\n    (document.getElementById(&#x22;three&#x22;))\n    .jsonUrl('http://localhost:5000/static/output.json')\n    .nodeColor('#ffffff')\n    .nodeLabel('id')\n    .nodeRelSize(20)\n    .nodeThreeObject(node => {\n        const sprite = new SpriteText(node.id);\n        sprite.material.depthWrite = false; // make sprite background transparent\n        sprite.color = node.color;\n        sprite.textHeight = 7.5;\n        return sprite;\n    })\n    .onNodeClick(node => {\n        const distance = 100;\n        const distRatio = 1 + distance/Math.hypot(node.x&#x2c; node.y&#x2c; node.z);\n\n        const newPos = node.x || node.y || node.z\n        ? { x:node.x * distRatio&#x2c; y: node.y * distRatio&#x2c; z: node.z * distRatio}\n        : { x: 0&#x2c; y: 0&#x2c; z: distance};\n\n        Graph.cameraPosition(\n            newPos&#x2c;\n            node&#x2c;\n            100\n        );\n    })\n    .onNodeHover(node => {\n        // ノードにホバーした時の処理\n        hoverNode = node ? node.id : null;\n        updateHoverText(); // テキストを更新する関数を呼び出す\n    })\n    .linkOpacity(0.25)\n    .linkDirectionalArrowLength(3)\n    .linkDirectionalArrowRelPos(1)\n    .linkCurvature(0.01)\n    .linkDirectionalParticleWidth(2)\n    .linkDirectionalParticles(&#x22;value&#x22;)\n    .linkDirectionalParticleSpeed(d => d.value * 0.01)\n    .linkThreeObjectExtend(true)\n    .linkColor(() => '#708090')\n    .linkWidth(1)\n    .backgroundColor(&#x22;#f8f8f8&#x22;);\n\nfunction updateHoverText() {\n    // ホバー時のノードのテキストサイズを変更\n    Graph.nodeThreeObject(node => {\n        const sprite = new SpriteText(node.id);\n        sprite.material.depthWrite = false;\n        sprite.color = node.color;\n        sprite.textHeight = hoverNode === node.id ? 15 : 7.5; // ホバー時にテキストサイズを変更\n        return sprite;\n    });\n})

*コピー用 [#b29b5943]
#memo(from selenium import webdriver\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.chrome.service import Service\n\noptions = webdriver.ChromeOptions()\n# options.add_argument('--headless')\noptions.add_argument('--no-sandbox')\noptions.add_argument('--disable-dev-shm-usage')\n\ndriver_path = &#x22;chromedriver-win64/chromedriver.exe&#x22;\nservice = Service(executable_path=driver_path)\n\ndriver1 = webdriver.Chrome(service=service&#x2c; options=options)\ndriver1.implicitly_wait(10)\n\n# url = &#x22;https://www.kanritsuriba.com/toyama/index.html&#x22;\nurl = &#x22;https://fishing.ne.jp/fishingpost/area/toyama&#x22;\ndriver1.get(url)\n\n# //*[@id=&#x22;main&#x22;]/section[4]/div[5]/p/br[1]\n# //*[@id=&#x22;main&#x22;]/section[4]/div[9]/p/br[1]\n# //*[@id=&#x22;main&#x22;]/section[3]/div[1]/p/br[1]\n# //*[@id=&#x22;main&#x22;]/section[3]/div[1]/p/text()\n\n# cite = driver1.find_elements(By.XPATH&#x2c; '//*[@id=&#x22;main&#x22;]/section/div/p')\n# link = driver1.find_elements(By.XPATH&#x2c; '//*[@id=&#x22;main&#x22;]/section/div/p/a[1]')\nkekka_list = []\n\nlink = driver1.find_elements(By.XPATH&#x2c; '//*[@id=&#x22;post-3199010&#x22;]/div/a[1]/div/div/span/img')\nfor i in link:\n    i.click()\n    kikan = driver1.find_element(By.XPATH&#x2c; '//*[@id=&#x22;postBox&#x22;]/section[1]/p[2]')\n    kekka_list.append(kikan.text)\n    driver1.back\n    # driver1.get(url)\n# link = driver1.find_elements(By.XPATH&#x2c; '//span/a/h3')\n# link = driver1.find_elements(By.CLASS_NAME&#x2c; 'LC20lb MBeuO DKV0Md')\nkekka_list\n\n------------------------------------------------------------------------------------\n【3dグラフ】\ndef kyoki_word_network():\n    from pyvis.network import Network\n    import pandas as pd\n\n    #got_net = Network(height=&#x22;500px&#x22;&#x2c; width=&#x22;100%&#x22;&#x2c; bgcolor=&#x22;#222222&#x22;&#x2c; font_color=&#x22;white&#x22;&#x2c; notebook=True)\n    got_net = Network(height=&#x22;1000px&#x22;&#x2c; width=&#x22;95%&#x22;&#x2c; bgcolor=&#x22;#FFFFFF&#x22;&#x2c; font_color=&#x22;black&#x22;&#x2c; notebook=True)\n\n    # set the physics layout of the network\n    #got_net.barnes_hut()\n    got_net.force_atlas_2based()\n    got_data = pd.read_csv(&#x22;kyoki.csv&#x22;)[:1000]\n\n    sources = got_data['first']#count\n    targets = got_data['second']#first\n    weights = got_data['count']#second\n\n    edge_data = zip(sources&#x2c; targets&#x2c; weights)\n\n    for e in edge_data:\n        src = e[0]\n        dst = e[1]\n        w = e[2]\n\n        got_net.add_node(src&#x2c; src&#x2c; title=src)\n        got_net.add_node(dst&#x2c; dst&#x2c; title=dst)\n        got_net.add_edge(src&#x2c; dst&#x2c; value=w)\n\n    neighbor_map = got_net.get_adj_list()\n\n    # add neighbor data to node hover data\n    for node in got_net.nodes:\n        node[&#x22;title&#x22;] += &#x22; Neighbors:<br>&#x22; + &#x22;<br>&#x22;.join(neighbor_map[node[&#x22;id&#x22;]])\n        node[&#x22;value&#x22;] = len(neighbor_map[node[&#x22;id&#x22;]])\n\n    got_net.show_buttons(filter_=['physics'])\n    return got_net\n\nimport pandas as pd\npd.DataFrame([{'first' : i[0][0]&#x2c; 'second' : i[0][1]&#x2c; 'count' : i[1]} for i in ct.most_common()]).to_csv('kyoki.csv'&#x2c; index=False)\n\ngot_net = kyoki_word_network()\ngot_net.show(&#x22;kyoki.html&#x22;)\n\nーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー\n【保存】\n&#x22;[tex]&#x22;: {\n        // スニペット補完中にも補完を使えるようにする\n        &#x22;editor.suggest.snippetsPreventQuickSuggestions&#x22;: false&#x2c;\n        // インデント幅を2にする\n        &#x22;editor.tabSize&#x22;: 2\n    }&#x2c;\n    &#x22;[latex]&#x22;: {\n        // スニペット補完中にも補完を使えるようにする\n        &#x22;editor.suggest.snippetsPreventQuickSuggestions&#x22;: false&#x2c;\n        // インデント幅を2にする\n        &#x22;editor.tabSize&#x22;: 2\n    }&#x2c;\n    &#x22;[bibtex]&#x22;: {\n        // インデント幅を2にする\n        &#x22;editor.tabSize&#x22;: 2\n    }&#x2c;\n    // ---------- LaTeX Workshop ----------\n    // 使用パッケージのコマンドや環境の補完を有効にする\n    &#x22;latex-workshop.intellisense.package.enabled&#x22;: true&#x2c;\n    // 生成ファイルを削除するときに対象とするファイル\n    // デフォルト値に &#x22;*.synctex.gz&#x22; を追加\n    &#x22;latex-workshop.latex.clean.fileTypes&#x22;: [\n        &#x22;*.aux&#x22;&#x2c;\n        &#x22;*.bbl&#x22;&#x2c;\n        &#x22;*.blg&#x22;&#x2c;\n        &#x22;*.idx&#x22;&#x2c;\n        &#x22;*.ind&#x22;&#x2c;\n        &#x22;*.lof&#x22;&#x2c;\n        &#x22;*.lot&#x22;&#x2c;\n        &#x22;*.out&#x22;&#x2c;\n        &#x22;*.toc&#x22;&#x2c;\n        &#x22;*.acn&#x22;&#x2c;\n        &#x22;*.acr&#x22;&#x2c;\n        &#x22;*.alg&#x22;&#x2c;\n        &#x22;*.glg&#x22;&#x2c;\n        &#x22;*.glo&#x22;&#x2c;\n        &#x22;*.gls&#x22;&#x2c;\n        &#x22;*.ist&#x22;&#x2c;\n        &#x22;*.fls&#x22;&#x2c;\n        //&#x22;*.log&#x22;&#x2c;\n        &#x22;*.fdb_latexmk&#x22;&#x2c;\n        &#x22;*.snm&#x22;&#x2c;\n        &#x22;*.nav&#x22;&#x2c;\n        &#x22;*.dvi&#x22;&#x2c;\n        &#x22;*.synctex.gz&#x22;\n    ]&#x2c;\n    // 生成ファイルを &#x22;out&#x22; ディレクトリに吐き出す\n    &#x22;latex-workshop.latex.outDir&#x22;: &#x22;out&#x22;&#x2c;\n    // ビルドのレシピ\n    &#x22;latex-workshop.latex.tools&#x22;: [\n        {\n            &#x22;command&#x22;: &#x22;latexmk&#x22;&#x2c;\n            &#x22;args&#x22;: [\n                &#x22;-pdfdvi&#x22;&#x2c;\n                &#x22;-latex=platex -kanji=utf-8 -synctex=1 %O %S&#x22;&#x2c;\n                &#x22;-e&#x22;&#x2c;\n                &#x22;$dvipdf=\&#x22;dvipdfmx %O %S\&#x22;;$bibtex=\&#x22;pbibtex -kanji=utf-8\&#x22;;$makeindex=\&#x22;mendex\&#x22;;&#x22;&#x2c;\n                &#x22;-silent&#x22;&#x2c;\n                &#x22;-outdir=%OUTDIR%&#x22;&#x2c;\n                &#x22;%DOC%&#x22;\n            ]&#x2c;\n            &#x22;name&#x22;: &#x22;latexmk build&#x22;\n        }\n    ]&#x2c;\n    &#x22;latex-workshop.latex.recipes&#x22;: [\n        {\n            &#x22;command&#x22;: &#x22;latexmk&#x22;&#x2c;\n            &#x22;tools&#x22;: [\n                &#x22;latexmk build&#x22;\n            ]&#x2c;\n            &#x22;name&#x22;: &#x22;latexmk toolchain&#x22;\n        }\n    ]&#x2c;\n    &#x22;editor.mouseWheelZoom&#x22;: true\n    // ビルドのレシピに使われるパーツ\n\n\n\n\n\n\n\n\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nfig = plt.figure(figsize=(50&#x2c;4.0))\nplt.xlim([0&#x2c; 100])\n\nxdata = np.linspace(0&#x2c;1000&#x2c;1000)\nydata1 = np.array(agents[0].rewards)\nydata2 = np.array(agents[1].rewards)\n\nplt.plot(xdata&#x2c;ydata1&#x2c; marker=&#x22;o&#x22;&#x2c; color=&#x22;red&#x22;)\nplt.plot(xdata&#x2c;ydata2&#x2c; marker=&#x22;v&#x22;&#x2c; color=&#x22;blue&#x22;)\n\nplt.grid(True)\n\nplt.show()\n\n\n\n\n\n\n\nfrom selenium import webdriver\nimport time\nfrom selenium.webdriver.chrome.service import Service\nfrom selenium.webdriver.chrome.service import Service as ChromeService\nfrom webdriver_manager.chrome import ChromeDriverManager\nimport pandas as pd\n\noptions = webdriver.ChromeOptions()\noptions.add_argument('--headless')\noptions.add_argument('--no-sandbox')\noptions.add_argument('--disable-dev-shm-usage')\n# service = Service(executable_path=r'/usr/bin/chromedriver')\ndriver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install())&#x2c; options=options)\ndriver.implicitly_wait(10)\n\ndriver.get(&#x22;https://www.mansion-note.com/area/tokyo/ct1000373/s1006598&#x22;)\ntime.sleep(3)\n\n\nimport csv\nfrom time import sleep\nimport requests\nfrom bs4 import BeautifulSoup\nfrom fake_useragent import UserAgent\nimport sys\n\np_review = []\n\nfor p in range(1&#x2c;222):\n    p_url = f'https://minhyo.jp/sakai-hikkoshi?page={p}'\n    # ua = UserAgent()\n    # header = {'user-agent':ua.chrome}\n    # data = b'button=on'\n    # headers = {\n    #     'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML&#x2c; like Gecko) Chrome/116.0.0.0 Safari/537.36'\n    # }\n    p_res = requests.get(p_url)\n    p_soup = BeautifulSoup(p_res.text&#x2c; &#x22;html.parser&#x22;)\n    # print(p_soup)\n    p_i = p_soup.select('#review-pre-area > div > div > div > p')\n    # print(p_i)\n    if p==1:\n        n_page=12\n    else:\n        n_page=9\n    for i in range(n_page):\n        p_review.append(p_i[i].text)\n    #     # p_p = p_i[i].find('span')\nwith open('review.csv'&#x2c; 'w'&#x2c; newline=''&#x2c; errors='ignore') as f:\n    writer = csv.writer(f)\n    for row in p_review:\n        writer.writerow([row.replace('\u2014'&#x2c; '')])\n# print(p_i[0])\n# for p in range(1&#x2c; pages+1):\n#     url = f'https://eiga.com//user//{user}//review//update//{p}'\n#     res = requests.get(url)\n#     soup = BeautifulSoup(res.text&#x2c; &#x22;html.parser&#x22;)\n#     list = soup.select('.review-title > a')\n#     l = 0\n#     for p in list:\n#         i_url = list[l].get('href')\n#         item_url = i_url.replace('/'&#x2c; '//')\n#         next_url = f'https://eiga.com{item_url}'\n#         n_res = requests.get(next_url)\n#         n_soup = BeautifulSoup(n_res.text&#x2c; &#x22;html.parser&#x22;)\n#         n_block = n_soup.find('div'&#x2c; attrs={'class': 'txt-block'})\n#         n_review = n_block.find('p')\n#         # print(n_review.text)\n#         review_con.append(n_review.text)\n#         l += 1\n#         # print(n_review.text)\n#         # print(review_con[1])\n#         with open('review.csv'&#x2c; 'w'&#x2c; newline='') as f:\n#             writer = csv.writer(f)\n#             for row in review_con:\n#                 writer.writerow([row.replace('\u2014'&#x2c; '')]))

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS