1

複数の異なる Web サイト (主に HTML ページと PDF ドキュメント) からコンテンツを集約する必要があります。現在、Heritrix (3.2.0) を試して、自分のニーズを満たすかどうかを確認しています。

ドキュメントはかなり詳細ですが、エンジンは期待どおりに機能していないようです。いくつかの単純なジョブをセットアップし、さまざまな方法で DecideRules を構成しましたが、何をしても、Heritrix があまりにも多くのコンテンツを取り込んでいるか、まったく取り込んでいないことがわかりました。

これが私がやろうとしていることの例です。Heritrix をこのような URL に向けています...example.com/news/speeches. これは、個々のスピーチへのリンクを含む HTML テーブルを含む Web ページです (ex.example.com/news/speech/speech1.html、xample.com/news/speech/speech2.html など)。私が実際に必要とするのは、親ページから 1 レベル下の HTML および PDF ドキュメントだけです。Heritrix が 1 レベルよりも深く移動するのを防ぎ、example.com ドメインのこの特定のパスの下にない場合はコンテンツをプルできないようにし、別のドメインに移動できないようにし、html および pdf コンテンツに制限したいと考えています。

次の構成は、機能するはずですが、機能しません

 <bean id="longerOverrides" class="org.springframework.beans.factory.config.PropertyOverrideConfigurer">
      <property name="properties">
       <props>
        <prop key="seeds.textSource.value">

    # URLS HERE
    example.com/news/speeches

        </prop>
       </props>
      </property>
     </bean>

<bean id="scope" class="org.archive.modules.deciderules.DecideRuleSequence">
  <!-- <property name="logToFile" value="false" /> -->
  <property name="rules">
   <list>
    <!-- Begin by REJECTing all... -->
    <bean class="org.archive.modules.deciderules.RejectDecideRule">
    </bean>
    <!-- ...then ACCEPT those within configured/seed-implied SURT prefixes... -->
    <bean class="org.archive.modules.deciderules.surt.SurtPrefixedDecideRule">
     <!-- <property name="seedsAsSurtPrefixes" value="true" /> -->
     <!-- <property name="alsoCheckVia" value="false" /> -->
     <!-- <property name="surtsSourceFile" value="" /> -->
     <!-- <property name="surtsDumpFile" value="${launchId}/surts.dump" /> -->
      <property name="surtsSource">
           <bean class="org.archive.spring.ConfigString">
            <property name="value">
             <value>
            example.com/news/speeches
             </value>
            </property> 
           </bean>
          </property>
    </bean>
     <!-- ...and REJECT those from a configurable (initially empty) set of URI regexes... -->
<bean class="org.archive.modules.deciderules.MatchesListRegexDecideRule">
      <property name="decision" value="REJECT"/>
      <property name="listLogicalOr" value="true" />
      <property name="regexList">
       <list>
         <value>.*(?i)(\.(avi|wmv|mpe?g|mp3))$</value>
         <value>.*(?i)(\.(rar|zip|tar|gz))$</value>
         <value>.*(?i)(\.(xls|odt))$</value>
         <value>.*(?i)(\.(xml))$</value>
         <value>.*(?i)(\.(txt|conf|pdf))$</value>
         <value>.*(?i)(\.(swf))$</value>
         <value>.*(?i)(\.(js|css))$</value>
         <value>.*(?i)(\.(bmp|gif|jpe?g|png|svg|tiff?))$</value>
       </list>
      </property>
</bean>
    <!-- ...but REJECT those more than a configured link-hop-count from start... -->
    <bean class="org.archive.modules.deciderules.TooManyHopsDecideRule">
     <!-- <property name="maxHops" value="20" /> -->
    </bean>
    <!-- ...but ACCEPT those more than a configured link-hop-count from start... -->
    <!--bean class="org.archive.modules.deciderules.TransclusionDecideRule"-->
     <!-- <property name="maxTransHops" value="2" /> -->
     <!-- <property name="maxSpeculativeHops" value="1" /> -->
    <!--/bean-->
    <!-- ...but REJECT those from a configurable (initially empty) set of REJECT SURTs... -->
    <bean class="org.archive.modules.deciderules.surt.SurtPrefixedDecideRule">
          <property name="decision" value="REJECT"/>
          <property name="seedsAsSurtPrefixes" value="false"/>
          <property name="surtsDumpFile" value="${launchId}/negative-surts.dump" /> 
     <!-- <property name="surtsSource">
           <bean class="org.archive.spring.ConfigFile">
            <property name="path" value="negative-surts.txt" />
           </bean>
          </property> -->
    </bean>
    <!-- ...and REJECT those from a configurable (initially empty) set of URI regexes... -->
    <bean class="org.archive.modules.deciderules.MatchesListRegexDecideRule">
          <property name="decision" value="REJECT"/>
     <!-- <property name="listLogicalOr" value="true" /> -->
     <!-- <property name="regexList">
           <list>
           </list>
          </property> -->
    </bean>
    <!-- ...and REJECT those with suspicious repeating path-segments... -->
    <bean class="org.archive.modules.deciderules.PathologicalPathDecideRule">
     <!-- <property name="maxRepetitions" value="2" /> -->
    </bean>
    <!-- ...and REJECT those with more than threshold number of path-segments... -->
    <bean class="org.archive.modules.deciderules.TooManyPathSegmentsDecideRule">
     <!-- <property name="maxPathDepth" value="20" /> -->
    </bean>
    <!-- ...but always ACCEPT those marked as prerequisitee for another URI... -->
    <bean class="org.archive.modules.deciderules.PrerequisiteAcceptDecideRule">
    </bean>
    <!-- ...but always REJECT those with unsupported URI schemes -->
    <bean class="org.archive.modules.deciderules.SchemeNotInSetDecideRule">
    </bean>
   </list>
  </property>
 </bean>

/speech パスに含まれているのは 12 個ほどの HTML ドキュメントだけであるため、クロールでは 12 個程度の HTML ドキュメントしか取得できないと予想していました。約30分後、クロールが800以上のドキュメントをダウンロードしていたため、クロールを停止しました.親レベルのパスまで逆方向にトラバースしていることがわかりました. また、RegEx ルールを試してみましたが、うまくいきませんでした。どんな助けでも大歓迎です。

4

1 に答える 1

0

このような問題をデバッグする良い方法の 1 つは、スコープ決定のログを有効にすることです。(行のコメントを外しlogToFileて作成しtrueます。これにより、すべてのURIに、それを含めるか拒否するかを決定したルールが提供されます。したがって、どのルールが適切に構成されていないかを確認し、そうすべきだったURIを受け入れることができます拒否されました。

于 2017-01-10T15:16:58.137 に答える