Skip to content

Instantly share code, notes, and snippets.

@MrDOS
Created October 16, 2012 20:08
Show Gist options
  • Save MrDOS/3901661 to your computer and use it in GitHub Desktop.
Save MrDOS/3901661 to your computer and use it in GitHub Desktop.
Generate log file URLs for all torrents with logs recently uploaded to What.CD.
#! /usr/bin/python
"""Use values from one of your personal RSS feed URLs."""
USER=""
AUTH=""
PASSKEY=""
AUTHKEY=""
import urllib, re
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
ID_PATTERN="id=([0-9]+)"
rssf = urllib.urlopen("https://what.cd/feeds.php?feed=torrents_flac&user=%s&auth=%s&passkey=%s&authkey=%s" \
% (USER, AUTH, PASSKEY, AUTHKEY))
rss = ET.parse(rssf)
rssf.close()
for item in rss.getroot()[0].findall("item"):
if "FLAC / Lossless / Log / 100%" in item.find("title").text:
torrentid = re.search(ID_PATTERN, item.find("link").text).group(1)
groupid = re.search(ID_PATTERN, item.find("comments").text).group(1)
print "https://what.cd/torrents.php?action=viewlog&torrentid=%s&groupid=%s" \
% (torrentid, groupid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment