Code Monkey home page Code Monkey logo

restfulfeedfilter's Introduction

RESTful Feed Filter

これは何

RSSやAtomなどのフィードから不要な要素を除外する簡易APIです。不要な要素はXPathで指定します。

デモサイト

URL

https://rff.azurewebsites.net/

注意点

  • デモサイトはAzureの無料プランで動いているため、無料枠を使い切ると一時的に落ちます
  • 生成したURLが動作するかはRSSリーダ次第です
    • Inoreaderでは動作しました
    • FeedlyではRSS1.0のフィードが認識しません

使い方

  1. URLを開くとSwagger UIが表示されるため、以下2つを指定してください
    • 元となるフィードのURL
    • 除外したい要素を選択するXPath
  2. いい感じに絞り込めるXPathが完成したらRequest URLの所に表示されたURLをRSSリーダに登録してください

XPathについて

Namespace関連

  • 元のXMLに定義されているxmlnsは、XPath側でも同じプレフィックスで使用可能です
  • 元のXMLにプレフィックスなしのデフォルトxmlnsが定義されている場合、XPath側でdefaultプレフィックスをつけることでマッチします
    • プレフィックス無しのXPathは「Namespace無し」と解釈される仕様のため、元XMLにデフォルトxmlnsがある場合にプレフィックス無しXPathを指定すると何もマッチしません。この仕様への対策のため、元XMLにデフォルトxmlnsがあれば、同じものをXPath側にdefaultプレフィックスで定義しています
    • Atomフィード(親要素がfeedのもの)、RSS1.0フィード(親要素がrdfのもの)ではデフォルトxmlnsが定義されているため注意してください
    • RSS2.0フィード(親要素がrssのもの)ではこれらの考慮は不要です

XPathサンプル

  • タイトルに【PR】が含まれているものを除外する
    • RSS2.0: /rss/channel/item[contains(title,'【PR】')]
    • RSS1.0: /rdf:RDF/default:item[contains(default:title,'【PR】'))]
    • Atom: /default:feed/default:entry[contains(default:title, '【PR】')]
  • categoryタグの値がeventでないものを除外する
    • RSS2.0: /rss/channel/item[not(category/text()='event')]
  • URLにeventnewsのどちらも含まれないものを除外する
    • RSS2.0: /rss/channel/item[not(contains(link,'event') or contains(link,'news'))]
    • Atom: /default:feed/default:entry[not(contains(default:link/@href,'event') or contains(default:link/@href,'news'))]

restfulfeedfilter's People

Contributors

maeda577 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.