projects
/
tweeper.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
38f5ca4
)
rss_converter_instagram.com.xsl: support scraping Instagram locations pages
author
Antonio Ospite <ao2@ao2.it>
Mon, 10 Jul 2017 08:29:01 +0000
(10:29 +0200)
committer
Antonio Ospite <ao2@ao2.it>
Mon, 10 Jul 2017 08:29:01 +0000
(10:29 +0200)
src/rss_converter_instagram.com.xsl
patch
|
blob
|
history
diff --git
a/src/rss_converter_instagram.com.xsl
b/src/rss_converter_instagram.com.xsl
index
1549512
..
58cc19c
100644
(file)
--- a/
src/rss_converter_instagram.com.xsl
+++ b/
src/rss_converter_instagram.com.xsl
@@
-42,8
+42,15
@@
-->
<xsl:variable name="full-name" select="//ProfilePage/user/full_name"/>
-->
<xsl:variable name="full-name" select="//ProfilePage/user/full_name"/>
+ <xsl:variable name="location-name" select="//LocationsPage/location/name"/>
+
<xsl:variable name="screen-name">
<xsl:choose>
<xsl:variable name="screen-name">
<xsl:choose>
+ <xsl:when test="$location-name != ''">
+ <xsl:variable name="location-latitude" select="//LocationsPage/location/lat"/>
+ <xsl:variable name="location-longitude" select="//LocationsPage/location/lng"/>
+ <xsl:value-of select="concat($location-name, ' (', $location-latitude, ', ', $location-longitude, ')')"/>
+ </xsl:when>
<xsl:when test="$full-name != ''">
<xsl:value-of select="$full-name"/>
</xsl:when>
<xsl:when test="$full-name != ''">
<xsl:value-of select="$full-name"/>
</xsl:when>
@@
-53,7
+60,7
@@
</xsl:choose>
</xsl:variable>
</xsl:choose>
</xsl:variable>
- <xsl:template match="//
ProfilePage/user/
media/nodes">
+ <xsl:template match="//media/nodes">
<xsl:variable name="item-content-image" select="./display_src"/>
<xsl:variable name="item-content-caption" select="./caption"/>
<xsl:variable name="item-permalink" select="concat($BaseURL, '/p/', ./code, '/')"/>
<xsl:variable name="item-content-image" select="./display_src"/>
<xsl:variable name="item-content-caption" select="./caption"/>
<xsl:variable name="item-permalink" select="concat($BaseURL, '/p/', ./code, '/')"/>
@@
-101,8
+108,19
@@
</xsl:template>
<xsl:template match="/">
</xsl:template>
<xsl:template match="/">
+
<xsl:variable name="channel-title" select="concat('Instagram / ', $screen-name)"/>
<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/location/id"/>
+ <xsl:value-of select="concat($BaseURL, '/explore/locations/', $location-id)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($BaseURL, '/', $user-name)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<rss version="2.0">
<xsl:attribute name="xml:base"><xsl:value-of select="$BaseURL" /></xsl:attribute>
<rss version="2.0">
<xsl:attribute name="xml:base"><xsl:value-of select="$BaseURL" /></xsl:attribute>
@@
-134,7
+152,7
@@
<xsl:value-of select="//ProfilePage/user/profile_pic_url"/>
</url>
</image>
<xsl:value-of select="//ProfilePage/user/profile_pic_url"/>
</url>
</image>
- <xsl:apply-templates select="//ProfilePage/user/media/nodes"/>
+ <xsl:apply-templates select="//ProfilePage/user/media/nodes
|//LocationsPage/location/media/nodes
"/>
</channel>
</rss>
</xsl:template>
</channel>
</rss>
</xsl:template>