Skip to main content

Dark Keeper is open source simple web-parser for podcast-sites

Project description

Dark Keeper

Dark Keeper is open source simple web-parser for podcast-sites.

Goal idea

I like listen IT-podcasts and learn something new. For really good podcasts I want download all episodes. Goal idea is create simple tool for this.

Features

  • [x] simple web-spider walking on site

  • [x] cache for all downloaded pages

  • [x] parse any information from pages

  • [x] export parsed data to MongoDB

Quick start

$ mkvirtualenv keeper

$ workon keeper

(keeper)$ pip install dark-keeper

(keeper)$ cat app.py

from collections import OrderedDict

from pymongo import MongoClient

from dark_keeper import DarkKeeper
from dark_keeper.parse import parse_urls, parse_text, parse_attr


class PodcastKeeper(DarkKeeper):
    base_url = 'https://radio-t.com/archives/'

    mongo_client = MongoClient('localhost', 27017)
    mongo_db_name = 'podcasts'
    mongo_coll_name = 'radio-t.com'

    def parse_menu(self, content):
        urls = parse_urls(content, '#blog-archives h1 a', self.base_url)

        self.menu.append_new_urls(urls)

    def parse_content(self, content):
        row = OrderedDict([])

        row.update({
            'title': parse_text(content, '.hentry .entry-title')
        })
        row.update({
            'desc': parse_text(content, '.hentry .entry-content')
        })
        row.update({
            'mp3': parse_attr(content, '.hentry audio', 'src')
        })

        if row['title'] and row['mp3']:
            self.storage.append_row(row)


if __name__ == '__main__':
    pk = PodcastKeeper()
    pk.run()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dark-keeper-0.2.6.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file dark-keeper-0.2.6.tar.gz.

File metadata

File hashes

Hashes for dark-keeper-0.2.6.tar.gz
Algorithm Hash digest
SHA256 f427c325dcff95081bb837a24588ae0e0ee66744c5c18ec9339fa13bd7827764
MD5 a4f904e7cf56763fb66e3240ed12a130
BLAKE2b-256 3f2209619a0b781899ca3157ba472ec397bf4bdbb88327d7ae787550eb3c54c7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page