<!--
Stylesheet to convert Twitter user timelines to RSS.
- Copyright (C) 2013 Antonio Ospite <ospite@studenti.unina.it>
+ Copyright (C) 2013-2014 Antonio Ospite <ao2@ao2.it>
This file is part of tweeper.
</xsl:variable>
<xsl:template match="a[@data-expanded-url]">
- <xsl:value-of disable-output-escaping="yes" select="php:function('generate_enclosure', string(./@data-expanded-url))"/>
+ <xsl:value-of disable-output-escaping="yes" select="php:function('Tweeper::generate_enclosure', string(./@data-expanded-url))"/>
</xsl:template>
- <xsl:variable name="screen-name" select="//div[@class='profile-card-inner']/@data-screen-name"/>
+ <xsl:variable name="screen-name" select="//div[@class='user-actions btn-group not-following ']/@data-screen-name"/>
- <xsl:template match="//div[@id='timeline']//ol[@id='stream-items-id']//li[@data-item-type='tweet']">
- <xsl:variable name="tweet-text" select=".//p[@class='js-tweet-text tweet-text']"/>
+ <xsl:template match="//*[@data-item-type='tweet']">
+ <xsl:variable name="user-name" select=".//div[contains(@class, 'js-stream-tweet')]/@data-screen-name"/>
+ <xsl:variable name="tweet-text" select=".//p[contains(@class, 'js-tweet-text')]"/>
<item>
<title>
- <xsl:value-of select="concat($screen-name, ': ', $tweet-text)"/>
+ <xsl:value-of select="concat($user-name, ': ', $tweet-text)"/>
</title>
<link>
- <xsl:value-of select="concat($twitterBaseURL, .//a[@class='details with-icn js-details']/@href)"/>
+ <xsl:value-of select="concat($twitterBaseURL, .//a[contains(@class, 'js-permalink')]/@href)"/>
</link>
<pubDate>
- <xsl:value-of select="php:functionString('Tweeper::epoch_to_gmdate', .//small[@class='time']//span/@data-time)"/>
+ <xsl:variable name="timestamp" select=".//span[contains(@class, 'js-short-timestamp')]/@data-time"/>
+ <xsl:value-of select="php:functionString('Tweeper::epoch_to_gmdate', number($timestamp))"/>
</pubDate>
<description>
- <xsl:value-of select="concat($screen-name, ': ')"/>
+ <xsl:value-of select="concat($user-name, ': ')"/>
<xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
<xsl:copy-of select="$tweet-text/node()"/>
<xsl:text disable-output-escaping="yes">]]></xsl:text>
<xsl:template match="/">
<rss version="2.0">
+ <xsl:attribute name="xml:base"><xsl:value-of select="$twitterBaseURL" /></xsl:attribute>
<channel>
<generator>Tweeper</generator>
<title>
</description>
<image>
<url>
- <xsl:value-of select="//a[@class='profile-picture media-thumbnail']/@href"/>
+ <xsl:value-of select="//a[contains(@class, 'profile-picture media-thumbnail')]/@href"/>
</url>
</image>
- <xsl:apply-templates select="//div[@id='timeline']//ol[@id='stream-items-id']//li[@data-item-type='tweet']"/>
+ <xsl:apply-templates select="//*[@data-item-type='tweet']"/>
</channel>
</rss>
</xsl:template>