wedata

Database: ことせかいWebページ読み込み用情報

Item Details: pixiv小説

url ^https://(www|touch)\.pixiv\.net/novel/(show\.php|series/\d+)
pageElement //div[contains(@class,'novel-pages')]|//div[@id='novel_text_noscript']|//section[@id='novel-text-container']|//main/section//main
nextLink //div[@class='navigation-container']/a[contains(@href,'/novel/show.php?') and contains(@class,'router-link-active')]
title //main/section//h1|//div[@class='title-scroller']
author //a[contains(@class,'user-name')]|//div[contains(@class,'top-card')]/a[contains(@href,'/users/') and @class='user-details-name']
firstPageLink //div[@class='works-grid-list']//div[contains(@class,'list-item')]//div[contains(@class,'item-container') and contains(@class,'novel-info')]/a[@class='novel-title' and contains(@href,'/novel/show.php?id=')]
tag //ul[contains(@class,'tags')]/li[contains(@class,'tag')]/a[contains(@class,'text')]|//a[contains(@class,'tag-value')]|//div[@class='novel-details-content']//div[contains(@class,'display-tags')]//a[contains(@href,'/tags/')]
isNeedHeadless true
nextButton nav.novel-pager-container span:nth-of-type(3):not(.invisible)
firstPageButton .segment-bottom .action-button-container button, .gtm-series-next-work-button-in-illust-detail,a.series-link.router-link-active:first-child
waitSecondInHeadless 1.0
injectStyle #novel-text-container{white-space:pre-wrap;}; .novel-paragraph.horizontal{padding: 0 16px}
exampleUrl https://www.pixiv.net/novel/show.php?id=8919908#1
memo pixiv小説の個々の小説は通常(?)とはちょっと違う形でカテゴライズされているため、かなりややこしい SiteInfo になっているため、メモを残す。 まず、isNeedHeadless は true である必要がある。これは本文がHTML上に現れるためには JavaScript が動作する必要があるためである。 次に、pixiv小説におけるページは「>次へ」といった感じのボタン(<a> ではないのでJavaScriptで .click() する必要がある)を押してめくるのであるが、この時URLは変化しない(正確に言うと # より後ろの部分が変化する)。 そのため、まず最初に検索すべきはこの「>次へ」のボタンである。 これは nextButton に CSS selector を書く事によって行う。 このボタンが確認できるのは例えばこのURLである。 https://www.pixiv.net/novel/show.php?id=8919908#3 次に、「>次へ」といったボタンで手繰って行った後に開くべきページについて。 pixiv小説は「シリーズ」という物で続きの話が投稿される場合がある。 このシリーズの次の話を手繰るのは <a> で行けそうであるので nextLink を用いる(余談だがシリーズの次の話はIDが異なる。どうやらそれぞれの小説は個々に独立していて、シリーズとして関連性を与えているという概念らしい)。 このシリーズの次の話へのリンクが確認できるのは例えばこのURLである。 https://www.pixiv.net/novel/show.php?id=13381749 この中の、「#41 強くてニューゲームは都市伝説。上手に「待て」が出来るかな?」というボタンがそれである。 次に、firstPageLink と firstPageButton について。 pixiv小説では個々の小説のタイトルページ(表紙?)も存在する。 これは例えば https://www.pixiv.net/novel/show.php?id=8919908 といった物がそれに当たるのであるが、これはブラウザで開くと勝手に最初のページを開くような動作を取ることがあるため、この挙動に当たってしまうとタイトルページの解析はできない。 また、シリーズの一覧ページというものもあり、こちらは例えばこのURL https://www.pixiv.net/novel/series/1270584 で確認できる。 このシリーズ一覧での最初の小説へのリンクについては firstPageButton で対応する。

History

Back