X-Git-Url: https://git.ao2.it/tweeper.git/blobdiff_plain/b187bb677361d17a468abf749332d081a194b4bd..b65cf8599c904992401963be960c88ab4f4ab7ba:/src/rss_converter_instagram.com.xsl diff --git a/src/rss_converter_instagram.com.xsl b/src/rss_converter_instagram.com.xsl index e869d7d..855ce0b 100644 --- a/src/rss_converter_instagram.com.xsl +++ b/src/rss_converter_instagram.com.xsl @@ -1,7 +1,7 @@ + + + + + - - + + + + + + @@ -47,14 +64,19 @@ - - - - + + + + <xsl:variable name="title-length" select="140"/> - <xsl:variable name="item-content-title" select="normalize-space(concat($user-name, ': ', $item-content-caption))"/> + <xsl:variable name="item-content-title"> + <xsl:if test="$show-usernames = 1"> + <xsl:value-of select="concat($screen-name, ': ')"/> + </xsl:if> + <xsl:value-of select="normalize-space($item-content-caption)"/> + </xsl:variable> <!-- ellipsize, inspired from http://stackoverflow.com/questions/13622338 --> <xsl:choose> <xsl:when test="string-length($item-content-title) > $title-length"> @@ -74,8 +96,8 @@ <xsl:value-of select="$item-permalink"/> </guid> <pubDate> - <xsl:variable name="timestamp" select="./date"/> - <xsl:value-of select="php:functionString('Tweeper::epochToRssDate', $timestamp)"/> + <xsl:variable name="timestamp" select="./taken_at_timestamp"/> + <xsl:value-of select="php:functionString('Tweeper\Tweeper::epochToRssDate', $timestamp)"/> </pubDate> <description> <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text> @@ -85,18 +107,35 @@ </xsl:if> <xsl:value-of select="$item-content-caption"/> </p><br /> - <a href="{$item-permalink}"><img src="{$item-content-image}" style="max-width: 100%"/></a> + <xsl:if test="$show-multimedia = 1"> + <a href="{$item-permalink}"><img src="{$item-content-image}" style="max-width: 100%"/></a> + </xsl:if> <xsl:text disable-output-escaping="yes">]]></xsl:text> </description> <xsl:if test="$generate-enclosure = 1"> - <xsl:copy-of select="php:functionString('Tweeper::generateEnclosure', $item-content-image)"/> + <xsl:copy-of select="php:functionString('Tweeper\Tweeper::generateEnclosure', $item-content-image)"/> </xsl:if> </item> </xsl:template> <xsl:template match="/"> + <xsl:variable name="channel-title" select="concat('Instagram / ', $screen-name)"/> - <xsl:variable name="channel-link" select="concat($BaseURL, '/', $user-name)"/> + <xsl:variable name="channel-link"> + <xsl:choose> + <xsl:when test="$location-name != ''"> + <xsl:variable name="location-id" select="//LocationsPage/graphql/location/id"/> + <xsl:value-of select="concat($BaseURL, '/explore/locations/', $location-id)"/> + </xsl:when> + <xsl:when test="$hashtag-name != ''"> + <xsl:value-of select="concat($BaseURL, '/explore/tags/', $hashtag-name)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($BaseURL, '/', $user-name)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="channel-image" select="//profile_pic_url"/> <rss version="2.0"> <xsl:attribute name="xml:base"><xsl:value-of select="$BaseURL" /></xsl:attribute> @@ -110,25 +149,39 @@ </link> <description> <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text> - <xsl:value-of select="normalize-space(concat($screen-name, '. ', //user/biography))"/> - <xsl:variable name="external-url" select="//user/external_url"/> - <xsl:if test="$external-url != ''"> - <xsl:text> </xsl:text><a href="{$external-url}"><xsl:value-of select="$external-url"/></a> - </xsl:if> + <xsl:choose> + <xsl:when test="$location-name != ''"> + <xsl:variable name="location-latitude" select="//LocationsPage/graphql/location/lat"/> + <xsl:variable name="location-longitude" select="//LocationsPage/graphql/location/lng"/> + <xsl:value-of select="concat($location-name, ' (', $location-latitude, ', ', $location-longitude, ')')"/> + </xsl:when> + <xsl:when test="$hashtag-name != ''"> + <xsl:value-of select="concat('#', $hashtag-name)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space(concat($screen-name, '. ', //user/biography))"/> + <xsl:variable name="external-url" select="//user/external_url"/> + <xsl:if test="$external-url != ''"> + <xsl:text> </xsl:text><a href="{$external-url}"><xsl:value-of select="$external-url"/></a> + </xsl:if> + </xsl:otherwise> + </xsl:choose> <xsl:text disable-output-escaping="yes">]]></xsl:text> </description> - <image> - <title> - <xsl:value-of select="$channel-title"/> - - - - - - - - - + + + + <xsl:value-of select="$channel-title"/> + + + + + + + + + +