mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-12-02 13:27:56 +01:00
much improved
This commit is contained in:
parent
e4e47f0203
commit
60f4c8d1ba
@ -757,15 +757,6 @@ class YoutubeDL(object):
|
||||
self.report_warning('The program functionality for this site has been marked as broken, '
|
||||
'and will probably not work.')
|
||||
|
||||
try:
|
||||
if self.original_ie:
|
||||
pass # self.original_ie already exists
|
||||
except AttributeError:
|
||||
try:
|
||||
self.original_ie = re.search("\.([^\.]+)'>", str(type(ie))).group(1)
|
||||
except:
|
||||
self.original_ie = None
|
||||
|
||||
try:
|
||||
ie_result = ie.extract(url)
|
||||
if ie_result is None: # Finished already (backwards compatibility; listformats and friends should be moved here)
|
||||
@ -960,18 +951,18 @@ class YoutubeDL(object):
|
||||
download=download,
|
||||
extra_info=extra)
|
||||
|
||||
try:
|
||||
entry_result_date = entry_result['upload_date']
|
||||
entry_result_date_year = int(entry_result_date[0:4])
|
||||
entry_result_date_month = int(entry_result_date[4:6])
|
||||
entry_result_date_day = int(entry_result_date[6:8])
|
||||
entry_result_date = datetime.date(year=entry_result_date_year, month=entry_result_date_month, day=entry_result_date_day)
|
||||
# if the entries originate with an info extractor known to return date-sorted results, simply break after we meet the first date out of range
|
||||
if self.original_ie in reliably_date_ordered_IEs and entry_result_date not in self.params['daterange']:
|
||||
# import pudb; pudb.set_trace()
|
||||
entry_result_uploaddate = entry_result.get('upload_date')
|
||||
if entry_result_uploaddate:
|
||||
entry_result_uploaddate_dateobject = datetime.date(
|
||||
year=int(entry_result_uploaddate[0:4]),
|
||||
month=int(entry_result_uploaddate[4:6]),
|
||||
day=int(entry_result_uploaddate[6:8])
|
||||
)
|
||||
|
||||
if self.params.get('date_ordered_playlist') and entry_result_uploaddate_dateobject not in self.params.get('daterange'):
|
||||
break
|
||||
else:
|
||||
playlist_results.append(entry_result)
|
||||
except: # I don't really know what to expect, so in case of error just fall back to the previous, default, behavior
|
||||
|
||||
playlist_results.append(entry_result)
|
||||
|
||||
ie_result['entries'] = playlist_results
|
||||
|
@ -297,6 +297,10 @@ def parseOpts(overrideArguments=None):
|
||||
'--dateafter',
|
||||
metavar='DATE', dest='dateafter', default=None,
|
||||
help='Download only videos uploaded on or after this date (i.e. inclusive)')
|
||||
selection.add_option(
|
||||
'--date-ordered-playlist',
|
||||
metavar='DATE', dest='date_ordered_playlist', default=None, action='store_true',
|
||||
help='Playlist is known to be in chronologically descending order')
|
||||
selection.add_option(
|
||||
'--min-views',
|
||||
metavar='COUNT', dest='min_views', default=None, type=int,
|
||||
|
Loading…
Reference in New Issue
Block a user