Announcement

Collapse
No announcement yet.

how to get the geolocation in a custom reader?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to get the geolocation in a custom reader?

    Hi guys,
    We are trying to get the geoloction data from a tweeter feed
    The feed is in JSON format and we are using a custom reader to deliver it to feedstreamer
    The problem is we couldn't figure out how to add the geolocation value to the reader
    the only way we managed to recive the geolocation is by putting it in the summary, but this is a work around

    JSON feed:
    Code:
    "tweets":[
    {
    "date":1463915909000,
    "from":"freshhouse1",
    "id":"734342666947813376",
    "lang":"en",
    "name":"James Crooks",
    "text":"Nearly time... #GreatManchesterRun @Great_Run @CR_UK https://t.co/NLsfsoAM8F https://t.co/V6BfIDcxt1",
    "url":"https://pbs.twimg.com/profile_images/634703805112823808/0hxVwLk5_normal.jpg",
    "publisher":"twitter",
    "urls":[
    {
    "du":"justgiving.com/CarrieCrooksru…",
    "e":76,
    "eu":"http://www.justgiving.com/CarrieCrooksrunforfun?utm_id=23",
    "s":53,
    "u":"https://t.co/NLsfsoAM8F"
    },
    {
    "du":"pic.twitter.com/V6BfIDcxt1",
    "e":100,
    "eu":"http://twitter.com/freshhouse1/status/734342666947813376/photo/1",
    "s":77,
    "u":"https://t.co/V6BfIDcxt1"
    },
    {
    "du":"pic.twitter.com/V6BfIDcxt1",
    "e":100,
    "eu":"http://twitter.com/freshhouse1/status/734342666947813376/photo/1",
    "s":77,
    "u":"https://t.co/V6BfIDcxt1"
    }
    ],
    "geolocation":{
    "lat":53.479031,
    "lon":-2.24551
    },
    "verified":false,
    "originalVerified":false,
    "referenceId":"734342666947813376",
    "rtc":0,
    "media":[
    {
    "id":734342178777006080,
    "uri":"http://pbs.twimg.com/media/CjDoUiWXAAAchqs.jpg",
    "uris":"https://pbs.twimg.com/media/CjDoUiWXAAAchqs.jpg",
    "s":[
    {
    "w":150,
    "h":150,
    "t":0
    },
    {
    "w":340,
    "h":255,
    "t":1
    },
    {
    "w":600,
    "h":450,
    "t":2
    },
    {
    "w":1024,
    "h":768,
    "t":3
    }
    ],
    "type":"photo"
    }
    ]
    },
    Xml message (the geoloction is in the summary):
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <feed xmlns="http://www.w3.org/2005/Atom">
        <title>Open Search</title>
        <id>http://172.16.51.121:8089/search?q=id:260462891deed17dce0b6eec9de9d745</id>
        <updated>2016-05-24T12:38:01.705Z</updated>
        <author>
            <name>Vizrt DataHub</name>
        </author>
        <link rel="search" href="http://172.16.51.121:8089/search" type="application/opensearchdescription+xml" />
        <link rel="self" href="http://172.16.51.121:8089/search?q=id:260462891deed17dce0b6eec9de9d745" type="application/atom+xml;type=feed" />
        <totalResults xmlns="http://a9.com/-/spec/opensearch/1.1/">1</totalResults>
        <itemsPerPage xmlns="http://a9.com/-/spec/opensearch/1.1/">50</itemsPerPage>
        <startIndex xmlns="http://a9.com/-/spec/opensearch/1.1/">1</startIndex>
        <Query xmlns="http://a9.com/-/spec/opensearch/1.1/" role="request" searchTerms="(id:260462891deed17dce0b6eec9de9d745) AND (counter&lt;long&gt;:[0 TO 6133549])" startIndex="1" count="50" />
        <link rel="first" href="http://172.16.51.121:8089/search?q=(id:260462891deed17dce0b6eec9de9d745) AND (counter&lt;long&gt;:[0 TO 6133549])&amp;limit=50&amp;include_docs=true&amp;start=1" type="application/atom+xml;type=feed" />
        <link rel="last" href="http://172.16.51.121:8089/search?q=(id:260462891deed17dce0b6eec9de9d745) AND (counter&lt;long&gt;:[0 TO 6133549])&amp;limit=50&amp;include_docs=true&amp;start=1" type="application/atom+xml;type=feed" />
        <entry>
            <id>260462891deed17dce0b6eec9de9d745</id>
            <title type="text">Nearly time... #GreatManchesterRun @Great_Run @CR_UK https://t.co/NLsfsoAM8F https://t.co/V6BfIDcxt1</title>
            <summary type="text">53.479031$-2.24551</summary>
            <published>2016-05-22T11:18:29.000Z</published>
            <updated>2016-05-24T12:35:17.355Z</updated>
            <author>
                <name>James Crooks @freshhouse1</name>
            </author>
            <contributor>
                <name>Twitter</name>
            </contributor>
            <link rel="up" type="application/atom+xml;type=feed" href="http://172.16.51.121:8089/directory/id/SRC_fb80b419-af72-4653-9a31-eda1d1d9493e/feed" />
            <link rel="up" type="application/atom+xml;type=feed" href="http://172.16.51.121:8089/directory/id/GRP_58c8f1a8-4bc4-4d91-8faa-511271f51fa2/feed" />
            <link rel="up" type="application/atom+xml;type=feed" href="http://172.16.51.121:8089/directory/id/SYS_APPROVED/feed" />
            <link rel="enclosure" type="text/html" href="http://www.justgiving.com/CarrieCrooksrunforfun?utm_id=23" />
            <link cache="260462891deed17dce0b6eec9de9d745\952ec86781f158e38f673030075aba24" rel="enclosure" type="image/jpeg" href="http://pbs.twimg.com/media/CjDoUiWXAAAchqs.jpg" />
            <link rel="self" type="application/atom+xml;type=entry" href="http://172.16.51.121:8089/directory/id/260462891deed17dce0b6eec9de9d745" />
            <link rel="describedby" type="application/vnd.vizrt.payload+xml" href="http://172.16.51.121:8089/directory/id/260462891deed17dce0b6eec9de9d745/meta" />
            <link rel="edit-media" href="http://172.16.51.121:8089/directory/id/260462891deed17dce0b6eec9de9d745/media" />
            <category term="Message" />
            <counter xmlns="http://www.vizrt.com/atom-ext">6133548</counter>
            <thumbnail xmlns="http://search.yahoo.com/mrss/" cache="9b167d04899fffeaf8de3bb414529e23" url="https://pbs.twimg.com/profile_images/634703805112823808/0hxVwLk5_normal.jpg" />
        </entry>
    </feed>
    Custom reader response part, this is what we tried to do with no luck:
    Code:
    <Templates>
            <Template ParameterName="{FeedType}" ParameterValue="tweets" NodePath="" NodeValue="">	  
    			<entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    				<id>{id}</id>
    				<title>{text}</title>
    				<summary>
    				Twitter
    				</summary>
    				<author>
    				  <name>{(originalName | name)[last()]} @{(originalScreenName | from)[last()]}</name>
    				</author>
                                    <geolocation>{geolocation}</geolocation>
    				<contributor>
    				  <name>Twitter</name>
    				</contributor>
    				<media:thumbnail url="{(url | originalUrl)[last()]}"/>
    				<link rel="enclosure" href="{urls[1]/eu/text()[not(contains(., 'vine.co'))]}" type="text/html"/>
    				<link rel="enclosure" href="{urls[1]/eu/text()[contains(., 'vine.co')]}/raw" type="video/mp4"/>
    				<link rel="enclosure" href="{media[1]/uri}" type="image/jpeg"/>		
    				<published>{date}</published>
    			</entry>
    		</Template>				
    	</Templates>
    Is there a way to add the geolocation as a new value?

    Data hub - 1.2.0.2145
    Feed streamer client - 1.2.0.3690

    Thanks!

  • #2
    Hi, here is a link to the documentation chapter. From a first glance it looks to me you forgot to add the 2 needed namespaces mentioned in the documentation.
    https://docs.vizrt.com/feed-streamer...m_entries.html

    Comment

    Working...
    X