{"id":22154595,"url":"https://github.com/ericflo/pynzb","last_synced_at":"2025-07-26T06:32:47.793Z","repository":{"id":566314,"uuid":"197643","full_name":"ericflo/pynzb","owner":"ericflo","description":"pynzb is a unified API for parsing NZB files, with several concrete implementations included","archived":false,"fork":false,"pushed_at":"2017-01-12T01:19:15.000Z","size":105,"stargazers_count":18,"open_issues_count":3,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-20T14:06:38.051Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericflo.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-05-11T06:12:31.000Z","updated_at":"2024-07-27T09:03:49.000Z","dependencies_parsed_at":"2022-07-05T00:01:08.141Z","dependency_job_id":null,"html_url":"https://github.com/ericflo/pynzb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ericflo/pynzb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericflo%2Fpynzb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericflo%2Fpynzb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericflo%2Fpynzb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericflo%2Fpynzb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericflo","download_url":"https://codeload.github.com/ericflo/pynzb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericflo%2Fpynzb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266342625,"owners_count":23914247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-02T01:49:46.314Z","updated_at":"2025-07-26T06:32:47.535Z","avatar_url":"https://github.com/ericflo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Introduction\n------------\n\nNZB is an XML-based file format for retrieving posts from NNTP (Usenet) servers.\nSince NZB is XML-based, it's relatively easy to build one-off parsers to parse\nNZB files.  This project is an attempt to consolidate those many one-off NZB\nparsers into one simple interface.\n\nThis package includes three implementations: one based on expat, another based\non ElementTree, and a final implementation based on lxml.  The order in which\nthey were listed is in order of compatibility.  The expat version should work on\nall versions of Python \u003e 2.0, the lxml one will work on all versions \u003e 2.5, and\nlxml will only work if you have lxml installed.\n\n\nA Note on Installing lxml\n-------------------------\n\nWhile lxml is not a requirement, I have had a hard time installing lxml in the\npast.  I have found this set of commands to work perfectly::\n\n    STATIC_DEPS=true easy_install 'lxml\u003e=2.2beta4'\n    STATIC_DEPS=true sudo easy_install 'lxml\u003e=2.2beta4'\n\n\nAPI Documentation\n-----------------\n\n\nAccessing the Default Parser\n============================\n\nSimply import nzb_parser from the pynzb package.  It's an instantiated version\nof the fastest available parser that your system can support.\n\n\nOther Parser Locations\n======================\n\n``ExpatNZBParser``:\n    Available in the ``pynzb.expat_nzb`` namespace.\n\n``ETreeNZBParser``:\n    Available in the ``pynzb.etree_nzb`` namespace.\n\n``LXMLNZBParser``:\n    Available in the ``pynzb.lxml_nzb`` namespace.\n\n\nUsing the NZB Parser\n====================\n\nIf you're using a specific parser, like the ``ETreeNZBParser``, you will first\nhave to instantiate it::\n\n    nzb_parser = ETreeNZBParser()\n\n\nOtherwise, you can just import the default parser for your system::\n\n    from pynzb import nzb_parser\n\n\nThen, simply call the ``parse`` method, giving it the xml string as the only\nargument::\n\n    files = nzb_parser.parse('\u003c?xml ... my nzb file here ... \u003c/nzb\u003e')\n\n\nThis will return a list of ``NZBFiles`` for you to use.\n\n\nNZBFile Objects\n===============\n\nAll of the parsers return ``NZBFile`` objects, which are objects with the\nfollowing properties:\n\n``poster``:\n    The name of the user who posted the file to the newsgroup.\n\n``date``:\n    A ``datetime.date`` representation of when the server first saw the file.\n\n``subject``:\n    The subject used when the user posted the file to the newsgroup.\n\n``groups``:\n    A list of strings representing the newsgroups in which this file may be\n    found.\n\n``segments``:\n    A list of ``NZBSegment`` objects talking about where to get the contents\n    of this file.\n\n\nNZBSegment Objects\n==================\n\nEach ``NZBFile`` has a list of ``NZBSegment`` objects, which include information\non how to retrieve a part of a file.  Here's what you can find on an\n``NZBSegment`` object:\n\n``number``:\n    The number of the segment in the list of files.\n\n``bytes``:\n    The size of the segment, in bytes.\n\n``message_id``:\n    The Message-ID of the segment (useful for retrieving the full contents)\n\n\nExample\n--------\n\nIn this example, we will grab an Ubuntu NZB and parse the file, printing out\nsome information about each file and its segments::\n\n    from pynzb import nzb_parser\n    from urllib2 import urlopen\n\n    # Grab a sample Ubuntu NZB\n    ubuntu_nzb = urlopen('http://media.eflorenzano.com/misc/sample-ubuntu-nzb.nzb').read()\n\n    # Parse the NZB into files\n    files = nzb_parser.parse(ubuntu_nzb)\n\n    # Print out each file's subject and the first two segment message ids\n    for nzb_file in files:\n        print nzb_file.subject\n        for segment in nzb_file.segments[:2]:\n            print '    ' + segment.message_id\n        if len(nzb_file.segments) \u003e 2:\n            print '    ...'","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericflo%2Fpynzb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericflo%2Fpynzb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericflo%2Fpynzb/lists"}