mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-04-20 23:56:34 -04:00
Merge branch 'yt-dlp-import' into qa
This commit is contained in:
commit
1fef302889
@ -17,7 +17,7 @@ limitations under the License.
|
||||
'''
|
||||
|
||||
import logging
|
||||
import yt_dlp as youtube_dl
|
||||
import yt_dlp
|
||||
from yt_dlp.utils import match_filter_func
|
||||
import brozzler
|
||||
import urllib.request
|
||||
@ -93,7 +93,7 @@ def final_bounces(fetches, url):
|
||||
|
||||
def _build_youtube_dl(worker, destdir, site, page):
|
||||
'''
|
||||
Builds a yt-dlp `youtube_dl.YoutubeDL` for brozzling `site` with `worker`.
|
||||
Builds a yt-dlp `yt_dlp.YoutubeDL` for brozzling `site` with `worker`.
|
||||
|
||||
The `YoutubeDL` instance does a few special brozzler-specific things:
|
||||
|
||||
@ -108,20 +108,12 @@ def _build_youtube_dl(worker, destdir, site, page):
|
||||
site (brozzler.Site): the site we are brozzling
|
||||
|
||||
Returns:
|
||||
a yt-dlp `youtube_dl.YoutubeDL` instance
|
||||
a yt-dlp `yt_dlp.YoutubeDL` instance
|
||||
'''
|
||||
|
||||
class _YoutubeDL(youtube_dl.YoutubeDL):
|
||||
class _YoutubeDL(yt_dlp.YoutubeDL):
|
||||
logger = logging.getLogger(__module__ + "." + __qualname__)
|
||||
|
||||
def urlopen(self, req):
|
||||
try:
|
||||
url = req.full_url
|
||||
except AttributeError:
|
||||
url = req
|
||||
self.logger.debug('fetching %r', url)
|
||||
return super().urlopen(req)
|
||||
|
||||
def add_default_extra_info(self, ie_result, ie, url):
|
||||
# hook in some logging
|
||||
super().add_default_extra_info(ie_result, ie, url)
|
||||
@ -260,8 +252,8 @@ def _build_youtube_dl(worker, destdir, site, page):
|
||||
# this looked like a problem with nsf-mounted homedir, shouldn't be a problem for brozzler on focal?
|
||||
"cache_dir": "/home/archiveit",
|
||||
|
||||
"logger": logging.getLogger("youtube_dl"),
|
||||
"verbose": True,
|
||||
"logger": logging.getLogger("yt_dlp"),
|
||||
"verbose": False,
|
||||
"quiet": False,
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user