Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re;
- import urllib2;
- string = urllib2.urlopen("https://pastebin.com/raw/LWcg4RRq").read();
- # only title that comes right after movie
- titleRe = re.compile('type="movie".*\stitle="([^"]+)"', re.M);
- # only key which comes after <part
- keyRe = re.compile('<Part.*\skey="([^"]+)"', re.M);
- # only thumb which comes after movie
- thumbRe = re.compile('type="movie".*\sthumb="([^"]+)"', re.M);
- titles = re.findall(titleRe, string);
- keys = re.findall(keyRe, string);
- thumb = re.findall(thumbRe, string);
- i=0;
- for title in titles:
- print "<item>";
- print "<title>" + title + "</title>";
- print "<link>" + keys[i] + "</link>";
- print "<thumbnail>" + thumb[i] + "</thumbnail>";
- print "</item>\r\n";
- i=i+1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement