# Getting Attribute Value from RSS FEED

**URL:** <https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [September 16, 2012, 6:17pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475 "2012-09-16T18:17:20Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![rc.vempati](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rc.vempati](https://forums.plex.tv/u/rc.vempati)\
**Post date:** [September 16, 2012, 6:17pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/1 "2012-09-16T18:17:20Z")

</div>

I have the below RSS Feed and I am trying get the attribute value of url for VOD element. How do I use XPATH to get attribute value.  
  
  
  
RSS FEED :

```auto

<rsp><br />
  <code id="1"><br />
    <vodList><br />
      <vod id="123" title="Video1" url="http://mydomain.com/url1.mp4/><br />
      <vod id="124" title="Video2" url="http://mydomain.com/url2.mp4/><br />
    <vodList><br />
  </code><br />
</rsp>

```

  
  
I have the code written like below and tried different methods. So far no success.   
  
CODE:   

```auto

for video in XML.ElementFromURL(RSS_FEED).xpath('//vod'):<br />
  url = video.xpath('//vod')[0].get('url')<br />

```

  
  
Please help.

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [September 16, 2012, 7:42pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/2 "2012-09-16T19:42:30Z")

</div>

Hi!  
  
A first look shows that the RSS feed is not valid xml, but maybe that happened when pasting the contents of an xml file in here? The closing " is missing on the _url_ attributes. Also the closing tag is wrong (it’s missing a /).  
  
  
  
If the xml is valid, the _for_ loop to get the _url_ attribute of all the elements can be written like this:

```auto

for video in XML.ElementFromURL(RSS_FEED).xpath('//vod'):<br />
  url = video.get('url')<br />

```

---

<div class="post-metadata">

**Author:** ![rc.vempati](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rc.vempati](https://forums.plex.tv/u/rc.vempati)\
**Post date:** [September 17, 2012, 7:25pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/3 "2012-09-17T19:25:47Z")

</div>

The XML is copy/pasted. But the original XML is OK. Will check and let you know I am able to get the URL value using your suggestion. Thanks for the reply.

---

<div class="post-metadata">

**Author:** ![rc.vempati](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rc.vempati](https://forums.plex.tv/u/rc.vempati)\
**Post date:** [September 18, 2012, 12:59am UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/4 "2012-09-18T00:59:41Z")

</div>

I was able to parse the XML and able to get the details. But I have the final media link available with in the XML. If I assign the url from xml to url of VideoClipObject then the plug in won’t list the items. I think it needs a web page link than the final media link.  
  
  
  
I do not wish to write ServiceCode.pys as the media link available in XML Feed. Is there any alternative for this.   
  
  
  
thanks in advance.

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [September 18, 2012, 2:04am UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/5 "2012-09-18T02:04:40Z")

</div>

Hi!  
  
If you set the _url_ attribute of a VideoClipObject, it expects a URL Service. If you don’t need or want that, you can write it like [this](https://github.com/sander1/Test.bundle/blob/master/Contents/Code/ __init__.py#L24) (just put your _for_-loop around the _oc.add(…)_).

---

<div class="post-metadata">

**Author:** ![rc.vempati](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rc.vempati](https://forums.plex.tv/u/rc.vempati)\
**Post date:** [September 18, 2012, 1:23pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/6 "2012-09-18T13:23:54Z")

</div>

Will try and let you know. This is exactly what I am looking for. Thanks.

---

<div class="post-metadata">

**Author:** ![rc.vempati](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rc.vempati](https://forums.plex.tv/u/rc.vempati)\
**Post date:** [September 18, 2012, 6:13pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/7 "2012-09-18T18:13:30Z")

</div>

I was able to parse and load the channel using Plex Client. I am able to play the videos using Plex. But When I try to access the same using Roku, I can navigate till the episode and play list of episodes, but no option to get Play link. I have List and InfoList groups created with in the plex channel. In List group I have different episodes and with in InfoList group I have the play list of that episode.   
  
  
  
Do I need to add one more group view in plex channel to list the details of each play list of an episode in order to play them on ROKU ?  
  
  
  
Please advise.  
  
  
  
thanks.

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [September 18, 2012, 7:38pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/8 "2012-09-18T19:38:03Z")

</div>

Hi!  
  
Viewgroups shouldn’t matter at all here. Can I have a look at your code?

---

<div class="post-metadata">

**Author:** ![rc.vempati](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rc.vempati](https://forums.plex.tv/u/rc.vempati)\
**Post date:** [September 18, 2012, 7:53pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/9 "2012-09-18T19:53:23Z")

</div>

oc.add(  
  
VideoClipObject(  
  
title = title,  
  
summary = title +’ @ '+summary,  
  
rating\_key = id,  
  
thumb = Function(Thumb, url=thumb),   
  
key = id,  
  
items = [MediaObject(parts=[PartObject(key=video\_url)])]  
  
)  
  
)

---

<div class="post-metadata">

**Author:** ![sander1](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@sander1](https://forums.plex.tv/u/sander1)\
**Post date:** [September 18, 2012, 8:42pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/10 "2012-09-18T20:42:23Z")

</div>

Looks good to me! Just one thing I noticed: is the right attribute name for _video\_url_ ‘urls’, with the ‘s’ at the end?

```auto

video_url = video.get('urls')

```

  
In the sample XML you gave it was 'url', without the 's':  

```auto

video_url = video.get('url')

```

  
  
\*\*Edit:\*\* Found one more thing. This:  

```auto

thumb = Function(Thumb, url=thumb),

```

  
should be:  

```auto

thumb = Callback(Thumb, url=thumb),

```

---

<div class="post-metadata">

**Author:** ![rc.vempati](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rc.vempati](https://forums.plex.tv/u/rc.vempati)\
**Post date:** [September 18, 2012, 8:57pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/11 "2012-09-18T20:57:09Z")

</div>

Yes, It is URLS only. I typed wrong in my first post. Even with Function it loads the thumbs on both Plex and Roku.  
  
  
  
I think the issue is Roku - Plex Client will add Play Buttons only if it is a Clip or Episode. I changed the code to display the videoClip as one more layer. Will test it with the changes.  
  
  
  
thank you for all your help so far.

---

<div class="post-metadata">

**Author:** ![rc.vempati](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rc.vempati](https://forums.plex.tv/u/rc.vempati)\
**Post date:** [September 18, 2012, 11:25pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/12 "2012-09-18T23:25:47Z")

</div>

If I assign a numeric value to key in videoClipObject then ROKU is playing other wise it is trying make URL connection and hanging there.   
  
  
  
Now I can play the channel as I expected.   
  
  
  
BTW, How to get TODAY’s date in PLEX ?  
  
  
  
I need Today’s date in String format. (MM/DD/YYYY) format.

---

<div class="post-metadata">

**Author:** ![rc.vempati](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rc.vempati](https://forums.plex.tv/u/rc.vempati)\
**Post date:** [September 19, 2012, 12:50pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/13 "2012-09-19T12:50:21Z")

</div>

oc.add(  
  
VideoClipObject(  
  
title = title,  
  
summary = title +’ @ '+summary,  
  
rating\_key = id,  
  
thumb = Function(Thumb, url=thumb),   
  
key = id,  
  
items = [MediaObject(parts=[PartObject(key=video\_url)])]  
  
)  
  
)   
  
  
  
  
  
I made changes like above. ID is a unique id from my RSS Feed. Now the channel works in Roku as well.

---

<div class="post-metadata">

**Author:** ![rc.vempati](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@rc.vempati](https://forums.plex.tv/u/rc.vempati)\
**Post date:** [September 21, 2012, 12:55pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/14 "2012-09-21T12:55:59Z")

</div>

Hi Sander1,  
  
  
  
I was able to create my own channels now in Plex and have it work on my ROKU. They all function fully as expected.   
  
  
  
I appriciate all your help.  
  
  
  
regards  
  
Ramesh

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 10:15pm UTC](https://forums.plex.tv/t/getting-attribute-value-from-rss-feed/21475/15 "2019-12-20T22:15:48Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
