X-Git-Url: https://git.ao2.it/tweeper.git/blobdiff_plain/6817108435b055272e0fff6883206ee1b386b9f6..a1e5d7acd92df7401aa52dc332499d0ed578c2fa:/src/rss_converter_twitter.com.xsl diff --git a/src/rss_converter_twitter.com.xsl b/src/rss_converter_twitter.com.xsl index fc250e5..bbb3bd8 100644 --- a/src/rss_converter_twitter.com.xsl +++ b/src/rss_converter_twitter.com.xsl @@ -1,7 +1,7 @@ + + + + + + - - - - + - - - - - + + + + + - - - - + + - + + - - + + - + + + + + + + + + + + + + + + + + - - - - - + - - <xsl:value-of select="concat($user-name, ': ')"/> + <xsl:if test="($show-usernames = 1) or ($screen-name != $user-name)"> + <xsl:value-of select="concat($user-name, ': ')"/> + </xsl:if> + <!-- TODO twitter mobile UI does not have a way to detect this <xsl:if test="$item-has-video"> <xsl:text>(Video) </xsl:text> </xsl:if> + --> <!-- Prepend a space in front of the URLs which are not preceded by an open parenthesis, for aestethic reasons. @@ -144,22 +176,40 @@ <xsl:value-of select="$item-permalink"/> </guid> <pubDate> - <xsl:variable name="timestamp" select=".//span[contains(@class, 'js-short-timestamp')]/@data-time"/> - <xsl:value-of select="php:functionString('Tweeper\Tweeper::epochToRssDate', number($timestamp))"/> + <xsl:variable name="timestamp" select=".//td[@class='timestamp']/a|.//div[@class='metadata']/a"/> + <xsl:value-of select="php:functionString('Tweeper\Tweeper::twitterToRssDate', $timestamp)"/> </pubDate> <description> - <xsl:value-of select="concat($user-name, ': ')"/> <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text> + <xsl:if test="($show-usernames = 1) or ($screen-name != $user-name)"> + <xsl:value-of select="concat($user-name, ':')"/> + <xsl:element name="br"/> + </xsl:if> + <!-- TODO twitter mobile UI does not support embedded media <xsl:if test="$item-has-video"> - <xsl:text>(Video) </xsl:text> + <xsl:text> (Video)</xsl:text> + <xsl:element name="br"/> </xsl:if> - <xsl:apply-templates select="$item-content/node()"/> - <xsl:apply-templates select="$item-media/node()"/> + <xsl:if test="$item-has-gif"> + <xsl:text> (GIF)</xsl:text> + <xsl:element name="br"/> + </xsl:if> + --> + <xsl:element name="span"> + <xsl:attribute name="style">white-space: pre-wrap;</xsl:attribute> + <xsl:apply-templates select="$item-content/node()"/> + </xsl:element> + + <!-- TODO twitter mobile UI does not support embedded media + <xsl:if test="$show-multimedia = 1"> + <xsl:apply-templates select="$item-media"/> + </xsl:if> + --> <xsl:text disable-output-escaping="yes">]]></xsl:text> </description> <xsl:if test="$generate-enclosure = 1"> <xsl:apply-templates select="$item-content//a[@data-expanded-url]" mode="enclosure"/> - <xsl:apply-templates select="$item-media//div[@data-image-url]" mode="enclosure"/> + <xsl:apply-templates select="$item-media" mode="enclosure"/> </xsl:if> </item> </xsl:template> @@ -171,11 +221,12 @@ <xsl:value-of select="concat('Twitter / ', $screen-name)"/> </xsl:when> <xsl:otherwise> - <xsl:value-of select="concat('Twitter / ', normalize-space(//h1[1]))"/> + <xsl:value-of select="concat('Twitter / ', normalize-space(//td[@id='search']//input/@value))"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="channel-link" select="//link[@rel='canonical']/@href"/> + <xsl:variable name="channel-image" select="//table[@class='profile-details' or @class='main-tweet']//td[@class='avatar']//img/@src"/> <rss version="2.0"> <xsl:attribute name="xml:base"><xsl:value-of select="$BaseURL" /></xsl:attribute> @@ -188,20 +239,22 @@ <xsl:value-of select="$channel-link"/> </link> <description> - <xsl:value-of select="normalize-space(//div[@class='ProfileHeaderCard'])"/> + <xsl:value-of select="normalize-space(//table[@class='profile-details' or @class='main-tweet']//td[@class='details'])"/> </description> - <image> - <title> - <xsl:value-of select="$channel-title"/> - - - - - - - - - + + + + <xsl:value-of select="$channel-title"/> + + + + + + + + + +