From 481f2d015d14180be9982ced2f281494e0ec3855 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 1 Jul 2015 13:47:53 +0200 Subject: [PATCH] Add support for Facebook.com public pages --- README | 1 + rss_converter_facebook.com.xsl | 115 +++++++++++++++++++++++++++++++++++++++++ tweeper.1.asciidoc | 1 + tweeper.php | 6 +++ 4 files changed, 123 insertions(+) create mode 100644 rss_converter_facebook.com.xsl diff --git a/README b/README index 8612636..d2d200b 100644 --- a/README +++ b/README @@ -35,6 +35,7 @@ The currently supported sites are: * Dilbert.com * Howtoons.com * Instagram.com + * Facebook.com (public pages) Tweeper can be used via web or as a command line program, for example as a filter in your feed reader, by passing the URL of the user's public timeline diff --git a/rss_converter_facebook.com.xsl b/rss_converter_facebook.com.xsl new file mode 100644 index 0000000..b50be3d --- /dev/null +++ b/rss_converter_facebook.com.xsl @@ -0,0 +1,115 @@ + + + + + + + + + + https://facebook.com + + + + + + + + <xsl:variable name="item-title" select="$item-content/p"/> + <xsl:variable name="title-length" select="140"/> + <!-- ellipsize, inspired from http://stackoverflow.com/questions/13622338 --> + <xsl:choose> + <xsl:when test="string-length($item-title) > $title-length"> + <xsl:variable name="truncated-length" select="$title-length - 3"/> + <xsl:value-of select="substring($item-title, 1, $truncated-length)"/> + <xsl:text>...</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$item-title"/> + </xsl:otherwise> + </xsl:choose> + + + + + + + + + + + + + <![CDATA[ + + + ]]> + + + + + + + + + + + + Tweeper + + <xsl:value-of select="$channel-title"/> + + + + + + + + + + <xsl:value-of select="$channel-title"/> + + + + + + + + + + + + + diff --git a/tweeper.1.asciidoc b/tweeper.1.asciidoc index d6ced90..2782dac 100644 --- a/tweeper.1.asciidoc +++ b/tweeper.1.asciidoc @@ -30,6 +30,7 @@ The sites that tweeper is able to scrape and convert to RSS are: * Dilbert.com * Howtoons.com * Instagram.com +* Facebook.com (public pages) tweeper can be used as: diff --git a/tweeper.php b/tweeper.php index efc0fd6..5e9d242 100644 --- a/tweeper.php +++ b/tweeper.php @@ -213,6 +213,12 @@ class Tweeper { return $this->json_to_xml($html, '/window._sharedData = (.*);/', 'instagram'); } + private function preprocess_html_facebook_com($html) { + $html = str_replace('', '', $html); + return $html; + } + private function html_to_xml($html, $host) { $xmlDoc = new DOMDocument(); -- 2.1.4