# xpath function / metadata agent

**URL:** <https://forums.plex.tv/t/xpath-function-metadata-agent/13256>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [December 13, 2011, 4:18pm UTC](https://forums.plex.tv/t/xpath-function-metadata-agent/13256 "2011-12-13T16:18:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![celestian02\_1](https://avatars.discourse-cdn.com/v4/letter/c/f4b2a3/32.png) [@celestian02\_1](https://forums.plex.tv/u/celestian02_1)\
**Post date:** [December 13, 2011, 4:18pm UTC](https://forums.plex.tv/t/xpath-function-metadata-agent/13256/1 "2011-12-13T16:18:55Z")

</div>

Hi,  
  
  
  
Trying to develop a metadata agent for retrieving subtitles from [Addict7ed.com](http://Addict7ed.com) and I don’t know a thing about Python and have been struggling to strip a page down of all unwanted elements using xpath

```auto

<br />
elem = HTML.ElementFromURL(searchURL)<br />
alltext = elem.xpath(".//*[@id='container95m']/table/tbody/tr[2]/td[2]/table/tbody/tr[*]/td[*]")<br />
for item in alltext:<br />
 Log("text = %s" % item)

```

  
  
Running this xpath against a query checker just scraps everything that I want.  
Still, it seems like "alltext" list is empty. Sometimes, I do get some results by playing around the query but I cannot get the HTML code behind it to parse it and do whatever I want with it because it would simply displays "Element xxx at xxxxx"  
  
Some help would be greatly appreciated! Thanks

---

<div class="post-metadata">

**Author:** ![ootm](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@ootm](https://forums.plex.tv/u/ootm)\
**Post date:** [December 19, 2011, 2:13pm UTC](https://forums.plex.tv/t/xpath-function-metadata-agent/13256/2 "2011-12-19T14:13:20Z")

</div>

Hi,  
  
  
  
Can you paste the full code, with the python import statements etc and the URL populated?

---

<div class="post-metadata">

**Author:** ![vofik](https://avatars.discourse-cdn.com/v4/letter/v/85e7bf/32.png) [@vofik](https://forums.plex.tv/u/vofik)\
**Post date:** [December 31, 2011, 6:48am UTC](https://forums.plex.tv/t/xpath-function-metadata-agent/13256/3 "2011-12-31T06:48:10Z")

</div>

You can test your xpath queries in chrome. Simply go to the page you are parsing, open console, and type  
  
  
  
$x(’.//_[@id=“container95m”]/table/tbody/tr[2]/td[2]/table/tbody/tr[_]/td’);  
  
  
  
this will run the given xpath query and return the results. priceless for quick debugging of your xpath syntax.

---

<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, 9:31pm UTC](https://forums.plex.tv/t/xpath-function-metadata-agent/13256/4 "2019-12-20T21:31:09Z")

</div>

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