# Tvolucion - Xpath Problem

**URL:** <https://forums.plex.tv/t/tvolucion-xpath-problem/6806>\
**Category:** Dev/API Corner\
**Tags:** plugin-dev\
**Created:** [December 7, 2010, 4:32am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806 "2010-12-07T04:32:28Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![JC-Avila](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@JC-Avila](https://forums.plex.tv/u/JC-Avila)\
**Post date:** [December 7, 2010, 4:32am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/1 "2010-12-07T04:32:28Z")

</div>

Hi my name is Juan Carlos is my first post but in this moment I develop a plugin for Plex!!! 🙂  
  
All plugin is finished but I have problem with a xpath, look is this the code…  
  
  
  
urlCapitulo = forElementos.xpath(’./img[@onClick]’).text  
  
  
  
I want parse from this line:

-   
  
 ![](http://flash.tvolucion.com/img/tln/t1-c090-teres.jpg)  
  

## Teresa
  
  

### Listos para la boda
  
  

### Duración: 00:43:53
  
  

### Capítulo: 90
  
  
  
  
  
  
I need get the content from onClick  
  
onClick=“GoLink(this, ‘[http://tvolucion.esmas.com/telenovelas/drama/teresa/091281/teresa-capitulo-90/ipad](http://tvolucion.esmas.com/telenovelas/drama/teresa/091281/teresa-capitulo-90/ipad)’);”  
  
the link: [http://tvolucion.esmas.com/telenovelas/drama/teresa/091281/teresa-capitulo-90/ipad](http://tvolucion.esmas.com/telenovelas/drama/teresa/091281/teresa-capitulo-90/ipad)  
  
  
  
How i get with xpath.  
  
  
  
Thanks so much  
  
JC

---

<div class="post-metadata">

**Author:** ![jwray](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jwray/32/99832_2.png) [@jwray](https://forums.plex.tv/u/jwray)\
**Post date:** [December 7, 2010, 5:12am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/2 "2010-12-07T05:12:28Z")

</div>

try:

```auto

<br />
urlCapitulo = forElementos.xpath('./img').get('onClick')<br />

```

  
  
Jonny

---

<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:** [December 7, 2010, 5:41pm UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/3 "2010-12-07T17:41:20Z")

</div>

And after the xpath you’d need to extract the url from the returned string. You can of course use a regular expression for this, but in this case you can also use a simple split and split the string on the single quote. This will return a list with 3 elements:

```auto

0 = GoLink(this, <br />
1 = http://tvolucion.esmas.com/telenovelas/drama/teresa/091281/teresa-capitulo-90/ipad<br />
2 = );

```

  
So use this:  
  

```auto

urlCapitulo = forElementos.xpath('./img').get('onClick')<br />
urlCapitulo = urlCapitulo.split("'")[1]

```

---

<div class="post-metadata">

**Author:** ![JC-Avila](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@JC-Avila](https://forums.plex.tv/u/JC-Avila)\
**Post date:** [December 12, 2010, 10:22am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/4 "2010-12-12T10:22:08Z")

</div>

> [@](#):
>
> And after the xpath you'd need to extract the url from the returned string. You can of course use a regular expression for this, but in this case you can also use a simple split and split the string on the single quote. This will return a list with 3 elements:  
>   
> 
> ```auto
> 
> 0 = GoLink(this, <br />
> 1 = http://tvolucion.esmas.com/telenovelas/drama/teresa/091281/teresa-capitulo-90/ipad<br />
> 2 = );
> 
> ```
> 
>   
> So use this:  
>   
> 
> ```auto
> 
> urlCapitulo = forElementos.xpath('./img').get('onClick')<br />
> urlCapitulo = urlCapitulo.split("'")[1]
> 
> ```

  
  
Thanks for the answers, look I have another trouble, that is my last line to get finish the plugin!!!  
 urlCapitulo = forElementos.xpath('//img')[0].get('onClick')  
 urlCapitulo = urlCapitulo[0]  
  
If don't use the [0] in forElementos.xpath('//img')[0].get('onClick') don't run, but if use this code, the second line urlCapitulo = urlCapitulo.split("'")[1] doesn't works  
  
Please help me, thank you  
  
The error code is:  
12/12/10 04:21:44 [0x0-0x783783].com.plexapp.plexmediaserver[12929] File "/Users/JC/Library/Application Support/Plex Media Server/Plug-ins/Tvolucion.bundle/Contents/Code/\_\_init\_\_.py", line 121, in videoIpad

---

<div class="post-metadata">

**Author:** ![jwray](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jwray/32/99832_2.png) [@jwray](https://forums.plex.tv/u/jwray)\
**Post date:** [December 12, 2010, 5:52pm UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/5 "2010-12-12T17:52:48Z")

</div>

It looks like the xpath isn’t returning a string that can be split into three pieces. Couple of things; first, the xpath predicate in your last message

```auto

//img

```

is different from that suggested

```auto

 ./img

```

. The one you posted will get all img tags in the whole document.The other will get children of forElementos.   
  
  
  
Second, try using Log to print out the string returned from get to see if it can be split.  
  
  
  
Jonny

---

<div class="post-metadata">

**Author:** ![JC-Avila](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@JC-Avila](https://forums.plex.tv/u/JC-Avila)\
**Post date:** [December 13, 2010, 12:08am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/6 "2010-12-13T00:08:35Z")

</div>

> [@](#):
>
> It looks like the xpath isn't returning a string that can be split into three pieces. Couple of things; first, the xpath predicate in your last message 
> 
> ```auto
> 
> //img
> 
> ```
> 
> is different from that suggested
> 
> ```auto
> 
> ./img
> 
> ```
> 
> . The one you posted will get all img tags in the whole document.The other will get children of forElementos.   
>   
>   
>   
> Second, try using Log to print out the string returned from get to see if it can be split.  
>   
>   
>   
> Jonny

  
  
Hi I try with the ./img but is the same problem, because when I put the log the fetch is none. Any suggest?  
  

```auto

    MediaContainer.art = (arte)<br />
    dir = MediaContainer(programa=sender.itemTitle)<br />
    dir.viewGroup = 'InfoList'<br />
    contenidos = XML.ElementFromURL(urlCapitulo, True)<br />
    for forElementos in contenidos.xpath('//div[@id="grid_cont"]/ul/li'):<br />
      vidUrl = contenidos.xpath('./img').get('onClick')<br />
      Log(tituloCapitulo)<br />
      vidUrl = tituloCapitulo.split("'")[1]<br />
      Log(tituloCapitulo)<br />
      imagenCapitulo = forElementos.xpath('./img')[0].get('src')<br />
      numeroCapitulo = forElementos.xpath('./h3')[2].text[10:]<br />
      tituloCapitulo = forElementos.xpath('./h3')[0].text<br />
      sumarioCapitulo = forElementos.xpath('//h3')[0].text<br />
      duracionCapitulo = forElementos.xpath('./h3')[1].text<br />
      dir.Append(WebVideoItem(PREFIJO_FLASH, summary=vidUrl + sumarioCapitulo + "

" + duracionCapitulo, thumb=imagenCapitulo, title=numeroCapitulo + ". " + tituloCapitulo))<br />
    return dir<br />

```

---

<div class="post-metadata">

**Author:** ![jwray](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jwray/32/99832_2.png) [@jwray](https://forums.plex.tv/u/jwray)\
**Post date:** [December 13, 2010, 1:36am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/7 "2010-12-13T01:36:35Z")

</div>

There’s a number of things in that code that look a little odd.

```auto

<br />
vidUrl = contenidos.xpath('./img').get('onClick')<br />

```

  
should be operating on the current iterator element, no? i.e.  

```auto

<br />
vidUrl = forElementos.xpath('./img').get('onClick')<br />

```

  
  
Then, both your Log statements are working on a variable that hasn't been initialized - it happens later in the loop - so will be None   
  
And the split is also operating on the same non-initialized variable, and you should be splitting the string with a comma not an apostrophe   

```auto

<br />
vidUrl = vidUrl.split(",")[1]<br />

```

  
 and then your WebVideoItem is using the same video URL for every entry, PREFIJO\_FLASH. Don't you want vidUrl there?  
  
  
  
Jonny

---

<div class="post-metadata">

**Author:** ![JC-Avila](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@JC-Avila](https://forums.plex.tv/u/JC-Avila)\
**Post date:** [December 13, 2010, 1:45am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/8 "2010-12-13T01:45:27Z")

</div>

> [@](#):
>
> There's a number of things in that code that look a little odd.  
>   
> 
> ```auto
> 
> <br />
> vidUrl = contenidos.xpath('./img').get('onClick')<br />
> 
> ```
> 
>   
> should be operating on the current iterator element, no? i.e.  
> 
> ```auto
> 
> <br />
> vidUrl = forElementos.xpath('./img').get('onClick')<br />
> 
> ```
> 
>   
>   
> Then, both your Log statements are working on a variable that hasn't been initialized - it happens later in the loop - so will be None   
>   
> And the split is also operating on the same non-initialized variable, and you should be splitting the string with a comma not an apostrophe   
> 
> ```auto
> 
> <br />
> vidUrl = vidUrl.split(",")[1]<br />
> 
> ```
> 
>   
> and then your WebVideoItem is using the same video URL for every entry, PREFIJO\_FLASH. Don't you want vidUrl there?  
>   
>   
>   
> Jonny

  
  
Hey Jonny I fixed the error this is the most stupid error  
 urlVideo = forElementos.xpath("./img")[0].get('onclick')  
 urlVideo = urlVideo.split("'")[1]  
  
I write onClick and the correct is onclick  
  
well I finished :) in some hours I will upload the plugin, but I have a question, how I insert the video when the format is mp4, you need the: http://www.plexapp.com/player/player.php?clip=  
?  
  
Thanks!

---

<div class="post-metadata">

**Author:** ![Dbl\_A](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@Dbl\_A](https://forums.plex.tv/u/Dbl_A)\
**Post date:** [December 13, 2010, 3:36am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/9 "2010-12-13T03:36:00Z")

</div>

> [@](#):
>
> Hey Jonny I fixed the error this is the most stupid error  
> urlVideo = forElementos.xpath("./img")[0].get('onclick')  
> urlVideo = urlVideo.split("'")[1]  
>   
> I write onClick and the correct is onclick  
>   
> well I finished :) in some hours I will upload the plugin, but I have a question, how I insert the video when the format is mp4, you need the: [http://www.plexapp.c...layer.php?clip=](http://www.plexapp.com/player/player.php?clip=)  
> ?  
>   
> Thanks!

  
  
If it's an .mp4 video file, you don't need to use WebVideoItem or www.plexapp.com/player.php... (those are used for Flash/Silverlight content)  
  
try this:  

```auto

dir.Append(VideoItem(PREFIJO_FLASH, summary=vidUrl + sumarioCapitulo + "

" + duracionCapitulo, thumb=imagenCapitulo, title=numeroCapitulo + ". " + tituloCapitulo))

```

---

<div class="post-metadata">

**Author:** ![jwray](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jwray/32/99832_2.png) [@jwray](https://forums.plex.tv/u/jwray)\
**Post date:** [December 13, 2010, 3:38am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/10 "2010-12-13T03:38:23Z")

</div>

Glad you got it.  
  
  
  
Is the video URL you have directly to an mp4 file? If so, they are the easiest to deal with. Just use VideoItem instead of WebVideoItem with the mp4 URL as the target.

> [@](#):
>
> Hey Jonny I fixed the error this is the most stupid error  
> urlVideo = forElementos.xpath("./img")[0].get('onclick')  
> urlVideo = urlVideo.split("'")[1]  
>   
> I write onClick and the correct is onclick  
>   
> well I finished :) in some hours I will upload the plugin, but I have a question, how I insert the video when the format is mp4, you need the: http://www.plexapp.com/player/player.php?clip=  
> ?  
>   
> Thanks!

---

<div class="post-metadata">

**Author:** ![davoram](https://avatars.discourse-cdn.com/v4/letter/d/ccd318/32.png) [@davoram](https://forums.plex.tv/u/davoram)\
**Post date:** [December 29, 2010, 8:01pm UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/11 "2010-12-29T20:01:33Z")

</div>

Is this plugin ready ? Did you get to finish it ?   
  
  
  
  
  
Thanks

---

<div class="post-metadata">

**Author:** ![JC-Avila](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@JC-Avila](https://forums.plex.tv/u/JC-Avila)\
**Post date:** [January 1, 2011, 9:43am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/12 "2011-01-01T09:43:38Z")

</div>

Sorry for the time, just only I have some issues because Tvolucion, change some lines of code and this plugin is parsing html.  
  
  
  
Please give me some days I recode the plugin.  
  
  
  
Only some issues from this plugin:

- Some section (or maybe all) have a problem with the “In your country you don’t play this video”. Is possible just USA, because have an agreement with Telemundo.  
- Only works 4 of 15:  
  
The most recent  
  
iPad Version (HD)  
  
Foro TV (Discussion Threads)  
  
News  
  
Talk Soups  
  
  
  
  
  
If I upload the plugin could get feedback, ideas, bug fixes, and for the Plex Online

---

<div class="post-metadata">

**Author:** ![JC-Avila](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@JC-Avila](https://forums.plex.tv/u/JC-Avila)\
**Post date:** [January 1, 2011, 11:29am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/13 "2011-01-01T11:29:57Z")

</div>

Ok it’s the first version of TVolucion’s Plugin, some sections don’t have data because some videos was coded with a propietary format and any type of app wasn’t played, the format is QVT.  
  
  
  
Well plz take ma back a feedback is my first app, not only on Plex, is on Phyton :)!

---

<div class="post-metadata">

**Author:** ![JC-Avila](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@JC-Avila](https://forums.plex.tv/u/JC-Avila)\
**Post date:** [January 1, 2011, 11:33am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/14 "2011-01-01T11:33:24Z")

</div>

Sorry I forgot upload the file.

---

<div class="post-metadata">

**Author:** ![briankno](https://avatars.discourse-cdn.com/v4/letter/b/f475e1/32.png) [@briankno](https://forums.plex.tv/u/briankno)\
**Post date:** [March 13, 2012, 3:45am UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/15 "2012-03-13T03:45:05Z")

</div>

disculpa juan carlos soy nuevo en plex mac, como le puedo hacer para ver netflix en plex no encuentro algun tutorial o manera de instalar los plugins crees que sea molestia me expliques que hacer?  
  
gracias :brian cano

---

<div class="post-metadata">

**Author:** ![carlos1312](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@carlos1312](https://forums.plex.tv/u/carlos1312)\
**Post date:** [January 19, 2014, 11:13pm UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/16 "2014-01-19T23:13:12Z")

</div>

no funciona el plug in o es que lo instalo mal???

---

<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, 8:54pm UTC](https://forums.plex.tv/t/tvolucion-xpath-problem/6806/17 "2019-12-20T20:54:17Z")

</div>

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