Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 54 lines (40 sloc) 1.79 KB
#! /usr/bin/env python3
#-*- coding: UTF-8 -*-
# Author: Unvanquished Development
# License: CC0 1.0 <>
import __main__ as m
import argparse
import configparser
import urllib.request
import os
default_output_dir = "build"
prog_name = os.path.basename(m.__file__)
description="%(prog)s scrap pluto feeds."
args_parser = argparse.ArgumentParser(description=description, prog=prog_name)
args_parser.add_argument("-o", "--output-dir", dest="output_dir", metavar="DIRNAME", default=default_output_dir, help="set output dir (default: " + default_output_dir + ")")
args = args_parser.parse_args()
build_dir = args.output_dir
feed_dir = os.path.join(build_dir, "feed")
os.makedirs(feed_dir, exist_ok=True)
# HACK: planet.ini has some value outside section, something that is unsupported by python's configparser
# Let's praise for someone never adding more than one line outside of sections
config_file_handler = open("planet.ini", "r")
# Let's now read the remaining bits of the config file
planet_config = configparser.ConfigParser()
# We can close the file handler now, we got everything we need
for feed_key in planet_config.keys():
if feed_key == "DEFAULT":
print("scrapping feed: " + feed_key)
feed_url = planet_config.get(feed_key, "hidden_feed")
response = urllib.request.urlopen(feed_url)
feed_content ="utf-8")
# HACK: workaround relative github urls
if feed_url.startswith(""):
feed_content = feed_content.replace("href=&quot;/", "href=&quot;")
feed_file_handler = open(os.path.join(feed_dir, feed_key), "w")
You can’t perform that action at this time.