mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-22 04:56:35 +00:00
Merge pull request #787 from tcely/patch-6
Some checks are pending
Run Django tests for TubeSync / test (3.10) (push) Waiting to run
Run Django tests for TubeSync / test (3.11) (push) Waiting to run
Run Django tests for TubeSync / test (3.12) (push) Waiting to run
Run Django tests for TubeSync / test (3.8) (push) Waiting to run
Run Django tests for TubeSync / test (3.9) (push) Waiting to run
Run Django tests for TubeSync / containerise (push) Waiting to run
Some checks are pending
Run Django tests for TubeSync / test (3.10) (push) Waiting to run
Run Django tests for TubeSync / test (3.11) (push) Waiting to run
Run Django tests for TubeSync / test (3.12) (push) Waiting to run
Run Django tests for TubeSync / test (3.8) (push) Waiting to run
Run Django tests for TubeSync / test (3.9) (push) Waiting to run
Run Django tests for TubeSync / containerise (push) Waiting to run
Use `yt-dlp` `daterange` option
This commit is contained in:
commit
7e86e23b86
@ -508,7 +508,10 @@ class Source(models.Model):
|
|||||||
indexer = self.INDEXERS.get(self.source_type, None)
|
indexer = self.INDEXERS.get(self.source_type, None)
|
||||||
if not callable(indexer):
|
if not callable(indexer):
|
||||||
raise Exception(f'Source type f"{self.source_type}" has no indexer')
|
raise Exception(f'Source type f"{self.source_type}" has no indexer')
|
||||||
response = indexer(self.get_index_url(type=type))
|
days = None
|
||||||
|
if self.download_cap_date:
|
||||||
|
days = timedelta(seconds=self.download_cap).days
|
||||||
|
response = indexer(self.get_index_url(type=type), days=days)
|
||||||
if not isinstance(response, dict):
|
if not isinstance(response, dict):
|
||||||
return []
|
return []
|
||||||
entries = response.get('entries', [])
|
entries = response.get('entries', [])
|
||||||
|
@ -130,12 +130,21 @@ def _subscriber_only(msg='', response=None):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def get_media_info(url):
|
def get_media_info(url, days=None):
|
||||||
'''
|
'''
|
||||||
Extracts information from a YouTube URL and returns it as a dict. For a channel
|
Extracts information from a YouTube URL and returns it as a dict. For a channel
|
||||||
or playlist this returns a dict of all the videos on the channel or playlist
|
or playlist this returns a dict of all the videos on the channel or playlist
|
||||||
as well as associated metadata.
|
as well as associated metadata.
|
||||||
'''
|
'''
|
||||||
|
start = None
|
||||||
|
if days is not None:
|
||||||
|
try:
|
||||||
|
days = int(str(days), 10)
|
||||||
|
except Exception as e:
|
||||||
|
days = None
|
||||||
|
start = (
|
||||||
|
f'yesterday-{days!s}days' if days else None
|
||||||
|
)
|
||||||
opts = get_yt_opts()
|
opts = get_yt_opts()
|
||||||
opts.update({
|
opts.update({
|
||||||
'ignoreerrors': False, # explicitly set this to catch exceptions
|
'ignoreerrors': False, # explicitly set this to catch exceptions
|
||||||
@ -145,6 +154,7 @@ def get_media_info(url):
|
|||||||
'logger': log,
|
'logger': log,
|
||||||
'extract_flat': True,
|
'extract_flat': True,
|
||||||
'check_formats': True,
|
'check_formats': True,
|
||||||
|
'daterange': yt_dlp.utils.DateRange(start=start),
|
||||||
'extractor_args': {
|
'extractor_args': {
|
||||||
'youtube': {'formats': ['missing_pot']},
|
'youtube': {'formats': ['missing_pot']},
|
||||||
'youtubetab': {'approximate_date': ['true']},
|
'youtubetab': {'approximate_date': ['true']},
|
||||||
|
Loading…
Reference in New Issue
Block a user