From 9b68727c9c2edec8b3f333291c299b2935a529d3 Mon Sep 17 00:00:00 2001 From: noesterle Date: Sat, 28 May 2022 18:40:23 -0400 Subject: [PATCH 1/6] Updated location of title, added a readable date to txt file --- podsnatch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/podsnatch.py b/podsnatch.py index 5214a0b..e498a3c 100755 --- a/podsnatch.py +++ b/podsnatch.py @@ -17,7 +17,7 @@ class Show: def __init__(self, outline_element): - self.title = outline_element.get('title') + self.title = outline_element.get('text') self.url = (outline_element.get('xmlUrl') or outline_element.get('xmlurl') or None) @@ -41,6 +41,7 @@ def __init__(self, item, show): self.number = item.itunes_episode if 'itunes_episode' in item else '' self.url = item.enclosures[0].href if 'enclosures' in item and item.enclosures else '' self.date = item.published_parsed if 'published_parsed' in item else '' + self.date_text = item.published if 'published' in item else '' self.show = show @@ -48,7 +49,7 @@ def __str__(self): return f"""{self.title} {self.number} {self.guid} -{self.date} +{self.date_text} {self.link} {self.url} {self.content if self.content else self.description} From 8e07dc270fa6e06da171e37badf612d5cded28d8 Mon Sep 17 00:00:00 2001 From: noesterle Date: Sat, 28 May 2022 18:49:11 -0400 Subject: [PATCH 2/6] Added ability to use Pipenv Virtual Env. --- Pipfile | 16 ++++++ Pipfile.lock | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 Pipfile create mode 100644 Pipfile.lock diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..476181b --- /dev/null +++ b/Pipfile @@ -0,0 +1,16 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +lxml = "4.8" +tqdm = "4.64" +feedparser = "6.0.10" +requests = "2.27.1" +argparse = "1.4" + +[dev-packages] + +[requires] +python_version = "3.10" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..4ce4de7 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,158 @@ +{ + "_meta": { + "hash": { + "sha256": "9520c93a0554d214d0e52bd2e1ea9b11996ae877759f80e6b75847dec11b0e3f" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.10" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "argparse": { + "hashes": [ + "sha256:62b089a55be1d8949cd2bc7e0df0bddb9e028faefc8c32038cc84862aefdd6e4", + "sha256:c31647edb69fd3d465a847ea3157d37bed1f95f19760b11a47aa91c04b666314" + ], + "index": "pypi", + "version": "==1.4.0" + }, + "certifi": { + "hashes": [ + "sha256:9c5705e395cd70084351dd8ad5c41e65655e08ce46f2ec9cf6c2c08390f71eb7", + "sha256:f1d53542ee8cbedbe2118b5686372fb33c297fcd6379b050cca0ef13a597382a" + ], + "markers": "python_version >= '3.6'", + "version": "==2022.5.18.1" + }, + "charset-normalizer": { + "hashes": [ + "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597", + "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df" + ], + "markers": "python_version >= '3'", + "version": "==2.0.12" + }, + "feedparser": { + "hashes": [ + "sha256:27da485f4637ce7163cdeab13a80312b93b7d0c1b775bef4a47629a3110bca51", + "sha256:79c257d526d13b944e965f6095700587f27388e50ea16fd245babe4dfae7024f" + ], + "index": "pypi", + "version": "==6.0.10" + }, + "idna": { + "hashes": [ + "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff", + "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d" + ], + "markers": "python_version >= '3'", + "version": "==3.3" + }, + "lxml": { + "hashes": [ + "sha256:078306d19a33920004addeb5f4630781aaeabb6a8d01398045fcde085091a169", + "sha256:0c1978ff1fd81ed9dcbba4f91cf09faf1f8082c9d72eb122e92294716c605428", + "sha256:1010042bfcac2b2dc6098260a2ed022968dbdfaf285fc65a3acf8e4eb1ffd1bc", + "sha256:1d650812b52d98679ed6c6b3b55cbb8fe5a5460a0aef29aeb08dc0b44577df85", + "sha256:20b8a746a026017acf07da39fdb10aa80ad9877046c9182442bf80c84a1c4696", + "sha256:2403a6d6fb61c285969b71f4a3527873fe93fd0abe0832d858a17fe68c8fa507", + "sha256:24f5c5ae618395ed871b3d8ebfcbb36e3f1091fd847bf54c4de623f9107942f3", + "sha256:28d1af847786f68bec57961f31221125c29d6f52d9187c01cd34dc14e2b29430", + "sha256:31499847fc5f73ee17dbe1b8e24c6dafc4e8d5b48803d17d22988976b0171f03", + "sha256:31ba2cbc64516dcdd6c24418daa7abff989ddf3ba6d3ea6f6ce6f2ed6e754ec9", + "sha256:330bff92c26d4aee79c5bc4d9967858bdbe73fdbdbacb5daf623a03a914fe05b", + "sha256:5045ee1ccd45a89c4daec1160217d363fcd23811e26734688007c26f28c9e9e7", + "sha256:52cbf2ff155b19dc4d4100f7442f6a697938bf4493f8d3b0c51d45568d5666b5", + "sha256:530f278849031b0eb12f46cca0e5db01cfe5177ab13bd6878c6e739319bae654", + "sha256:545bd39c9481f2e3f2727c78c169425efbfb3fbba6e7db4f46a80ebb249819ca", + "sha256:5804e04feb4e61babf3911c2a974a5b86f66ee227cc5006230b00ac6d285b3a9", + "sha256:5a58d0b12f5053e270510bf12f753a76aaf3d74c453c00942ed7d2c804ca845c", + "sha256:5f148b0c6133fb928503cfcdfdba395010f997aa44bcf6474fcdd0c5398d9b63", + "sha256:5f7d7d9afc7b293147e2d506a4596641d60181a35279ef3aa5778d0d9d9123fe", + "sha256:60d2f60bd5a2a979df28ab309352cdcf8181bda0cca4529769a945f09aba06f9", + "sha256:6259b511b0f2527e6d55ad87acc1c07b3cbffc3d5e050d7e7bcfa151b8202df9", + "sha256:6268e27873a3d191849204d00d03f65c0e343b3bcb518a6eaae05677c95621d1", + "sha256:627e79894770783c129cc5e89b947e52aa26e8e0557c7e205368a809da4b7939", + "sha256:62f93eac69ec0f4be98d1b96f4d6b964855b8255c345c17ff12c20b93f247b68", + "sha256:6d6483b1229470e1d8835e52e0ff3c6973b9b97b24cd1c116dca90b57a2cc613", + "sha256:6f7b82934c08e28a2d537d870293236b1000d94d0b4583825ab9649aef7ddf63", + "sha256:6fe4ef4402df0250b75ba876c3795510d782def5c1e63890bde02d622570d39e", + "sha256:719544565c2937c21a6f76d520e6e52b726d132815adb3447ccffbe9f44203c4", + "sha256:730766072fd5dcb219dd2b95c4c49752a54f00157f322bc6d71f7d2a31fecd79", + "sha256:74eb65ec61e3c7c019d7169387d1b6ffcfea1b9ec5894d116a9a903636e4a0b1", + "sha256:7993232bd4044392c47779a3c7e8889fea6883be46281d45a81451acfd704d7e", + "sha256:80bbaddf2baab7e6de4bc47405e34948e694a9efe0861c61cdc23aa774fcb141", + "sha256:86545e351e879d0b72b620db6a3b96346921fa87b3d366d6c074e5a9a0b8dadb", + "sha256:891dc8f522d7059ff0024cd3ae79fd224752676447f9c678f2a5c14b84d9a939", + "sha256:8a31f24e2a0b6317f33aafbb2f0895c0bce772980ae60c2c640d82caac49628a", + "sha256:8b99ec73073b37f9ebe8caf399001848fced9c08064effdbfc4da2b5a8d07b93", + "sha256:986b7a96228c9b4942ec420eff37556c5777bfba6758edcb95421e4a614b57f9", + "sha256:a1547ff4b8a833511eeaceacbcd17b043214fcdb385148f9c1bc5556ca9623e2", + "sha256:a2bfc7e2a0601b475477c954bf167dee6d0f55cb167e3f3e7cefad906e7759f6", + "sha256:a3c5f1a719aa11866ffc530d54ad965063a8cbbecae6515acbd5f0fae8f48eaa", + "sha256:a9f1c3489736ff8e1c7652e9dc39f80cff820f23624f23d9eab6e122ac99b150", + "sha256:aa0cf4922da7a3c905d000b35065df6184c0dc1d866dd3b86fd961905bbad2ea", + "sha256:ad4332a532e2d5acb231a2e5d33f943750091ee435daffca3fec0a53224e7e33", + "sha256:b2582b238e1658c4061ebe1b4df53c435190d22457642377fd0cb30685cdfb76", + "sha256:b6fc2e2fb6f532cf48b5fed57567ef286addcef38c28874458a41b7837a57807", + "sha256:b92d40121dcbd74831b690a75533da703750f7041b4bf951befc657c37e5695a", + "sha256:bbab6faf6568484707acc052f4dfc3802bdb0cafe079383fbaa23f1cdae9ecd4", + "sha256:c0b88ed1ae66777a798dc54f627e32d3b81c8009967c63993c450ee4cbcbec15", + "sha256:ce13d6291a5f47c1c8dbd375baa78551053bc6b5e5c0e9bb8e39c0a8359fd52f", + "sha256:db3535733f59e5605a88a706824dfcb9bd06725e709ecb017e165fc1d6e7d429", + "sha256:dd10383f1d6b7edf247d0960a3db274c07e96cf3a3fc7c41c8448f93eac3fb1c", + "sha256:e01f9531ba5420838c801c21c1b0f45dbc9607cb22ea2cf132844453bec863a5", + "sha256:e11527dc23d5ef44d76fef11213215c34f36af1608074561fcc561d983aeb870", + "sha256:e1ab2fac607842ac36864e358c42feb0960ae62c34aa4caaf12ada0a1fb5d99b", + "sha256:e1fd7d2fe11f1cb63d3336d147c852f6d07de0d0020d704c6031b46a30b02ca8", + "sha256:e9f84ed9f4d50b74fbc77298ee5c870f67cb7e91dcdc1a6915cb1ff6a317476c", + "sha256:ec4b4e75fc68da9dc0ed73dcdb431c25c57775383fec325d23a770a64e7ebc87", + "sha256:f10ce66fcdeb3543df51d423ede7e238be98412232fca5daec3e54bcd16b8da0", + "sha256:f63f62fc60e6228a4ca9abae28228f35e1bd3ce675013d1dfb828688d50c6e23", + "sha256:fa56bb08b3dd8eac3a8c5b7d075c94e74f755fd9d8a04543ae8d37b1612dd170", + "sha256:fa9b7c450be85bfc6cd39f6df8c5b8cbd76b5d6fc1f69efec80203f9894b885f" + ], + "index": "pypi", + "version": "==4.8.0" + }, + "requests": { + "hashes": [ + "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61", + "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d" + ], + "index": "pypi", + "version": "==2.27.1" + }, + "sgmllib3k": { + "hashes": [ + "sha256:7868fb1c8bfa764c1ac563d3cf369c381d1325d36124933a726f29fcdaa812e9" + ], + "version": "==1.0.0" + }, + "tqdm": { + "hashes": [ + "sha256:40be55d30e200777a307a7585aee69e4eabb46b4ec6a4b4a5f2d9f11e7d5408d", + "sha256:74a2cdefe14d11442cedf3ba4e21a3b84ff9a2dbdc6cfae2c34addb2a14a5ea6" + ], + "index": "pypi", + "version": "==4.64.0" + }, + "urllib3": { + "hashes": [ + "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14", + "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", + "version": "==1.26.9" + } + }, + "develop": {} +} From b57e304f073b9b15e12745340d080bf97b5ffa6c Mon Sep 17 00:00:00 2001 From: noesterle Date: Sat, 28 May 2022 18:51:04 -0400 Subject: [PATCH 3/6] Updated requirements txt to match Pipenv files and podsnatch script state. --- requirements.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 6c68c6a..27d4639 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,11 @@ -feedparser==5.2.1 -lxml==4.6.5 -requests==2.22.0 -tqdm==4.39.0 +-i https://pypi.org/simple +argparse==1.4.0 +certifi==2022.5.18.1 +charset-normalizer==2.0.12 +feedparser==6.0.10 +idna==3.3 +lxml==4.8.0 +requests==2.27.1 +sgmllib3k==1.0.0 +tqdm==4.64.0 +urllib3==1.26.9 From 004d3b94f905c99bca9e54eb3291cea76b290365 Mon Sep 17 00:00:00 2001 From: noesterle Date: Sat, 28 May 2022 19:07:27 -0400 Subject: [PATCH 4/6] Updated README with new Pipenv abilities and info. --- README.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c71876..1d0431f 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,46 @@ file with the same name as the episode audio, with `.txt` appended. 1: Only \~100 lines of Python! -2: *Probably*, I've only tested on Mac. +2: *Probably*, this has only been tested on Mac and Linux (Pop\!\_os 22.04). ## Usage + +### Python + ```bash python podsnatch.py --opml -o ``` +### Pipenv + +You can also use Python Pipenv to create and use virtual environments to keep your +Python installation clean. Once `pip` is installed, run the following command to +install `pipenv`: + +```bash +pip install pipenv +``` + +Once `pipenv` is installed, install the required packages from `Pipfile.lock`: + +```bash +pipenv sync +``` + +To install newer versions of packages, edit `Pipfile` to the desired version then run: + +```bash +pipenv update +``` + +To run the `podsnatch.py` script, run: + +```bash +pipenv run python podsnatch.py --opml -o +``` + +### Docker + If you don't want to deal with all the python setup crap (and I don't blame you) you can build the docker container and run with From fdbfb8bb8b33c1f6d2f9e24c05bf9ba5e9b7c17d Mon Sep 17 00:00:00 2001 From: noesterle Date: Sat, 28 May 2022 19:09:31 -0400 Subject: [PATCH 5/6] Fixed some typos. --- podsnatch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/podsnatch.py b/podsnatch.py index e498a3c..3c3f348 100755 --- a/podsnatch.py +++ b/podsnatch.py @@ -65,8 +65,8 @@ def get_file_name(self): return '_'.join([s for s in name_tokens if s is not '']) -def parse_ompl(ompl_path): - tree = xml.parse(ompl_path) +def parse_opml(opml_path): + tree = xml.parse(opml_path) root = tree.getroot() shows = root.findall('./body/outline') @@ -99,7 +99,7 @@ def save_podcasts(opml, output, episode_count=None): global total_downloaded global full_path - shows = parse_ompl(opml) + shows = parse_opml(opml) for show in shows: print(f'Processing show {show.title}') From f657b010eb4d38cfcff1ca9f9f335d87374151cf Mon Sep 17 00:00:00 2001 From: noesterle Date: Sat, 28 May 2022 19:22:18 -0400 Subject: [PATCH 6/6] Added Pipenv command to update requirements.txt --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 1d0431f..a617654 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,12 @@ To run the `podsnatch.py` script, run: pipenv run python podsnatch.py --opml -o ``` +The `requirements.txt` can be updated based on what's in `Pipefile` by running: + +```bash +pipenv requirements > requirements.txt +``` + ### Docker If you don't want to deal with all the python setup crap (and I don't blame you)