Added pycurl but I had to do it with pip install so I'm not sure
if poetry knows about it in the right waypull/1/head
parent
793b615278
commit
d5a570295d
|
@ -2,8 +2,10 @@
|
||||||
import feedparser
|
import feedparser
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import pycurl
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
|
||||||
def download_audio(link, destdir):
|
def download_audio(link, destdir):
|
||||||
|
@ -13,9 +15,21 @@ def download_audio(link, destdir):
|
||||||
if target.exists():
|
if target.exists():
|
||||||
print("File already exists, skipping")
|
print("File already exists, skipping")
|
||||||
else:
|
else:
|
||||||
args = [ "wget", link, "-o", str(target) ]
|
with open(target, "wb") as fp:
|
||||||
print(f"downloading {link}")
|
curl = pycurl.Curl()
|
||||||
subprocess.run(args)
|
curl.setopt(pycurl.URL, link)
|
||||||
|
curl.setopt(pycurl.FOLLOWLOCATION, 1)
|
||||||
|
curl.setopt(pycurl.MAXREDIRS, 5)
|
||||||
|
curl.setopt(pycurl.CONNECTTIMEOUT, 30)
|
||||||
|
curl.setopt(pycurl.TIMEOUT, 300)
|
||||||
|
curl.setopt(pycurl.NOSIGNAL, 1)
|
||||||
|
curl.setopt(pycurl.WRITEDATA, fp)
|
||||||
|
try:
|
||||||
|
curl.perform()
|
||||||
|
except:
|
||||||
|
traceback.print_exc(file=sys.stderr)
|
||||||
|
sys.stderr.flush()
|
||||||
|
curl.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,43 @@
|
||||||
# This file is automatically @generated by Poetry 1.5.0 and should not be changed by hand.
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "feedparser"
|
name = "feedparser"
|
||||||
version = "6.0.10"
|
version = "6.0.10"
|
||||||
description = "Universal feed parser, handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds"
|
description = "Universal feed parser, handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds"
|
||||||
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.6"
|
python-versions = ">=3.6"
|
||||||
files = [
|
|
||||||
{file = "feedparser-6.0.10-py3-none-any.whl", hash = "sha256:79c257d526d13b944e965f6095700587f27388e50ea16fd245babe4dfae7024f"},
|
|
||||||
{file = "feedparser-6.0.10.tar.gz", hash = "sha256:27da485f4637ce7163cdeab13a80312b93b7d0c1b775bef4a47629a3110bca51"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
sgmllib3k = "*"
|
sgmllib3k = "*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pycurl"
|
||||||
|
version = "7.45.2"
|
||||||
|
description = "PycURL -- A Python Interface To The cURL library"
|
||||||
|
category = "main"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sgmllib3k"
|
name = "sgmllib3k"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
description = "Py3k port of sgmllib."
|
description = "Py3k port of sgmllib."
|
||||||
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "*"
|
python-versions = "*"
|
||||||
files = [
|
|
||||||
{file = "sgmllib3k-1.0.0.tar.gz", hash = "sha256:7868fb1c8bfa764c1ac563d3cf369c381d1325d36124933a726f29fcdaa812e9"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "1.1"
|
||||||
python-versions = "^3.9"
|
python-versions = "^3.9"
|
||||||
content-hash = "b174a7eabcd92b902e7d7381cd453724319fb6563151d344f5011cc51efb3689"
|
content-hash = "2048ee9508f876635bc68e651540b23101da7469317226a7e86353c432292db6"
|
||||||
|
|
||||||
|
[metadata.files]
|
||||||
|
feedparser = [
|
||||||
|
{file = "feedparser-6.0.10-py3-none-any.whl", hash = "sha256:79c257d526d13b944e965f6095700587f27388e50ea16fd245babe4dfae7024f"},
|
||||||
|
{file = "feedparser-6.0.10.tar.gz", hash = "sha256:27da485f4637ce7163cdeab13a80312b93b7d0c1b775bef4a47629a3110bca51"},
|
||||||
|
]
|
||||||
|
pycurl = [
|
||||||
|
{file = "pycurl-7.45.2.tar.gz", hash = "sha256:5730590be0271364a5bddd9e245c9cc0fb710c4cbacbdd95264a3122d23224ca"},
|
||||||
|
]
|
||||||
|
sgmllib3k = [
|
||||||
|
{file = "sgmllib3k-1.0.0.tar.gz", hash = "sha256:7868fb1c8bfa764c1ac563d3cf369c381d1325d36124933a726f29fcdaa812e9"},
|
||||||
|
]
|
||||||
|
|
Loading…
Reference in New Issue