Skip to content

Instantly share code, notes, and snippets.

@juanriaza
Created November 6, 2012 13:15
Show Gist options
  • Save juanriaza/4024660 to your computer and use it in GitHub Desktop.
Save juanriaza/4024660 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import json
import requests
from lxml import etree
#req = requests.get('http://www.mitele.es/ipadws/?action=getHome&device=ipa')
#req = requests.get('http://www.mitele.es/ipadws/?action=getContent&contentId=46231&device=ipa')
#req = requests.get('http://servicios.mitele.es/tokenizer/tkjs.php?id=/nogeo/seriesonline/laqueseavecina/t2/c19.mp4', headers={'User-agent': 'iPad'})
#print json.loads(req.content.replace('videoTokenizer(', '')[:-2])['tokenizedUrl']
req = requests.get('http://www.mitele.es/ipadws/?action=getAZ&device=ipa')
tree = etree.fromstring(req.content)
items = [e for e in tree[0] if e.tag=='item']
data = {}
for item in items:
title = item[0].text.encode('utf-8').strip()
content_id = item[2].text
data.update({
content_id: title
})
print data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment