From 9f14daf22b4080ae1531a772ee7574959af4e2fa Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 17 Nov 2022 10:40:03 +0530 Subject: [PATCH] [extractor] Deprecate `_sort_formats` --- test/test_InfoExtractor.py | 4 +- test/test_YoutubeDL.py | 49 +++++++-------------- yt_dlp/extractor/abc.py | 3 -- yt_dlp/extractor/abcotvs.py | 2 - yt_dlp/extractor/acfun.py | 1 - yt_dlp/extractor/adn.py | 1 - yt_dlp/extractor/adobetv.py | 2 - yt_dlp/extractor/adultswim.py | 1 - yt_dlp/extractor/aenetworks.py | 1 - yt_dlp/extractor/afreecatv.py | 3 -- yt_dlp/extractor/agora.py | 2 - yt_dlp/extractor/allocine.py | 2 - yt_dlp/extractor/alsace20tv.py | 1 - yt_dlp/extractor/alura.py | 2 - yt_dlp/extractor/amcnetworks.py | 1 - yt_dlp/extractor/amp.py | 2 - yt_dlp/extractor/ant1newsgr.py | 1 - yt_dlp/extractor/anvato.py | 2 - yt_dlp/extractor/aol.py | 1 - yt_dlp/extractor/apa.py | 1 - yt_dlp/extractor/aparat.py | 1 - yt_dlp/extractor/appletrailers.py | 3 -- yt_dlp/extractor/archiveorg.py | 2 +- yt_dlp/extractor/arcpublishing.py | 1 - yt_dlp/extractor/ard.py | 4 -- yt_dlp/extractor/arkena.py | 1 - yt_dlp/extractor/arnes.py | 1 - yt_dlp/extractor/arte.py | 1 - yt_dlp/extractor/atresplayer.py | 1 - yt_dlp/extractor/atvat.py | 1 - yt_dlp/extractor/audimedia.py | 1 - yt_dlp/extractor/banbye.py | 2 - yt_dlp/extractor/bandcamp.py | 3 -- yt_dlp/extractor/bannedvideo.py | 1 - yt_dlp/extractor/bbc.py | 13 ------ yt_dlp/extractor/beatport.py | 1 - yt_dlp/extractor/beeg.py | 2 - yt_dlp/extractor/bigflix.py | 2 - yt_dlp/extractor/bilibili.py | 3 -- yt_dlp/extractor/biqle.py | 1 - yt_dlp/extractor/bitchute.py | 1 - yt_dlp/extractor/bitwave.py | 1 - yt_dlp/extractor/bloomberg.py | 1 - yt_dlp/extractor/bokecc.py | 2 - yt_dlp/extractor/bongacams.py | 1 - yt_dlp/extractor/booyah.py | 1 - yt_dlp/extractor/box.py | 2 - yt_dlp/extractor/bpb.py | 2 - yt_dlp/extractor/br.py | 2 - yt_dlp/extractor/breakcom.py | 1 - yt_dlp/extractor/breitbart.py | 1 - yt_dlp/extractor/brightcove.py | 2 - yt_dlp/extractor/byutv.py | 1 - yt_dlp/extractor/c56.py | 1 - yt_dlp/extractor/cableav.py | 1 - yt_dlp/extractor/callin.py | 1 - yt_dlp/extractor/caltrans.py | 1 - yt_dlp/extractor/cam4.py | 1 - yt_dlp/extractor/cammodels.py | 1 - yt_dlp/extractor/camsoda.py | 2 - yt_dlp/extractor/canalalpha.py | 1 - yt_dlp/extractor/canalc2.py | 2 - yt_dlp/extractor/canalplus.py | 1 - yt_dlp/extractor/canvas.py | 1 - yt_dlp/extractor/carambatv.py | 1 - yt_dlp/extractor/cbc.py | 2 - yt_dlp/extractor/cbs.py | 1 - yt_dlp/extractor/cbsnews.py | 1 - yt_dlp/extractor/cbssports.py | 1 - yt_dlp/extractor/ccc.py | 1 - yt_dlp/extractor/ccma.py | 1 - yt_dlp/extractor/cctv.py | 2 - yt_dlp/extractor/cda.py | 4 -- yt_dlp/extractor/cellebrite.py | 1 - yt_dlp/extractor/ceskatelevize.py | 3 -- yt_dlp/extractor/channel9.py | 1 - yt_dlp/extractor/charlierose.py | 2 - yt_dlp/extractor/chaturbate.py | 1 - yt_dlp/extractor/chingari.py | 1 - yt_dlp/extractor/cinchcast.py | 1 - yt_dlp/extractor/ciscowebex.py | 1 - yt_dlp/extractor/cliphunter.py | 1 - yt_dlp/extractor/cloudflarestream.py | 1 - yt_dlp/extractor/clubic.py | 1 - yt_dlp/extractor/clyp.py | 1 - yt_dlp/extractor/common.py | 11 +++-- yt_dlp/extractor/condenast.py | 1 - yt_dlp/extractor/contv.py | 2 - yt_dlp/extractor/corus.py | 1 - yt_dlp/extractor/coub.py | 2 - yt_dlp/extractor/cpac.py | 2 - yt_dlp/extractor/crackle.py | 1 - yt_dlp/extractor/crooksandliars.py | 1 - yt_dlp/extractor/crowdbunker.py | 1 - yt_dlp/extractor/crunchyroll.py | 1 - yt_dlp/extractor/cspan.py | 1 - yt_dlp/extractor/curiositystream.py | 1 - yt_dlp/extractor/daftsex.py | 2 - yt_dlp/extractor/dailymail.py | 1 - yt_dlp/extractor/dailymotion.py | 1 - yt_dlp/extractor/dailywire.py | 1 - yt_dlp/extractor/damtomo.py | 1 - yt_dlp/extractor/daystar.py | 1 - yt_dlp/extractor/deezer.py | 2 - yt_dlp/extractor/democracynow.py | 2 - yt_dlp/extractor/detik.py | 1 - yt_dlp/extractor/dfb.py | 1 - yt_dlp/extractor/digitalconcerthall.py | 1 - yt_dlp/extractor/digiteka.py | 2 - yt_dlp/extractor/discoverygo.py | 1 - yt_dlp/extractor/disney.py | 1 - yt_dlp/extractor/dispeak.py | 1 - yt_dlp/extractor/dlive.py | 2 - yt_dlp/extractor/dplay.py | 1 - yt_dlp/extractor/drbonanza.py | 1 - yt_dlp/extractor/dropbox.py | 1 - yt_dlp/extractor/drtuber.py | 1 - yt_dlp/extractor/drtv.py | 3 -- yt_dlp/extractor/dumpert.py | 1 - yt_dlp/extractor/dvtv.py | 1 - yt_dlp/extractor/dw.py | 1 - yt_dlp/extractor/eagleplatform.py | 2 - yt_dlp/extractor/egghead.py | 1 - yt_dlp/extractor/einthusan.py | 2 - yt_dlp/extractor/eitb.py | 2 - yt_dlp/extractor/ellentube.py | 1 - yt_dlp/extractor/elonet.py | 1 - yt_dlp/extractor/epicon.py | 1 - yt_dlp/extractor/eporner.py | 1 - yt_dlp/extractor/ertgr.py | 5 +-- yt_dlp/extractor/escapist.py | 1 - yt_dlp/extractor/espn.py | 3 -- yt_dlp/extractor/esri.py | 1 - yt_dlp/extractor/europa.py | 1 - yt_dlp/extractor/eurosport.py | 2 - yt_dlp/extractor/euscreen.py | 1 - yt_dlp/extractor/expotv.py | 1 - yt_dlp/extractor/expressen.py | 1 - yt_dlp/extractor/facebook.py | 12 +++-- yt_dlp/extractor/faz.py | 1 - yt_dlp/extractor/fc2.py | 1 - yt_dlp/extractor/fczenit.py | 2 - yt_dlp/extractor/fifa.py | 1 - yt_dlp/extractor/filmmodu.py | 2 - yt_dlp/extractor/filmon.py | 2 - yt_dlp/extractor/firsttv.py | 1 - yt_dlp/extractor/flickr.py | 1 - yt_dlp/extractor/folketinget.py | 1 - yt_dlp/extractor/fourtube.py | 1 - yt_dlp/extractor/fourzerostudio.py | 1 - yt_dlp/extractor/fox.py | 1 - yt_dlp/extractor/foxgay.py | 2 - yt_dlp/extractor/fptplay.py | 1 - yt_dlp/extractor/francetv.py | 2 - yt_dlp/extractor/freesound.py | 1 - yt_dlp/extractor/freetv.py | 2 - yt_dlp/extractor/frontendmasters.py | 1 - yt_dlp/extractor/fujitv.py | 2 +- yt_dlp/extractor/funimation.py | 2 +- yt_dlp/extractor/fusion.py | 1 - yt_dlp/extractor/gab.py | 3 -- yt_dlp/extractor/gaia.py | 1 - yt_dlp/extractor/gamespot.py | 2 - yt_dlp/extractor/gaskrank.py | 1 - yt_dlp/extractor/gedidigital.py | 1 - yt_dlp/extractor/generic.py | 12 ----- yt_dlp/extractor/genericembeds.py | 1 - yt_dlp/extractor/gettr.py | 4 -- yt_dlp/extractor/gfycat.py | 1 - yt_dlp/extractor/giantbomb.py | 2 - yt_dlp/extractor/giga.py | 1 - yt_dlp/extractor/globo.py | 1 - yt_dlp/extractor/glomex.py | 1 - yt_dlp/extractor/go.py | 1 - yt_dlp/extractor/golem.py | 1 - yt_dlp/extractor/goodgame.py | 1 - yt_dlp/extractor/googledrive.py | 2 - yt_dlp/extractor/goplay.py | 1 - yt_dlp/extractor/gopro.py | 2 - yt_dlp/extractor/gronkh.py | 1 - yt_dlp/extractor/hbo.py | 1 - yt_dlp/extractor/hearthisat.py | 1 - yt_dlp/extractor/heise.py | 1 - yt_dlp/extractor/hellporno.py | 1 - yt_dlp/extractor/helsinki.py | 1 - yt_dlp/extractor/hidive.py | 1 - yt_dlp/extractor/hitbox.py | 2 - yt_dlp/extractor/hketv.py | 1 - yt_dlp/extractor/hotstar.py | 1 - yt_dlp/extractor/howstuffworks.py | 2 - yt_dlp/extractor/hrfensehen.py | 2 - yt_dlp/extractor/hrti.py | 1 - yt_dlp/extractor/hse.py | 1 - yt_dlp/extractor/huffpost.py | 2 - yt_dlp/extractor/hungama.py | 1 - yt_dlp/extractor/huya.py | 2 - yt_dlp/extractor/icareus.py | 1 - yt_dlp/extractor/ichinanalive.py | 4 -- yt_dlp/extractor/ign.py | 2 - yt_dlp/extractor/imdb.py | 1 - yt_dlp/extractor/imggaming.py | 1 - yt_dlp/extractor/imgur.py | 2 - yt_dlp/extractor/indavideo.py | 1 - yt_dlp/extractor/infoq.py | 2 - yt_dlp/extractor/instagram.py | 2 - yt_dlp/extractor/internazionale.py | 1 - yt_dlp/extractor/internetvideoarchive.py | 1 - yt_dlp/extractor/iprima.py | 3 -- yt_dlp/extractor/iqiyi.py | 3 -- yt_dlp/extractor/islamchannel.py | 1 - yt_dlp/extractor/itv.py | 1 - yt_dlp/extractor/ivi.py | 1 - yt_dlp/extractor/ivideon.py | 1 - yt_dlp/extractor/iwara.py | 2 - yt_dlp/extractor/ixigua.py | 1 - yt_dlp/extractor/izlesene.py | 1 - yt_dlp/extractor/jable.py | 1 - yt_dlp/extractor/jamendo.py | 1 - yt_dlp/extractor/japandiet.py | 3 -- yt_dlp/extractor/jixie.py | 1 - yt_dlp/extractor/joj.py | 1 - yt_dlp/extractor/kakao.py | 1 - yt_dlp/extractor/kaltura.py | 2 - yt_dlp/extractor/keezmovies.py | 7 --- yt_dlp/extractor/kelbyone.py | 1 - yt_dlp/extractor/kinja.py | 3 -- yt_dlp/extractor/kinopoisk.py | 1 - yt_dlp/extractor/konserthusetplay.py | 2 - yt_dlp/extractor/koo.py | 1 - yt_dlp/extractor/kusi.py | 1 - yt_dlp/extractor/kuwo.py | 3 -- yt_dlp/extractor/la7.py | 3 -- yt_dlp/extractor/laola1tv.py | 1 - yt_dlp/extractor/lbry.py | 1 - yt_dlp/extractor/lecture2go.py | 2 - yt_dlp/extractor/lecturio.py | 1 - yt_dlp/extractor/leeco.py | 3 +- yt_dlp/extractor/lego.py | 1 - yt_dlp/extractor/libraryofcongress.py | 2 - yt_dlp/extractor/lifenews.py | 2 - yt_dlp/extractor/likee.py | 1 - yt_dlp/extractor/limelight.py | 2 - yt_dlp/extractor/line.py | 1 - yt_dlp/extractor/linkedin.py | 10 ++--- yt_dlp/extractor/linuxacademy.py | 1 - yt_dlp/extractor/livestream.py | 3 -- yt_dlp/extractor/lnkgo.py | 2 - yt_dlp/extractor/lrt.py | 1 - yt_dlp/extractor/lynda.py | 2 - yt_dlp/extractor/mailru.py | 1 - yt_dlp/extractor/mainstreaming.py | 2 - yt_dlp/extractor/malltv.py | 1 - yt_dlp/extractor/mangomolo.py | 1 - yt_dlp/extractor/manoto.py | 2 - yt_dlp/extractor/manyvids.py | 2 - yt_dlp/extractor/massengeschmacktv.py | 2 - yt_dlp/extractor/masters.py | 1 - yt_dlp/extractor/matchtv.py | 1 - yt_dlp/extractor/mdr.py | 2 - yt_dlp/extractor/medaltv.py | 2 - yt_dlp/extractor/mediaklikk.py | 1 - yt_dlp/extractor/medialaan.py | 1 - yt_dlp/extractor/mediaset.py | 2 - yt_dlp/extractor/mediasite.py | 2 - yt_dlp/extractor/mediaworksnz.py | 2 - yt_dlp/extractor/megatvcom.py | 1 - yt_dlp/extractor/melonvod.py | 1 - yt_dlp/extractor/metacafe.py | 1 - yt_dlp/extractor/metacritic.py | 1 - yt_dlp/extractor/mgoon.py | 1 - yt_dlp/extractor/mgtv.py | 1 - yt_dlp/extractor/microsoftembed.py | 1 - yt_dlp/extractor/microsoftstream.py | 1 - yt_dlp/extractor/microsoftvirtualacademy.py | 1 - yt_dlp/extractor/mildom.py | 4 -- yt_dlp/extractor/minds.py | 1 - yt_dlp/extractor/minoto.py | 1 - yt_dlp/extractor/mirrativ.py | 1 - yt_dlp/extractor/mixcloud.py | 2 - yt_dlp/extractor/mlb.py | 2 - yt_dlp/extractor/mnet.py | 1 - yt_dlp/extractor/mocha.py | 2 - yt_dlp/extractor/moviezine.py | 2 - yt_dlp/extractor/msn.py | 1 - yt_dlp/extractor/mtv.py | 4 -- yt_dlp/extractor/muenchentv.py | 1 - yt_dlp/extractor/mwave.py | 1 - yt_dlp/extractor/myspace.py | 2 - yt_dlp/extractor/n1.py | 2 - yt_dlp/extractor/nate.py | 1 - yt_dlp/extractor/naver.py | 2 - yt_dlp/extractor/nba.py | 2 - yt_dlp/extractor/nbc.py | 4 -- yt_dlp/extractor/ndr.py | 1 - yt_dlp/extractor/neteasemusic.py | 3 -- yt_dlp/extractor/netzkino.py | 1 - yt_dlp/extractor/newgrounds.py | 1 - yt_dlp/extractor/newspicks.py | 1 - yt_dlp/extractor/newstube.py | 1 - yt_dlp/extractor/newsy.py | 1 - yt_dlp/extractor/nexx.py | 2 - yt_dlp/extractor/nfb.py | 1 - yt_dlp/extractor/nfhsnetwork.py | 4 +- yt_dlp/extractor/nfl.py | 1 - yt_dlp/extractor/nhk.py | 2 - yt_dlp/extractor/nhl.py | 1 - yt_dlp/extractor/niconico.py | 2 - yt_dlp/extractor/ninecninemedia.py | 1 - yt_dlp/extractor/ninegag.py | 1 - yt_dlp/extractor/njpwworld.py | 2 - yt_dlp/extractor/nobelprize.py | 1 - yt_dlp/extractor/noodlemagazine.py | 2 - yt_dlp/extractor/nova.py | 2 - yt_dlp/extractor/novaplay.py | 1 - yt_dlp/extractor/noz.py | 1 - yt_dlp/extractor/npo.py | 4 -- yt_dlp/extractor/npr.py | 2 - yt_dlp/extractor/nrk.py | 1 - yt_dlp/extractor/ntvde.py | 1 - yt_dlp/extractor/ntvru.py | 1 - yt_dlp/extractor/nuvid.py | 1 - yt_dlp/extractor/nytimes.py | 1 - yt_dlp/extractor/odnoklassniki.py | 2 - yt_dlp/extractor/olympics.py | 1 - yt_dlp/extractor/on24.py | 1 - yt_dlp/extractor/onefootball.py | 1 - yt_dlp/extractor/onet.py | 1 - yt_dlp/extractor/ooyala.py | 1 - yt_dlp/extractor/opencast.py | 2 - yt_dlp/extractor/openrec.py | 3 -- yt_dlp/extractor/ora.py | 1 - yt_dlp/extractor/orf.py | 4 -- yt_dlp/extractor/pandoratv.py | 1 - yt_dlp/extractor/panopto.py | 1 - yt_dlp/extractor/parlview.py | 1 - yt_dlp/extractor/patreon.py | 1 - yt_dlp/extractor/pbs.py | 1 - yt_dlp/extractor/pearvideo.py | 1 - yt_dlp/extractor/peekvids.py | 1 - yt_dlp/extractor/peertube.py | 1 - yt_dlp/extractor/peertv.py | 2 - yt_dlp/extractor/peloton.py | 1 - yt_dlp/extractor/performgroup.py | 1 - yt_dlp/extractor/periscope.py | 1 - yt_dlp/extractor/philharmoniedeparis.py | 1 - yt_dlp/extractor/picarto.py | 2 - yt_dlp/extractor/piksel.py | 3 +- yt_dlp/extractor/pinkbike.py | 1 - yt_dlp/extractor/pinterest.py | 1 - yt_dlp/extractor/pixivsketch.py | 1 - yt_dlp/extractor/pladform.py | 2 - yt_dlp/extractor/planetmarathi.py | 1 - yt_dlp/extractor/platzi.py | 1 - yt_dlp/extractor/playplustv.py | 1 - yt_dlp/extractor/plays.py | 1 - yt_dlp/extractor/playtvak.py | 1 - yt_dlp/extractor/playvid.py | 1 - yt_dlp/extractor/playwire.py | 1 - yt_dlp/extractor/pluralsight.py | 2 - yt_dlp/extractor/plutotv.py | 1 - yt_dlp/extractor/polsatgo.py | 1 - yt_dlp/extractor/polskieradio.py | 2 - yt_dlp/extractor/porncom.py | 2 - yt_dlp/extractor/pornflip.py | 1 - yt_dlp/extractor/pornhd.py | 1 - yt_dlp/extractor/pornhub.py | 4 -- yt_dlp/extractor/pornovoisines.py | 1 - yt_dlp/extractor/projectveritas.py | 1 - yt_dlp/extractor/prosiebensat1.py | 1 - yt_dlp/extractor/puhutv.py | 1 - yt_dlp/extractor/qqmusic.py | 1 - yt_dlp/extractor/r7.py | 1 - yt_dlp/extractor/radiko.py | 1 - yt_dlp/extractor/radiocanada.py | 1 - yt_dlp/extractor/radiode.py | 1 - yt_dlp/extractor/radiofrance.py | 1 - yt_dlp/extractor/radiojavan.py | 1 - yt_dlp/extractor/radlive.py | 1 - yt_dlp/extractor/rai.py | 6 --- yt_dlp/extractor/rcs.py | 1 - yt_dlp/extractor/rcti.py | 2 - yt_dlp/extractor/redbee.py | 6 +-- yt_dlp/extractor/redbulltv.py | 1 - yt_dlp/extractor/reddit.py | 1 - yt_dlp/extractor/redgifs.py | 1 - yt_dlp/extractor/redtube.py | 1 - yt_dlp/extractor/rentv.py | 1 - yt_dlp/extractor/restudy.py | 1 - yt_dlp/extractor/reuters.py | 1 - yt_dlp/extractor/rice.py | 1 - yt_dlp/extractor/rockstargames.py | 2 - yt_dlp/extractor/rokfin.py | 1 - yt_dlp/extractor/roosterteeth.py | 1 - yt_dlp/extractor/rte.py | 2 - yt_dlp/extractor/rtl2.py | 3 -- yt_dlp/extractor/rtlnl.py | 2 - yt_dlp/extractor/rts.py | 1 - yt_dlp/extractor/rtve.py | 2 - yt_dlp/extractor/rtvnh.py | 1 - yt_dlp/extractor/rtvs.py | 1 - yt_dlp/extractor/rtvslo.py | 1 - yt_dlp/extractor/rule34video.py | 2 - yt_dlp/extractor/rumble.py | 1 - yt_dlp/extractor/rutube.py | 1 - yt_dlp/extractor/rutv.py | 3 +- yt_dlp/extractor/ruutu.py | 2 - yt_dlp/extractor/sapo.py | 2 - yt_dlp/extractor/screen9.py | 1 - yt_dlp/extractor/scrolller.py | 2 - yt_dlp/extractor/senategov.py | 3 -- yt_dlp/extractor/sendtonews.py | 6 +-- yt_dlp/extractor/servus.py | 1 - yt_dlp/extractor/sexu.py | 1 - yt_dlp/extractor/seznamzpravy.py | 1 - yt_dlp/extractor/shahid.py | 1 - yt_dlp/extractor/shemaroome.py | 1 - yt_dlp/extractor/showroomlive.py | 1 - yt_dlp/extractor/sina.py | 1 - yt_dlp/extractor/sixplay.py | 1 - yt_dlp/extractor/skyit.py | 1 - yt_dlp/extractor/slideslive.py | 1 - yt_dlp/extractor/sohu.py | 1 - yt_dlp/extractor/sonyliv.py | 1 - yt_dlp/extractor/soundcloud.py | 1 - yt_dlp/extractor/sovietscloset.py | 1 - yt_dlp/extractor/spankbang.py | 2 - yt_dlp/extractor/spankwire.py | 1 - yt_dlp/extractor/sport5.py | 1 - yt_dlp/extractor/sportbox.py | 1 - yt_dlp/extractor/springboardplatform.py | 2 - yt_dlp/extractor/srgssr.py | 1 - yt_dlp/extractor/startrek.py | 1 - yt_dlp/extractor/steam.py | 2 - yt_dlp/extractor/streamable.py | 1 - yt_dlp/extractor/streamanity.py | 1 - yt_dlp/extractor/streamcz.py | 1 - yt_dlp/extractor/stripchat.py | 2 - yt_dlp/extractor/substack.py | 1 - yt_dlp/extractor/sunporno.py | 1 - yt_dlp/extractor/sverigesradio.py | 1 - yt_dlp/extractor/svt.py | 1 - yt_dlp/extractor/swrmediathek.py | 1 - yt_dlp/extractor/tagesschau.py | 2 - yt_dlp/extractor/tass.py | 1 - yt_dlp/extractor/teachertube.py | 2 - yt_dlp/extractor/teamcoco.py | 1 - yt_dlp/extractor/ted.py | 2 - yt_dlp/extractor/tele13.py | 1 - yt_dlp/extractor/telebruxelles.py | 1 - yt_dlp/extractor/telecinco.py | 1 - yt_dlp/extractor/telegraaf.py | 2 - yt_dlp/extractor/telegram.py | 1 - yt_dlp/extractor/telemb.py | 1 - yt_dlp/extractor/telemundo.py | 1 - yt_dlp/extractor/tencent.py | 1 - yt_dlp/extractor/tennistv.py | 2 - yt_dlp/extractor/tenplay.py | 1 - yt_dlp/extractor/theholetv.py | 1 - yt_dlp/extractor/theplatform.py | 3 -- yt_dlp/extractor/theta.py | 2 - yt_dlp/extractor/theweatherchannel.py | 1 - yt_dlp/extractor/threeqsdn.py | 8 ++-- yt_dlp/extractor/threespeak.py | 1 - yt_dlp/extractor/tiktok.py | 5 +-- yt_dlp/extractor/tnaflix.py | 1 - yt_dlp/extractor/toggle.py | 1 - yt_dlp/extractor/tokentube.py | 2 - yt_dlp/extractor/triller.py | 1 - yt_dlp/extractor/trovo.py | 2 - yt_dlp/extractor/tubetugraz.py | 1 - yt_dlp/extractor/tubitv.py | 2 - yt_dlp/extractor/tumblr.py | 1 - yt_dlp/extractor/tunein.py | 1 - yt_dlp/extractor/tunepk.py | 1 - yt_dlp/extractor/turbo.py | 1 - yt_dlp/extractor/turner.py | 2 - yt_dlp/extractor/tv2.py | 2 - yt_dlp/extractor/tv24ua.py | 1 - yt_dlp/extractor/tv2dk.py | 1 - yt_dlp/extractor/tv2hu.py | 1 - yt_dlp/extractor/tv4.py | 2 - yt_dlp/extractor/tv5mondeplus.py | 1 - yt_dlp/extractor/tvc.py | 1 - yt_dlp/extractor/tvigle.py | 1 - yt_dlp/extractor/tvn24.py | 1 - yt_dlp/extractor/tvnet.py | 1 - yt_dlp/extractor/tvnow.py | 2 - yt_dlp/extractor/tvopengr.py | 1 - yt_dlp/extractor/tvp.py | 2 - yt_dlp/extractor/tvplay.py | 4 -- yt_dlp/extractor/tvplayer.py | 1 - yt_dlp/extractor/tweakers.py | 1 - yt_dlp/extractor/twentymin.py | 1 - yt_dlp/extractor/twitcasting.py | 6 +-- yt_dlp/extractor/twitch.py | 2 - yt_dlp/extractor/twitter.py | 4 +- yt_dlp/extractor/udemy.py | 2 - yt_dlp/extractor/udn.py | 2 - yt_dlp/extractor/umg.py | 1 - yt_dlp/extractor/unistra.py | 1 - yt_dlp/extractor/uol.py | 1 - yt_dlp/extractor/uplynk.py | 1 - yt_dlp/extractor/urort.py | 1 - yt_dlp/extractor/urplay.py | 1 - yt_dlp/extractor/ustream.py | 2 - yt_dlp/extractor/ustudio.py | 2 - yt_dlp/extractor/utreon.py | 1 - yt_dlp/extractor/veo.py | 2 - yt_dlp/extractor/veoh.py | 1 - yt_dlp/extractor/vevo.py | 1 - yt_dlp/extractor/vgtv.py | 2 - yt_dlp/extractor/vice.py | 1 - yt_dlp/extractor/viddler.py | 1 - yt_dlp/extractor/videa.py | 1 - yt_dlp/extractor/videocampus_sachsen.py | 1 - yt_dlp/extractor/videomore.py | 1 - yt_dlp/extractor/videopress.py | 1 - yt_dlp/extractor/vidio.py | 3 -- yt_dlp/extractor/vidlii.py | 1 - yt_dlp/extractor/viewlift.py | 1 - yt_dlp/extractor/viidea.py | 1 - yt_dlp/extractor/viki.py | 1 - yt_dlp/extractor/vimeo.py | 17 +++---- yt_dlp/extractor/vimm.py | 2 - yt_dlp/extractor/vimple.py | 1 - yt_dlp/extractor/vine.py | 1 - yt_dlp/extractor/viqeo.py | 1 - yt_dlp/extractor/viu.py | 2 - yt_dlp/extractor/vk.py | 1 - yt_dlp/extractor/vlive.py | 2 - yt_dlp/extractor/vodplatform.py | 1 - yt_dlp/extractor/voicerepublic.py | 1 - yt_dlp/extractor/voicy.py | 1 - yt_dlp/extractor/voot.py | 1 - yt_dlp/extractor/voxmedia.py | 2 - yt_dlp/extractor/vrv.py | 1 - yt_dlp/extractor/vshare.py | 2 - yt_dlp/extractor/vvvvid.py | 1 - yt_dlp/extractor/vzaar.py | 2 - yt_dlp/extractor/walla.py | 1 - yt_dlp/extractor/wasdtv.py | 2 - yt_dlp/extractor/wat.py | 2 - yt_dlp/extractor/watchbox.py | 1 - yt_dlp/extractor/wdr.py | 2 - yt_dlp/extractor/webcaster.py | 1 - yt_dlp/extractor/webofstories.py | 2 - yt_dlp/extractor/weibo.py | 2 - yt_dlp/extractor/whowatch.py | 1 - yt_dlp/extractor/willow.py | 1 - yt_dlp/extractor/wimtv.py | 1 - yt_dlp/extractor/wistia.py | 2 - yt_dlp/extractor/wppilot.py | 2 - yt_dlp/extractor/wsj.py | 1 - yt_dlp/extractor/xfileshare.py | 1 - yt_dlp/extractor/xhamster.py | 3 -- yt_dlp/extractor/xinpianchang.py | 2 - yt_dlp/extractor/xnxx.py | 1 - yt_dlp/extractor/xstream.py | 1 - yt_dlp/extractor/xtube.py | 1 - yt_dlp/extractor/xuite.py | 1 - yt_dlp/extractor/xvideos.py | 2 - yt_dlp/extractor/yahoo.py | 3 -- yt_dlp/extractor/yandexdisk.py | 1 - yt_dlp/extractor/yandexvideo.py | 3 -- yt_dlp/extractor/yapfiles.py | 1 - yt_dlp/extractor/yinyuetai.py | 1 - yt_dlp/extractor/ynet.py | 1 - yt_dlp/extractor/youku.py | 1 - yt_dlp/extractor/youporn.py | 1 - yt_dlp/extractor/youtube.py | 6 +-- yt_dlp/extractor/zapiks.py | 1 - yt_dlp/extractor/zattoo.py | 1 - yt_dlp/extractor/zdf.py | 3 +- yt_dlp/extractor/zee5.py | 1 - yt_dlp/extractor/zeenews.py | 1 - yt_dlp/extractor/zhihu.py | 1 - yt_dlp/extractor/zingmp3.py | 1 - yt_dlp/extractor/zoom.py | 2 - yt_dlp/extractor/zype.py | 1 - 579 files changed, 69 insertions(+), 918 deletions(-) diff --git a/test/test_InfoExtractor.py b/test/test_InfoExtractor.py index 016a2ac7f..683ead315 100644 --- a/test/test_InfoExtractor.py +++ b/test/test_InfoExtractor.py @@ -41,7 +41,9 @@ class InfoExtractorTestRequestHandler(http.server.BaseHTTPRequestHandler): class DummyIE(InfoExtractor): - pass + def _sort_formats(self, formats, field_preference=[]): + self._downloader.sort_formats( + {'formats': formats, '_format_sort_fields': field_preference}) class TestInfoExtractor(unittest.TestCase): diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py index 60e457108..8da1e5e4b 100644 --- a/test/test_YoutubeDL.py +++ b/test/test_YoutubeDL.py @@ -68,8 +68,7 @@ class TestFormatSelection(unittest.TestCase): {'ext': 'mp4', 'height': 460, 'url': TEST_URL}, ] info_dict = _make_result(formats) - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['ext'], 'webm') @@ -82,8 +81,7 @@ class TestFormatSelection(unittest.TestCase): {'ext': 'mp4', 'height': 1080, 'url': TEST_URL}, ] info_dict['formats'] = formats - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['ext'], 'mp4') @@ -97,8 +95,7 @@ class TestFormatSelection(unittest.TestCase): {'ext': 'flv', 'height': 720, 'url': TEST_URL}, ] info_dict['formats'] = formats - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['ext'], 'mp4') @@ -110,15 +107,14 @@ class TestFormatSelection(unittest.TestCase): {'ext': 'webm', 'height': 720, 'url': TEST_URL}, ] info_dict['formats'] = formats - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['ext'], 'webm') def test_format_selection(self): formats = [ - {'format_id': '35', 'ext': 'mp4', 'preference': 1, 'url': TEST_URL}, + {'format_id': '35', 'ext': 'mp4', 'preference': 0, 'url': TEST_URL}, {'format_id': 'example-with-dashes', 'ext': 'webm', 'preference': 1, 'url': TEST_URL}, {'format_id': '45', 'ext': 'webm', 'preference': 2, 'url': TEST_URL}, {'format_id': '47', 'ext': 'webm', 'preference': 3, 'url': TEST_URL}, @@ -186,22 +182,19 @@ class TestFormatSelection(unittest.TestCase): info_dict = _make_result(formats) ydl = YDL({'format': 'best'}) - ie = YoutubeIE(ydl) - ie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(copy.deepcopy(info_dict)) downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['format_id'], 'aac-64') ydl = YDL({'format': 'mp3'}) - ie = YoutubeIE(ydl) - ie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(copy.deepcopy(info_dict)) downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['format_id'], 'mp3-64') ydl = YDL({'prefer_free_formats': True}) - ie = YoutubeIE(ydl) - ie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(copy.deepcopy(info_dict)) downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['format_id'], 'ogg-64') @@ -346,8 +339,7 @@ class TestFormatSelection(unittest.TestCase): info_dict = _make_result(list(formats_order), extractor='youtube') ydl = YDL({'format': 'bestvideo+bestaudio'}) - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['format_id'], '248+172') @@ -355,40 +347,35 @@ class TestFormatSelection(unittest.TestCase): info_dict = _make_result(list(formats_order), extractor='youtube') ydl = YDL({'format': 'bestvideo[height>=999999]+bestaudio/best'}) - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['format_id'], '38') info_dict = _make_result(list(formats_order), extractor='youtube') ydl = YDL({'format': 'bestvideo/best,bestaudio'}) - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded_ids = [info['format_id'] for info in ydl.downloaded_info_dicts] self.assertEqual(downloaded_ids, ['137', '141']) info_dict = _make_result(list(formats_order), extractor='youtube') ydl = YDL({'format': '(bestvideo[ext=mp4],bestvideo[ext=webm])+bestaudio'}) - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded_ids = [info['format_id'] for info in ydl.downloaded_info_dicts] self.assertEqual(downloaded_ids, ['137+141', '248+141']) info_dict = _make_result(list(formats_order), extractor='youtube') ydl = YDL({'format': '(bestvideo[ext=mp4],bestvideo[ext=webm])[height<=720]+bestaudio'}) - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded_ids = [info['format_id'] for info in ydl.downloaded_info_dicts] self.assertEqual(downloaded_ids, ['136+141', '247+141']) info_dict = _make_result(list(formats_order), extractor='youtube') ydl = YDL({'format': '(bestvideo[ext=none]/bestvideo[ext=webm])+bestaudio'}) - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded_ids = [info['format_id'] for info in ydl.downloaded_info_dicts] self.assertEqual(downloaded_ids, ['248+141']) @@ -396,16 +383,14 @@ class TestFormatSelection(unittest.TestCase): for f1, f2 in zip(formats_order, formats_order[1:]): info_dict = _make_result([f1, f2], extractor='youtube') ydl = YDL({'format': 'best/bestvideo'}) - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['format_id'], f1['format_id']) info_dict = _make_result([f2, f1], extractor='youtube') ydl = YDL({'format': 'best/bestvideo'}) - yie = YoutubeIE(ydl) - yie._sort_formats(info_dict['formats']) + ydl.sort_formats(info_dict) ydl.process_ie_result(info_dict) downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['format_id'], f1['format_id']) @@ -480,7 +465,7 @@ class TestFormatSelection(unittest.TestCase): for f in formats: f['url'] = 'http://_/' f['ext'] = 'unknown' - info_dict = _make_result(formats) + info_dict = _make_result(formats, _format_sort_fields=('id', )) ydl = YDL({'format': 'best[filesize<3000]'}) ydl.process_ie_result(info_dict) diff --git a/yt_dlp/extractor/abc.py b/yt_dlp/extractor/abc.py index 03f10ab23..0ca76b85a 100644 --- a/yt_dlp/extractor/abc.py +++ b/yt_dlp/extractor/abc.py @@ -155,8 +155,6 @@ class ABCIE(InfoExtractor): 'format_id': format_id }) - self._sort_formats(formats) - return { 'id': video_id, 'title': self._og_search_title(webpage), @@ -221,7 +219,6 @@ class ABCIViewIE(InfoExtractor): entry_protocol='m3u8_native', m3u8_id='hls', fatal=False) if formats: break - self._sort_formats(formats) subtitles = {} src_vtt = stream.get('captions', {}).get('src-vtt') diff --git a/yt_dlp/extractor/abcotvs.py b/yt_dlp/extractor/abcotvs.py index 44a9f8ca5..6dca19de4 100644 --- a/yt_dlp/extractor/abcotvs.py +++ b/yt_dlp/extractor/abcotvs.py @@ -78,7 +78,6 @@ class ABCOTVSIE(InfoExtractor): 'url': mp4_url, 'width': 640, }) - self._sort_formats(formats) image = video.get('image') or {} @@ -119,7 +118,6 @@ class ABCOTVSClipsIE(InfoExtractor): title = video_data['title'] formats = self._extract_m3u8_formats( video_data['videoURL'].split('?')[0], video_id, 'mp4') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/acfun.py b/yt_dlp/extractor/acfun.py index 9ec259a75..dc5792944 100644 --- a/yt_dlp/extractor/acfun.py +++ b/yt_dlp/extractor/acfun.py @@ -27,7 +27,6 @@ class AcFunVideoBaseIE(InfoExtractor): **parse_codecs(video.get('codecs', '')) }) - self._sort_formats(formats) return { 'id': video_id, 'formats': formats, diff --git a/yt_dlp/extractor/adn.py b/yt_dlp/extractor/adn.py index 16f648de3..e0c18c877 100644 --- a/yt_dlp/extractor/adn.py +++ b/yt_dlp/extractor/adn.py @@ -235,7 +235,6 @@ Format: Marked,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text''' for f in m3u8_formats: f['language'] = 'fr' formats.extend(m3u8_formats) - self._sort_formats(formats) video = (self._download_json( self._API_BASE_URL + 'video/%s' % video_id, video_id, diff --git a/yt_dlp/extractor/adobetv.py b/yt_dlp/extractor/adobetv.py index d8e07b3a1..d1525a1af 100644 --- a/yt_dlp/extractor/adobetv.py +++ b/yt_dlp/extractor/adobetv.py @@ -70,7 +70,6 @@ class AdobeTVBaseIE(InfoExtractor): }) s3_extracted = True formats.append(f) - self._sort_formats(formats) return { 'id': video_id, @@ -269,7 +268,6 @@ class AdobeTVVideoIE(AdobeTVBaseIE): 'width': int_or_none(source.get('width') or None), 'url': source_src, }) - self._sort_formats(formats) # For both metadata and downloaded files the duration varies among # formats. I just pick the max one diff --git a/yt_dlp/extractor/adultswim.py b/yt_dlp/extractor/adultswim.py index 1368954bc..bd29eb43e 100644 --- a/yt_dlp/extractor/adultswim.py +++ b/yt_dlp/extractor/adultswim.py @@ -180,7 +180,6 @@ class AdultSwimIE(TurnerBaseIE): info['subtitles'].setdefault('en', []).append({ 'url': asset_url, }) - self._sort_formats(info['formats']) return info else: diff --git a/yt_dlp/extractor/aenetworks.py b/yt_dlp/extractor/aenetworks.py index 094c57bf9..d7c401016 100644 --- a/yt_dlp/extractor/aenetworks.py +++ b/yt_dlp/extractor/aenetworks.py @@ -62,7 +62,6 @@ class AENetworksBaseIE(ThePlatformIE): # XXX: Do not subclass from concrete IE subtitles = self._merge_subtitles(subtitles, tp_subtitles) if last_e and not formats: raise last_e - self._sort_formats(formats) return { 'id': video_id, 'formats': formats, diff --git a/yt_dlp/extractor/afreecatv.py b/yt_dlp/extractor/afreecatv.py index bfcc08030..9276fe799 100644 --- a/yt_dlp/extractor/afreecatv.py +++ b/yt_dlp/extractor/afreecatv.py @@ -338,7 +338,6 @@ class AfreecaTVIE(InfoExtractor): }] if not formats and not self.get_param('ignore_no_formats'): continue - self._sort_formats(formats) file_info = common_entry.copy() file_info.update({ 'id': format_id, @@ -464,8 +463,6 @@ class AfreecaTVLiveIE(AfreecaTVIE): # XXX: Do not subclass from concrete IE 'quality': quality_key(quality_str), }) - self._sort_formats(formats) - station_info = self._download_json( 'https://st.afreecatv.com/api/get_station_status.php', broadcast_no, query={'szBjId': broadcaster_id}, fatal=False, diff --git a/yt_dlp/extractor/agora.py b/yt_dlp/extractor/agora.py index 714414bd4..abb2d3ff2 100644 --- a/yt_dlp/extractor/agora.py +++ b/yt_dlp/extractor/agora.py @@ -55,7 +55,6 @@ class WyborczaVideoIE(InfoExtractor): if meta['files'].get('dash'): formats.extend(self._extract_mpd_formats(base_url + meta['files']['dash'], video_id)) - self._sort_formats(formats) return { 'id': video_id, 'formats': formats, @@ -179,7 +178,6 @@ class TokFMPodcastIE(InfoExtractor): 'acodec': ext, }) - self._sort_formats(formats) return { 'id': media_id, 'formats': formats, diff --git a/yt_dlp/extractor/allocine.py b/yt_dlp/extractor/allocine.py index 1f881e2a0..2d342cf03 100644 --- a/yt_dlp/extractor/allocine.py +++ b/yt_dlp/extractor/allocine.py @@ -112,8 +112,6 @@ class AllocineIE(InfoExtractor): }) duration, view_count, timestamp = [None] * 3 - self._sort_formats(formats) - return { 'id': video_id, 'display_id': display_id, diff --git a/yt_dlp/extractor/alsace20tv.py b/yt_dlp/extractor/alsace20tv.py index d16ab496e..ea3332e3d 100644 --- a/yt_dlp/extractor/alsace20tv.py +++ b/yt_dlp/extractor/alsace20tv.py @@ -22,7 +22,6 @@ class Alsace20TVBaseIE(InfoExtractor): self._extract_smil_formats(fmt_url, video_id, fatal=False) if '/smil:_' in fmt_url else self._extract_mpd_formats(fmt_url, video_id, mpd_id=res, fatal=False)) - self._sort_formats(formats) webpage = (url and self._download_webpage(url, video_id, fatal=False)) or '' thumbnail = url_or_none(dict_get(info, ('image', 'preview', )) or self._og_search_thumbnail(webpage)) diff --git a/yt_dlp/extractor/alura.py b/yt_dlp/extractor/alura.py index ae7115f9f..bfe066bc6 100644 --- a/yt_dlp/extractor/alura.py +++ b/yt_dlp/extractor/alura.py @@ -63,8 +63,6 @@ class AluraIE(InfoExtractor): f['height'] = int('720' if m.group('res') == 'hd' else '480') formats.extend(video_format) - self._sort_formats(formats) - return { 'id': video_id, 'title': video_title, diff --git a/yt_dlp/extractor/amcnetworks.py b/yt_dlp/extractor/amcnetworks.py index 9369a66f7..c58bc7bfb 100644 --- a/yt_dlp/extractor/amcnetworks.py +++ b/yt_dlp/extractor/amcnetworks.py @@ -106,7 +106,6 @@ class AMCNetworksIE(ThePlatformIE): # XXX: Do not subclass from concrete IE media_url = update_url_query(media_url, query) formats, subtitles = self._extract_theplatform_smil( media_url, video_id) - self._sort_formats(formats) thumbnails = [] thumbnail_urls = [properties.get('imageDesktop')] diff --git a/yt_dlp/extractor/amp.py b/yt_dlp/extractor/amp.py index 6015baad5..b0cbd775c 100644 --- a/yt_dlp/extractor/amp.py +++ b/yt_dlp/extractor/amp.py @@ -84,8 +84,6 @@ class AMPIE(InfoExtractor): # XXX: Conventionally, base classes should end with 'ext': ext, }) - self._sort_formats(formats) - timestamp = unified_timestamp(item.get('pubDate'), ' ') or parse_iso8601(item.get('dc-date')) return { diff --git a/yt_dlp/extractor/ant1newsgr.py b/yt_dlp/extractor/ant1newsgr.py index fac476e21..7b384b22d 100644 --- a/yt_dlp/extractor/ant1newsgr.py +++ b/yt_dlp/extractor/ant1newsgr.py @@ -19,7 +19,6 @@ class Ant1NewsGrBaseIE(InfoExtractor): raise ExtractorError('no source found for %s' % video_id) formats, subs = (self._extract_m3u8_formats_and_subtitles(source, video_id, 'mp4') if determine_ext(source) == 'm3u8' else ([{'url': source}], {})) - self._sort_formats(formats) thumbnails = scale_thumbnails_to_max_format_width( formats, [{'url': info['thumb']}], r'(?<=/imgHandler/)\d+') return { diff --git a/yt_dlp/extractor/anvato.py b/yt_dlp/extractor/anvato.py index 0d7575a1f..79bfe412b 100644 --- a/yt_dlp/extractor/anvato.py +++ b/yt_dlp/extractor/anvato.py @@ -354,8 +354,6 @@ class AnvatoIE(InfoExtractor): }) formats.append(a_format) - self._sort_formats(formats) - subtitles = {} for caption in video_data.get('captions', []): a_caption = { diff --git a/yt_dlp/extractor/aol.py b/yt_dlp/extractor/aol.py index 5200f9d9d..6949ca974 100644 --- a/yt_dlp/extractor/aol.py +++ b/yt_dlp/extractor/aol.py @@ -119,7 +119,6 @@ class AolIE(YahooIE): # XXX: Do not subclass from concrete IE 'height': int_or_none(qs.get('h', [None])[0]), }) formats.append(f) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/apa.py b/yt_dlp/extractor/apa.py index c9147e855..1ea0b1de4 100644 --- a/yt_dlp/extractor/apa.py +++ b/yt_dlp/extractor/apa.py @@ -72,7 +72,6 @@ class APAIE(InfoExtractor): 'format_id': format_id, 'height': height, }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/aparat.py b/yt_dlp/extractor/aparat.py index 90464556d..4a989d837 100644 --- a/yt_dlp/extractor/aparat.py +++ b/yt_dlp/extractor/aparat.py @@ -73,7 +73,6 @@ class AparatIE(InfoExtractor): r'(\d+)[pP]', label or '', 'height', default=None)), }) - self._sort_formats(formats) info = self._search_json_ld(webpage, video_id, default={}) diff --git a/yt_dlp/extractor/appletrailers.py b/yt_dlp/extractor/appletrailers.py index 6b63f070d..2e0b0a8c9 100644 --- a/yt_dlp/extractor/appletrailers.py +++ b/yt_dlp/extractor/appletrailers.py @@ -120,7 +120,6 @@ class AppleTrailersIE(InfoExtractor): 'height': int_or_none(size_data.get('height')), 'language': version[:2], }) - self._sort_formats(formats) entries.append({ 'id': movie + '-' + re.sub(r'[^a-zA-Z0-9]', '', clip_title).lower(), @@ -185,8 +184,6 @@ class AppleTrailersIE(InfoExtractor): 'height': int_or_none(format['height']), }) - self._sort_formats(formats) - playlist.append({ '_type': 'video', 'id': video_id, diff --git a/yt_dlp/extractor/archiveorg.py b/yt_dlp/extractor/archiveorg.py index 4218f52d6..90dda9f53 100644 --- a/yt_dlp/extractor/archiveorg.py +++ b/yt_dlp/extractor/archiveorg.py @@ -312,7 +312,7 @@ class ArchiveOrgIE(InfoExtractor): }) for entry in entries.values(): - self._sort_formats(entry['formats'], ('source', )) + entry['_format_sort_fields'] = ('source', ) if len(entries) == 1: # If there's only one item, use it as the main info dict diff --git a/yt_dlp/extractor/arcpublishing.py b/yt_dlp/extractor/arcpublishing.py index de9ccc538..febd3d28a 100644 --- a/yt_dlp/extractor/arcpublishing.py +++ b/yt_dlp/extractor/arcpublishing.py @@ -144,7 +144,6 @@ class ArcPublishingIE(InfoExtractor): 'url': s_url, 'quality': -10, }) - self._sort_formats(formats) subtitles = {} for subtitle in (try_get(video, lambda x: x['subtitles']['urls'], list) or []): diff --git a/yt_dlp/extractor/ard.py b/yt_dlp/extractor/ard.py index f294679ef..0a8a8746a 100644 --- a/yt_dlp/extractor/ard.py +++ b/yt_dlp/extractor/ard.py @@ -40,8 +40,6 @@ class ARDMediathekBaseIE(InfoExtractor): 'This video is not available due to geoblocking', countries=self._GEO_COUNTRIES, metadata_available=True) - self._sort_formats(formats) - subtitles = {} subtitle_url = media_info.get('_subtitleUrl') if subtitle_url: @@ -262,7 +260,6 @@ class ARDMediathekIE(ARDMediathekBaseIE): 'format_id': fid, 'url': furl, }) - self._sort_formats(formats) info = { 'formats': formats, } @@ -371,7 +368,6 @@ class ARDIE(InfoExtractor): continue f['url'] = format_url formats.append(f) - self._sort_formats(formats) _SUB_FORMATS = ( ('./dataTimedText', 'ttml'), diff --git a/yt_dlp/extractor/arkena.py b/yt_dlp/extractor/arkena.py index 9a0273e2c..de36ec886 100644 --- a/yt_dlp/extractor/arkena.py +++ b/yt_dlp/extractor/arkena.py @@ -136,7 +136,6 @@ class ArkenaIE(InfoExtractor): elif mime_type == 'application/vnd.ms-sstr+xml': formats.extend(self._extract_ism_formats( href, video_id, ism_id='mss', fatal=False)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/arnes.py b/yt_dlp/extractor/arnes.py index c80ce2233..a493714d1 100644 --- a/yt_dlp/extractor/arnes.py +++ b/yt_dlp/extractor/arnes.py @@ -73,7 +73,6 @@ class ArnesIE(InfoExtractor): 'width': int_or_none(media.get('width')), 'height': int_or_none(media.get('height')), }) - self._sort_formats(formats) channel = video.get('channel') or {} channel_id = channel.get('url') diff --git a/yt_dlp/extractor/arte.py b/yt_dlp/extractor/arte.py index b60fa0233..54e4d2d0c 100644 --- a/yt_dlp/extractor/arte.py +++ b/yt_dlp/extractor/arte.py @@ -186,7 +186,6 @@ class ArteTVIE(ArteTVBaseIE): formats.extend(secondary_formats) self._remove_duplicate_formats(formats) - self._sort_formats(formats) metadata = config['data']['attributes']['metadata'] diff --git a/yt_dlp/extractor/atresplayer.py b/yt_dlp/extractor/atresplayer.py index 39d1f1cc5..a20e7f988 100644 --- a/yt_dlp/extractor/atresplayer.py +++ b/yt_dlp/extractor/atresplayer.py @@ -84,7 +84,6 @@ class AtresPlayerIE(InfoExtractor): elif src_type == 'application/dash+xml': formats, subtitles = self._extract_mpd_formats( src, video_id, mpd_id='dash', fatal=False) - self._sort_formats(formats) heartbeat = episode.get('heartbeat') or {} omniture = episode.get('omniture') or {} diff --git a/yt_dlp/extractor/atvat.py b/yt_dlp/extractor/atvat.py index 2311837e9..d6ed9e495 100644 --- a/yt_dlp/extractor/atvat.py +++ b/yt_dlp/extractor/atvat.py @@ -49,7 +49,6 @@ class ATVAtIE(InfoExtractor): 'url': source_url, 'format_id': protocol, }) - self._sort_formats(formats) return { 'id': clip_id, diff --git a/yt_dlp/extractor/audimedia.py b/yt_dlp/extractor/audimedia.py index c1c4f67d0..35114e545 100644 --- a/yt_dlp/extractor/audimedia.py +++ b/yt_dlp/extractor/audimedia.py @@ -76,7 +76,6 @@ class AudiMediaIE(InfoExtractor): 'format_id': 'http-%s' % bitrate, }) formats.append(f) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/banbye.py b/yt_dlp/extractor/banbye.py index 92f567c5d..c87342565 100644 --- a/yt_dlp/extractor/banbye.py +++ b/yt_dlp/extractor/banbye.py @@ -80,8 +80,6 @@ class BanByeIE(BanByeBaseIE): 'url': f'{self._CDN_BASE}/video/{video_id}/{quality}.mp4', } for quality in data['quality']] - self._sort_formats(formats) - return { 'id': video_id, 'title': data.get('title'), diff --git a/yt_dlp/extractor/bandcamp.py b/yt_dlp/extractor/bandcamp.py index 7dcace2c6..de81e0de7 100644 --- a/yt_dlp/extractor/bandcamp.py +++ b/yt_dlp/extractor/bandcamp.py @@ -184,8 +184,6 @@ class BandcampIE(InfoExtractor): 'acodec': format_id.split('-')[0], }) - self._sort_formats(formats) - title = '%s - %s' % (artist, track) if artist else track if not duration: @@ -363,7 +361,6 @@ class BandcampWeeklyIE(BandcampIE): # XXX: Do not subclass from concrete IE 'ext': ext, 'vcodec': 'none', }) - self._sort_formats(formats) title = show.get('audio_title') or 'Bandcamp Weekly' subtitle = show.get('subtitle') diff --git a/yt_dlp/extractor/bannedvideo.py b/yt_dlp/extractor/bannedvideo.py index ec9bdd8ca..51e722057 100644 --- a/yt_dlp/extractor/bannedvideo.py +++ b/yt_dlp/extractor/bannedvideo.py @@ -135,7 +135,6 @@ query GetCommentReplies($id: String!) { formats.extend(self._extract_m3u8_formats( video_info.get('streamUrl'), video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', live=True)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/bbc.py b/yt_dlp/extractor/bbc.py index 35a7a165c..9d28e70a3 100644 --- a/yt_dlp/extractor/bbc.py +++ b/yt_dlp/extractor/bbc.py @@ -575,8 +575,6 @@ class BBCCoUkIE(InfoExtractor): else: programme_id, title, description, duration, formats, subtitles = self._download_playlist(group_id) - self._sort_formats(formats) - return { 'id': programme_id, 'title': title, @@ -890,7 +888,6 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE def _extract_from_playlist_sxml(self, url, playlist_id, timestamp): programme_id, title, description, duration, formats, subtitles = \ self._process_legacy_playlist_url(url, playlist_id) - self._sort_formats(formats) return { 'id': programme_id, 'title': title, @@ -954,7 +951,6 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE duration = int_or_none(items[0].get('duration')) programme_id = items[0].get('vpid') formats, subtitles = self._download_media_selector(programme_id) - self._sort_formats(formats) entries.append({ 'id': programme_id, 'title': title, @@ -991,7 +987,6 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE continue raise if entry: - self._sort_formats(entry['formats']) entries.append(entry) if entries: @@ -1015,7 +1010,6 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE if programme_id: formats, subtitles = self._download_media_selector(programme_id) - self._sort_formats(formats) # digitalData may be missing (e.g. http://www.bbc.com/autos/story/20130513-hyundais-rock-star) digital_data = self._parse_json( self._search_regex( @@ -1047,7 +1041,6 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE if version_id: title = smp_data['title'] formats, subtitles = self._download_media_selector(version_id) - self._sort_formats(formats) image_url = smp_data.get('holdingImageURL') display_date = init_data.get('displayDate') topic_title = init_data.get('topicTitle') @@ -1089,7 +1082,6 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE continue title = lead_media.get('title') or self._og_search_title(webpage) formats, subtitles = self._download_media_selector(programme_id) - self._sort_formats(formats) description = lead_media.get('summary') uploader = lead_media.get('masterBrand') uploader_id = lead_media.get('mid') @@ -1118,7 +1110,6 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE if current_programme and programme_id and current_programme.get('type') == 'playable_item': title = current_programme.get('titles', {}).get('tertiary') or playlist_title formats, subtitles = self._download_media_selector(programme_id) - self._sort_formats(formats) synopses = current_programme.get('synopses') or {} network = current_programme.get('network') or {} duration = int_or_none( @@ -1151,7 +1142,6 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE clip_title = clip.get('title') if clip_vpid and clip_title: formats, subtitles = self._download_media_selector(clip_vpid) - self._sort_formats(formats) return { 'id': clip_vpid, 'title': clip_title, @@ -1173,7 +1163,6 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE if not programme_id: continue formats, subtitles = self._download_media_selector(programme_id) - self._sort_formats(formats) entries.append({ 'id': programme_id, 'title': playlist_title, @@ -1205,7 +1194,6 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE if not (item_id and item_title): continue formats, subtitles = self._download_media_selector(item_id) - self._sort_formats(formats) item_desc = None blocks = try_get(media, lambda x: x['summary']['blocks'], list) if blocks: @@ -1306,7 +1294,6 @@ class BBCIE(BBCCoUkIE): # XXX: Do not subclass from concrete IE formats, subtitles = self._extract_from_media_meta(media_meta, playlist_id) if not formats and not self.get_param('ignore_no_formats'): continue - self._sort_formats(formats) video_id = media_meta.get('externalId') if not video_id: diff --git a/yt_dlp/extractor/beatport.py b/yt_dlp/extractor/beatport.py index f71f1f308..0aecbd089 100644 --- a/yt_dlp/extractor/beatport.py +++ b/yt_dlp/extractor/beatport.py @@ -74,7 +74,6 @@ class BeatportIE(InfoExtractor): fmt['abr'] = 96 fmt['asr'] = 44100 formats.append(fmt) - self._sort_formats(formats) images = [] for name, info in track['images'].items(): diff --git a/yt_dlp/extractor/beeg.py b/yt_dlp/extractor/beeg.py index 5957e370a..52ee68eca 100644 --- a/yt_dlp/extractor/beeg.py +++ b/yt_dlp/extractor/beeg.py @@ -76,8 +76,6 @@ class BeegIE(InfoExtractor): f['height'] = height formats.extend(current_formats) - self._sort_formats(formats) - return { 'id': video_id, 'display_id': first_fact.get('id'), diff --git a/yt_dlp/extractor/bigflix.py b/yt_dlp/extractor/bigflix.py index 6b2797ca0..02d1ba0e3 100644 --- a/yt_dlp/extractor/bigflix.py +++ b/yt_dlp/extractor/bigflix.py @@ -63,8 +63,6 @@ class BigflixIE(InfoExtractor): 'url': decode_url(file_url), }) - self._sort_formats(formats) - description = self._html_search_meta('description', webpage) return { diff --git a/yt_dlp/extractor/bilibili.py b/yt_dlp/extractor/bilibili.py index 8a0e10da8..bc0424194 100644 --- a/yt_dlp/extractor/bilibili.py +++ b/yt_dlp/extractor/bilibili.py @@ -67,7 +67,6 @@ class BilibiliBaseIE(InfoExtractor): self.to_screen(f'Format(s) {", ".join(format_names[i] for i in missing_formats)} are missing; ' f'you have to login or become premium member to download them. {self._login_hint()}') - self._sort_formats(formats) return formats def json2srt(self, json_data): @@ -879,7 +878,6 @@ class BiliIntlBaseIE(InfoExtractor): 'filesize': aud.get('size'), }) - self._sort_formats(formats) return formats def _extract_video_info(self, video_data, *, ep_id=None, aid=None): @@ -1105,7 +1103,6 @@ class BiliLiveIE(InfoExtractor): }) for fmt in traverse_obj(stream_data, ('playurl_info', 'playurl', 'stream', ..., 'format', ...)) or []: formats.extend(self._parse_formats(qn, fmt)) - self._sort_formats(formats) return { 'id': room_id, diff --git a/yt_dlp/extractor/biqle.py b/yt_dlp/extractor/biqle.py index 3a4234491..027753503 100644 --- a/yt_dlp/extractor/biqle.py +++ b/yt_dlp/extractor/biqle.py @@ -86,7 +86,6 @@ class BIQLEIE(InfoExtractor): 'height': int_or_none(height), 'ext': ext, }) - self._sort_formats(formats) thumbnails = [] for k, v in item.items(): diff --git a/yt_dlp/extractor/bitchute.py b/yt_dlp/extractor/bitchute.py index 9e3d6337a..10e7b0b2b 100644 --- a/yt_dlp/extractor/bitchute.py +++ b/yt_dlp/extractor/bitchute.py @@ -117,7 +117,6 @@ class BitChuteIE(InfoExtractor): self.raise_no_formats( 'Video is unavailable. Please make sure this video is playable in the browser ' 'before reporting this issue.', expected=True, video_id=video_id) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/bitwave.py b/yt_dlp/extractor/bitwave.py index bd8eac1f1..a82cd263a 100644 --- a/yt_dlp/extractor/bitwave.py +++ b/yt_dlp/extractor/bitwave.py @@ -45,7 +45,6 @@ class BitwaveStreamIE(InfoExtractor): formats = self._extract_m3u8_formats( channel['data']['url'], username, 'mp4') - self._sort_formats(formats) return { 'id': username, diff --git a/yt_dlp/extractor/bloomberg.py b/yt_dlp/extractor/bloomberg.py index c842c342c..792155e51 100644 --- a/yt_dlp/extractor/bloomberg.py +++ b/yt_dlp/extractor/bloomberg.py @@ -67,7 +67,6 @@ class BloombergIE(InfoExtractor): else: formats.extend(self._extract_f4m_formats( stream_url, video_id, f4m_id='hds', fatal=False)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/bokecc.py b/yt_dlp/extractor/bokecc.py index 0c081750e..ca326f25f 100644 --- a/yt_dlp/extractor/bokecc.py +++ b/yt_dlp/extractor/bokecc.py @@ -21,8 +21,6 @@ class BokeCCBaseIE(InfoExtractor): 'quality': int(quality.attrib['value']), } for quality in info_xml.findall('./video/quality')] - self._sort_formats(formats) - return formats diff --git a/yt_dlp/extractor/bongacams.py b/yt_dlp/extractor/bongacams.py index 9ba166b04..bf955668d 100644 --- a/yt_dlp/extractor/bongacams.py +++ b/yt_dlp/extractor/bongacams.py @@ -57,7 +57,6 @@ class BongaCamsIE(InfoExtractor): formats = self._extract_m3u8_formats( '%s/hls/stream_%s/playlist.m3u8' % (server_url, uploader_id), channel_id, 'mp4', m3u8_id='hls', live=True) - self._sort_formats(formats) return { 'id': channel_id, diff --git a/yt_dlp/extractor/booyah.py b/yt_dlp/extractor/booyah.py index 8c94714be..5c55f2c76 100644 --- a/yt_dlp/extractor/booyah.py +++ b/yt_dlp/extractor/booyah.py @@ -67,7 +67,6 @@ class BooyahClipsIE(BooyahBaseIE): 'height': video_data.get('resolution'), 'preference': -10, })) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/box.py b/yt_dlp/extractor/box.py index 5842de88a..8ab149626 100644 --- a/yt_dlp/extractor/box.py +++ b/yt_dlp/extractor/box.py @@ -79,8 +79,6 @@ class BoxIE(InfoExtractor): 'url': update_url_query(authenticated_download_url, query), }) - self._sort_formats(formats) - creator = f.get('created_by') or {} return { diff --git a/yt_dlp/extractor/bpb.py b/yt_dlp/extractor/bpb.py index 388f1f94f..f28e581b8 100644 --- a/yt_dlp/extractor/bpb.py +++ b/yt_dlp/extractor/bpb.py @@ -48,8 +48,6 @@ class BpbIE(InfoExtractor): 'format_id': '%s-%s' % (quality, determine_ext(video_url)), }) - self._sort_formats(formats) - return { 'id': video_id, 'formats': formats, diff --git a/yt_dlp/extractor/br.py b/yt_dlp/extractor/br.py index faac442e8..309452d23 100644 --- a/yt_dlp/extractor/br.py +++ b/yt_dlp/extractor/br.py @@ -157,7 +157,6 @@ class BRIE(InfoExtractor): 'format_id': 'rtmp-%s' % asset_type, }) formats.append(rtmp_format_info) - self._sort_formats(formats) return formats def _extract_thumbnails(self, variants, base_url): @@ -272,7 +271,6 @@ class BRMediathekIE(InfoExtractor): 'tbr': tbr, 'filesize': int_or_none(node.get('fileSize')), }) - self._sort_formats(formats) subtitles = {} for edge in clip.get('captionFiles', {}).get('edges', []): diff --git a/yt_dlp/extractor/breakcom.py b/yt_dlp/extractor/breakcom.py index 51c8c822f..00cf308c7 100644 --- a/yt_dlp/extractor/breakcom.py +++ b/yt_dlp/extractor/breakcom.py @@ -63,7 +63,6 @@ class BreakIE(InfoExtractor): 'format_id': 'http-%d' % bitrate if bitrate else 'http', 'tbr': bitrate, }) - self._sort_formats(formats) title = self._search_regex( (r'title["\']\s*:\s*(["\'])(?P(?:(?!\1).)+)\1', diff --git a/yt_dlp/extractor/breitbart.py b/yt_dlp/extractor/breitbart.py index ca5757374..ea0a59c86 100644 --- a/yt_dlp/extractor/breitbart.py +++ b/yt_dlp/extractor/breitbart.py @@ -24,7 +24,6 @@ class BreitBartIE(InfoExtractor): webpage = self._download_webpage(url, video_id) formats = self._extract_m3u8_formats(f'https://cdn.jwplayer.com/manifests/{video_id}.m3u8', video_id, ext='mp4') - self._sort_formats(formats) return { 'id': video_id, 'title': self._generic_title('', webpage), diff --git a/yt_dlp/extractor/brightcove.py b/yt_dlp/extractor/brightcove.py index 99a216fb4..35e1aa9c9 100644 --- a/yt_dlp/extractor/brightcove.py +++ b/yt_dlp/extractor/brightcove.py @@ -546,8 +546,6 @@ class BrightcoveNewIE(AdobePassIE): self.raise_no_formats( error.get('message') or error.get('error_subcode') or error['error_code'], expected=True) - self._sort_formats(formats) - for f in formats: f.setdefault('http_headers', {}).update(headers) diff --git a/yt_dlp/extractor/byutv.py b/yt_dlp/extractor/byutv.py index eca2e294e..9ed6efe79 100644 --- a/yt_dlp/extractor/byutv.py +++ b/yt_dlp/extractor/byutv.py @@ -108,7 +108,6 @@ class BYUtvIE(InfoExtractor): 'thumbnail': ep.get('imageThumbnail'), 'duration': parse_duration(ep.get('length')), }) - self._sort_formats(formats) return merge_dicts(info, { 'id': video_id, diff --git a/yt_dlp/extractor/c56.py b/yt_dlp/extractor/c56.py index 1d98ea598..e4b1c9a84 100644 --- a/yt_dlp/extractor/c56.py +++ b/yt_dlp/extractor/c56.py @@ -49,7 +49,6 @@ class C56IE(InfoExtractor): 'url': f['url'] } for f in info['rfiles'] ] - self._sort_formats(formats) return { 'id': info['vid'], diff --git a/yt_dlp/extractor/cableav.py b/yt_dlp/extractor/cableav.py index 3200b5677..2e374e5eb 100644 --- a/yt_dlp/extractor/cableav.py +++ b/yt_dlp/extractor/cableav.py @@ -22,7 +22,6 @@ class CableAVIE(InfoExtractor): video_url = self._og_search_video_url(webpage, secure=False) formats = self._extract_m3u8_formats(video_url, video_id, 'mp4') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/callin.py b/yt_dlp/extractor/callin.py index 6c8129f06..e9668763e 100644 --- a/yt_dlp/extractor/callin.py +++ b/yt_dlp/extractor/callin.py @@ -54,7 +54,6 @@ class CallinIE(InfoExtractor): title = episode.get('title') or self._generic_title('', webpage) url = episode['m3u8'] formats = self._extract_m3u8_formats(url, display_id, ext='ts') - self._sort_formats(formats) show = traverse_obj(episode, ('show', 'title')) show_id = traverse_obj(episode, ('show', 'id')) diff --git a/yt_dlp/extractor/caltrans.py b/yt_dlp/extractor/caltrans.py index e52dfb170..f4a4a834b 100644 --- a/yt_dlp/extractor/caltrans.py +++ b/yt_dlp/extractor/caltrans.py @@ -27,7 +27,6 @@ class CaltransIE(InfoExtractor): video_stream = self._search_regex(r'videoStreamURL\s*=\s*"([^"]+)"', global_vars, 'Video Stream URL', fatal=False) formats = self._extract_m3u8_formats(video_stream, video_id, 'ts', live=True) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/cam4.py b/yt_dlp/extractor/cam4.py index 4256b28e0..2650cc1ef 100644 --- a/yt_dlp/extractor/cam4.py +++ b/yt_dlp/extractor/cam4.py @@ -20,7 +20,6 @@ class CAM4IE(InfoExtractor): m3u8_playlist = self._download_json('https://www.cam4.com/rest/v1.0/profile/{}/streamInfo'.format(channel_id), channel_id).get('cdnURL') formats = self._extract_m3u8_formats(m3u8_playlist, channel_id, 'mp4', m3u8_id='hls', live=True) - self._sort_formats(formats) return { 'id': channel_id, diff --git a/yt_dlp/extractor/cammodels.py b/yt_dlp/extractor/cammodels.py index 32fbffcc2..0509057fc 100644 --- a/yt_dlp/extractor/cammodels.py +++ b/yt_dlp/extractor/cammodels.py @@ -84,7 +84,6 @@ class CamModelsIE(InfoExtractor): else: continue formats.append(f) - self._sort_formats(formats) return { 'id': user_id, diff --git a/yt_dlp/extractor/camsoda.py b/yt_dlp/extractor/camsoda.py index 1b47b0584..021cd916f 100644 --- a/yt_dlp/extractor/camsoda.py +++ b/yt_dlp/extractor/camsoda.py @@ -47,8 +47,6 @@ class CamsodaIE(InfoExtractor): if not formats: self.raise_no_formats('No active streams found', expected=True) - self._sort_formats(formats) - return { 'id': video_id, 'title': self._html_extract_title(webpage), diff --git a/yt_dlp/extractor/canalalpha.py b/yt_dlp/extractor/canalalpha.py index f2ec9355f..df5ca5818 100644 --- a/yt_dlp/extractor/canalalpha.py +++ b/yt_dlp/extractor/canalalpha.py @@ -82,7 +82,6 @@ class CanalAlphaIE(InfoExtractor): dash_frmts, dash_subs = self._parse_mpd_formats_and_subtitles(manifests['dash']) formats.extend(dash_frmts) subtitles = self._merge_subtitles(subtitles, dash_subs) - self._sort_formats(formats) return { 'id': id, 'title': data_json.get('title').strip(), diff --git a/yt_dlp/extractor/canalc2.py b/yt_dlp/extractor/canalc2.py index c9bb94c40..597cb2a6b 100644 --- a/yt_dlp/extractor/canalc2.py +++ b/yt_dlp/extractor/canalc2.py @@ -58,8 +58,6 @@ class Canalc2IE(InfoExtractor): else: info = self._parse_html5_media_entries(url, webpage, url)[0] - self._sort_formats(info['formats']) - info.update({ 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/canalplus.py b/yt_dlp/extractor/canalplus.py index b184398e2..b7e2f9dd4 100644 --- a/yt_dlp/extractor/canalplus.py +++ b/yt_dlp/extractor/canalplus.py @@ -86,7 +86,6 @@ class CanalplusIE(InfoExtractor): 'format_id': format_id, 'quality': preference(format_id), }) - self._sort_formats(formats) thumbnails = [{ 'id': image_id, diff --git a/yt_dlp/extractor/canvas.py b/yt_dlp/extractor/canvas.py index 8eff4a57c..ae6e03a4d 100644 --- a/yt_dlp/extractor/canvas.py +++ b/yt_dlp/extractor/canvas.py @@ -118,7 +118,6 @@ class CanvasIE(InfoExtractor): 'format_id': format_type, 'url': format_url, }) - self._sort_formats(formats) subtitle_urls = data.get('subtitleUrls') if isinstance(subtitle_urls, list): diff --git a/yt_dlp/extractor/carambatv.py b/yt_dlp/extractor/carambatv.py index 087ea8aa0..d6044a319 100644 --- a/yt_dlp/extractor/carambatv.py +++ b/yt_dlp/extractor/carambatv.py @@ -43,7 +43,6 @@ class CarambaTVIE(InfoExtractor): 'height': int_or_none(f.get('height')), 'format_id': format_field(f, 'height', '%sp'), } for f in video['qualities'] if f.get('fn')] - self._sort_formats(formats) thumbnail = video.get('splash') duration = float_or_none(try_get( diff --git a/yt_dlp/extractor/cbc.py b/yt_dlp/extractor/cbc.py index 999b7bc53..210f5f8ee 100644 --- a/yt_dlp/extractor/cbc.py +++ b/yt_dlp/extractor/cbc.py @@ -380,8 +380,6 @@ class CBCGemIE(InfoExtractor): if 'descriptive' in format['format_id'].lower(): format['preference'] = -2 - self._sort_formats(formats) - return { 'id': video_id, 'title': video_info['title'], diff --git a/yt_dlp/extractor/cbs.py b/yt_dlp/extractor/cbs.py index 9515806ed..9aacd50c4 100644 --- a/yt_dlp/extractor/cbs.py +++ b/yt_dlp/extractor/cbs.py @@ -52,7 +52,6 @@ class CBSBaseIE(ThePlatformFeedIE): # XXX: Do not subclass from concrete IE subtitles = self._merge_subtitles(subtitles, tp_subtitles) if last_e and not formats: self.raise_no_formats(last_e, True, content_id) - self._sort_formats(formats) extra_info.update({ 'id': content_id, diff --git a/yt_dlp/extractor/cbsnews.py b/yt_dlp/extractor/cbsnews.py index 98ec28df0..16edf3af8 100644 --- a/yt_dlp/extractor/cbsnews.py +++ b/yt_dlp/extractor/cbsnews.py @@ -132,7 +132,6 @@ class CBSNewsLiveVideoIE(InfoExtractor): }) formats = self._extract_akamai_formats(video_info['url'], display_id) - self._sort_formats(formats) return { 'id': display_id, diff --git a/yt_dlp/extractor/cbssports.py b/yt_dlp/extractor/cbssports.py index 56a255149..b5d85af12 100644 --- a/yt_dlp/extractor/cbssports.py +++ b/yt_dlp/extractor/cbssports.py @@ -40,7 +40,6 @@ class CBSSportsEmbedIE(InfoExtractor): formats = self._extract_m3u8_formats( metadata['files'][0]['url'], video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False) - self._sort_formats(formats) image = video.get('image') thumbnails = None diff --git a/yt_dlp/extractor/ccc.py b/yt_dlp/extractor/ccc.py index 1bc0f07f2..22e3a22ec 100644 --- a/yt_dlp/extractor/ccc.py +++ b/yt_dlp/extractor/ccc.py @@ -64,7 +64,6 @@ class CCCIE(InfoExtractor): 'language': language, 'vcodec': vcodec, }) - self._sort_formats(formats) return { 'id': event_id, diff --git a/yt_dlp/extractor/ccma.py b/yt_dlp/extractor/ccma.py index ca739f8a1..88ff82f6e 100644 --- a/yt_dlp/extractor/ccma.py +++ b/yt_dlp/extractor/ccma.py @@ -81,7 +81,6 @@ class CCMAIE(InfoExtractor): 'url': media_url, 'vcodec': 'none' if media_type == 'audio' else None, }) - self._sort_formats(formats) informacio = media['informacio'] title = informacio['titol'] diff --git a/yt_dlp/extractor/cctv.py b/yt_dlp/extractor/cctv.py index 623cbb342..466bdfb7c 100644 --- a/yt_dlp/extractor/cctv.py +++ b/yt_dlp/extractor/cctv.py @@ -170,8 +170,6 @@ class CCTVIE(InfoExtractor): hls_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)) - self._sort_formats(formats) - uploader = data.get('editer_name') description = self._html_search_meta( 'description', webpage, default=None) diff --git a/yt_dlp/extractor/cda.py b/yt_dlp/extractor/cda.py index 2a12b054b..d1212e686 100644 --- a/yt_dlp/extractor/cda.py +++ b/yt_dlp/extractor/cda.py @@ -151,8 +151,6 @@ class CDAIE(InfoExtractor): 'filesize': quality.get('length'), } for quality in meta['qualities'] if quality.get('file')] - self._sort_formats(formats) - return { 'id': video_id, 'title': meta.get('title'), @@ -304,6 +302,4 @@ class CDAIE(InfoExtractor): extract_format(webpage, resolution) - self._sort_formats(formats) - return merge_dicts(info_dict, info) diff --git a/yt_dlp/extractor/cellebrite.py b/yt_dlp/extractor/cellebrite.py index 64a30d7e3..9896a31af 100644 --- a/yt_dlp/extractor/cellebrite.py +++ b/yt_dlp/extractor/cellebrite.py @@ -50,7 +50,6 @@ class CellebriteIE(InfoExtractor): f'https://play.vidyard.com/player/{player_uuid}.json', display_id)['payload']['chapters'][0] formats, subtitles = self._get_formats_and_subtitles(json_data['sources'], display_id) - self._sort_formats(formats) return { 'id': str(json_data['videoId']), 'title': json_data.get('name') or self._og_search_title(webpage), diff --git a/yt_dlp/extractor/ceskatelevize.py b/yt_dlp/extractor/ceskatelevize.py index 5f4c447f2..be2b0bb43 100644 --- a/yt_dlp/extractor/ceskatelevize.py +++ b/yt_dlp/extractor/ceskatelevize.py @@ -249,9 +249,6 @@ class CeskaTelevizeIE(InfoExtractor): 'is_live': is_live, }) - for e in entries: - self._sort_formats(e['formats']) - if len(entries) == 1: return entries[0] return self.playlist_result(entries, playlist_id, playlist_title, playlist_description) diff --git a/yt_dlp/extractor/channel9.py b/yt_dlp/extractor/channel9.py index d0390d937..a88474060 100644 --- a/yt_dlp/extractor/channel9.py +++ b/yt_dlp/extractor/channel9.py @@ -185,7 +185,6 @@ class Channel9IE(InfoExtractor): if not formats and not slides and not zip_file: self.raise_no_formats( 'None of recording, slides or zip are available for %s' % content_path) - self._sort_formats(formats) subtitles = {} for caption in content_data.get('Captions', []): diff --git a/yt_dlp/extractor/charlierose.py b/yt_dlp/extractor/charlierose.py index 27f8b33e5..8fe6797c6 100644 --- a/yt_dlp/extractor/charlierose.py +++ b/yt_dlp/extractor/charlierose.py @@ -38,8 +38,6 @@ class CharlieRoseIE(InfoExtractor): info_dict = self._parse_html5_media_entries( self._PLAYER_BASE % video_id, webpage, video_id, m3u8_entry_protocol='m3u8_native')[0] - - self._sort_formats(info_dict['formats']) self._remove_duplicate_formats(info_dict['formats']) info_dict.update({ diff --git a/yt_dlp/extractor/chaturbate.py b/yt_dlp/extractor/chaturbate.py index d39210bf7..99dfcfdeb 100644 --- a/yt_dlp/extractor/chaturbate.py +++ b/yt_dlp/extractor/chaturbate.py @@ -95,7 +95,6 @@ class ChaturbateIE(InfoExtractor): # ffmpeg skips segments for fast m3u8 preference=-10 if m3u8_id == 'fast' else None, m3u8_id=m3u8_id, fatal=False, live=True)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/chingari.py b/yt_dlp/extractor/chingari.py index e54d92a86..48091dd65 100644 --- a/yt_dlp/extractor/chingari.py +++ b/yt_dlp/extractor/chingari.py @@ -32,7 +32,6 @@ class ChingariBaseIE(InfoExtractor): 'url': base_url + '/apipublic' + media_data['path'], 'quality': 10, }) - self._sort_formats(formats) timestamp = str_to_int(post_data.get('created_at')) if timestamp: timestamp = int_or_none(timestamp, 1000) diff --git a/yt_dlp/extractor/cinchcast.py b/yt_dlp/extractor/cinchcast.py index ff962aad1..7a7ea8b22 100644 --- a/yt_dlp/extractor/cinchcast.py +++ b/yt_dlp/extractor/cinchcast.py @@ -47,7 +47,6 @@ class CinchcastIE(InfoExtractor): 'format_id': 'backup', 'url': backup_url, }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/ciscowebex.py b/yt_dlp/extractor/ciscowebex.py index e1aae9bda..44595d854 100644 --- a/yt_dlp/extractor/ciscowebex.py +++ b/yt_dlp/extractor/ciscowebex.py @@ -72,7 +72,6 @@ class CiscoWebexIE(InfoExtractor): 'vcodec': 'none', 'acodec': 'mp3', }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/cliphunter.py b/yt_dlp/extractor/cliphunter.py index 7e5fd3175..2b907dc80 100644 --- a/yt_dlp/extractor/cliphunter.py +++ b/yt_dlp/extractor/cliphunter.py @@ -62,7 +62,6 @@ class CliphunterIE(InfoExtractor): 'height': int_or_none(height), 'tbr': int_or_none(f.get('br')), }) - self._sort_formats(formats) thumbnail = self._search_regex( r"var\s+mov_thumb\s*=\s*'([^']+)';", diff --git a/yt_dlp/extractor/cloudflarestream.py b/yt_dlp/extractor/cloudflarestream.py index 8bc0ad883..748e8e908 100644 --- a/yt_dlp/extractor/cloudflarestream.py +++ b/yt_dlp/extractor/cloudflarestream.py @@ -51,7 +51,6 @@ class CloudflareStreamIE(InfoExtractor): 'm3u8_native', m3u8_id='hls', fatal=False) formats.extend(self._extract_mpd_formats( manifest_base_url + 'mpd', video_id, mpd_id='dash', fatal=False)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/clubic.py b/yt_dlp/extractor/clubic.py index ce8621296..403e44aaf 100644 --- a/yt_dlp/extractor/clubic.py +++ b/yt_dlp/extractor/clubic.py @@ -42,7 +42,6 @@ class ClubicIE(InfoExtractor): 'url': src['src'], 'quality': quality_order(src['streamQuality']), } for src in sources] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/clyp.py b/yt_dlp/extractor/clyp.py index c64726ca2..0aaf73d18 100644 --- a/yt_dlp/extractor/clyp.py +++ b/yt_dlp/extractor/clyp.py @@ -60,7 +60,6 @@ class ClypIE(InfoExtractor): 'format_id': format_id, 'vcodec': 'none', }) - self._sort_formats(formats) title = metadata['Title'] description = metadata.get('Description') diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 3701fe6b3..c2b9970ec 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -1699,7 +1699,14 @@ class InfoExtractor: return FormatSort def _sort_formats(self, formats, field_preference=[]): - if formats and field_preference: + if not field_preference: + self._downloader.deprecation_warning( + 'yt_dlp.InfoExtractor._sort_formats is deprecated and is no longer required') + return + self._downloader.deprecation_warning( + 'yt_dlp.InfoExtractor._sort_formats is deprecated and no longer works as expected. ' + 'Return _format_sort_fields in the info_dict instead') + if formats: formats[0]['__sort_fields'] = field_preference def _check_formats(self, formats, video_id): @@ -2431,7 +2438,6 @@ class InfoExtractor: 'width': int_or_none(location.get(xpath_with_ns('s1:width', NS_MAP))), 'height': int_or_none(location.get(xpath_with_ns('s1:height', NS_MAP))), }) - self._sort_formats(formats) entries.append({ 'id': playlist_id, @@ -3269,7 +3275,6 @@ class InfoExtractor: 'url': formats[0]['url'], }) else: - self._sort_formats(formats) entry['formats'] = formats entries.append(entry) if len(entries) == 1: diff --git a/yt_dlp/extractor/condenast.py b/yt_dlp/extractor/condenast.py index ffdd820e2..3170c2990 100644 --- a/yt_dlp/extractor/condenast.py +++ b/yt_dlp/extractor/condenast.py @@ -197,7 +197,6 @@ class CondeNastIE(InfoExtractor): 'ext': ext, 'quality': 1 if quality == 'high' else 0, }) - self._sort_formats(formats) subtitles = {} for t, caption in video_info.get('captions', {}).items(): diff --git a/yt_dlp/extractor/contv.py b/yt_dlp/extractor/contv.py index 50648a536..d69e81610 100644 --- a/yt_dlp/extractor/contv.py +++ b/yt_dlp/extractor/contv.py @@ -69,8 +69,6 @@ class CONtvIE(InfoExtractor): 'url': media_mp4_url, }) - self._sort_formats(formats) - subtitles = {} captions = m_details.get('captions') or {} for caption_url in captions.values(): diff --git a/yt_dlp/extractor/corus.py b/yt_dlp/extractor/corus.py index 8c920e3ab..c03d65310 100644 --- a/yt_dlp/extractor/corus.py +++ b/yt_dlp/extractor/corus.py @@ -126,7 +126,6 @@ class CorusIE(ThePlatformFeedIE): # XXX: Do not subclass from concrete IE smil, smil_url, video_id, namespace)) if not formats and video.get('drm'): self.report_drm(video_id) - self._sort_formats(formats) subtitles = {} for track in video.get('tracks', []): diff --git a/yt_dlp/extractor/coub.py b/yt_dlp/extractor/coub.py index b462acaf0..9bab698a3 100644 --- a/yt_dlp/extractor/coub.py +++ b/yt_dlp/extractor/coub.py @@ -104,8 +104,6 @@ class CoubIE(InfoExtractor): 'source_preference': preference_key(MOBILE), }) - self._sort_formats(formats) - thumbnail = coub.get('picture') duration = float_or_none(coub.get('duration')) timestamp = parse_iso8601(coub.get('published_at') or coub.get('created_at')) diff --git a/yt_dlp/extractor/cpac.py b/yt_dlp/extractor/cpac.py index 65ac2497f..0f23f2be2 100644 --- a/yt_dlp/extractor/cpac.py +++ b/yt_dlp/extractor/cpac.py @@ -54,8 +54,6 @@ class CPACIE(InfoExtractor): else: fmt['language_preference'] = -10 - self._sort_formats(formats) - category = str_or_none(content['details']['category_%s_t' % (url_lang, )]) def is_live(v_type): diff --git a/yt_dlp/extractor/crackle.py b/yt_dlp/extractor/crackle.py index 319374f3b..46100151a 100644 --- a/yt_dlp/extractor/crackle.py +++ b/yt_dlp/extractor/crackle.py @@ -177,7 +177,6 @@ class CrackleIE(InfoExtractor): }) if not formats and has_drm: self.report_drm(video_id) - self._sort_formats(formats) description = media.get('Description') duration = int_or_none(media.get( diff --git a/yt_dlp/extractor/crooksandliars.py b/yt_dlp/extractor/crooksandliars.py index 85c145e12..4de7e3d53 100644 --- a/yt_dlp/extractor/crooksandliars.py +++ b/yt_dlp/extractor/crooksandliars.py @@ -45,7 +45,6 @@ class CrooksAndLiarsIE(InfoExtractor): 'format_id': item['type'], 'quality': quality(item['type']), } for item in manifest['flavors'] if item['mime'].startswith('video/')] - self._sort_formats(formats) return { 'url': url, diff --git a/yt_dlp/extractor/crowdbunker.py b/yt_dlp/extractor/crowdbunker.py index 75d90b5c5..d83c01560 100644 --- a/yt_dlp/extractor/crowdbunker.py +++ b/yt_dlp/extractor/crowdbunker.py @@ -60,7 +60,6 @@ class CrowdBunkerIE(InfoExtractor): 'width': int_or_none(image.get('width')), } for image in video_json.get('thumbnails') or [] if image.get('url')] - self._sort_formats(formats) return { 'id': id, 'title': video_json.get('title'), diff --git a/yt_dlp/extractor/crunchyroll.py b/yt_dlp/extractor/crunchyroll.py index 35752f1bd..ee344ce8b 100644 --- a/yt_dlp/extractor/crunchyroll.py +++ b/yt_dlp/extractor/crunchyroll.py @@ -208,7 +208,6 @@ class CrunchyrollBetaIE(CrunchyrollBaseIE): f['language'] = stream_response.get('audio_locale') f['quality'] = hardsub_preference(hardsub_lang.lower()) formats.extend(adaptive_formats) - self._sort_formats(formats) return { 'id': internal_id, diff --git a/yt_dlp/extractor/cspan.py b/yt_dlp/extractor/cspan.py index 1184633f5..0075680e8 100644 --- a/yt_dlp/extractor/cspan.py +++ b/yt_dlp/extractor/cspan.py @@ -218,7 +218,6 @@ class CSpanIE(InfoExtractor): path, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') if determine_ext(path) == 'm3u8' else [{'url': path, }] add_referer(formats) - self._sort_formats(formats) entries.append({ 'id': '%s_%d' % (video_id, partnum + 1), 'title': ( diff --git a/yt_dlp/extractor/curiositystream.py b/yt_dlp/extractor/curiositystream.py index a105b6ce2..26cf24fbb 100644 --- a/yt_dlp/extractor/curiositystream.py +++ b/yt_dlp/extractor/curiositystream.py @@ -117,7 +117,6 @@ class CuriosityStreamIE(CuriosityStreamBaseIE): 'format_id': 'http', }) formats.append(fmt) - self._sort_formats(formats) title = media['title'] diff --git a/yt_dlp/extractor/daftsex.py b/yt_dlp/extractor/daftsex.py index 0fe014f76..551d5e3ab 100644 --- a/yt_dlp/extractor/daftsex.py +++ b/yt_dlp/extractor/daftsex.py @@ -81,7 +81,6 @@ class DaftsexIE(InfoExtractor): 'height': int_or_none(height), 'ext': ext, }) - self._sort_formats(formats) return { 'id': video_id, @@ -117,7 +116,6 @@ class DaftsexIE(InfoExtractor): 'height': int_or_none(height), 'ext': ext, }) - self._sort_formats(formats) thumbnails = [] for k, v in item.items(): diff --git a/yt_dlp/extractor/dailymail.py b/yt_dlp/extractor/dailymail.py index f25d7a8c6..43401e111 100644 --- a/yt_dlp/extractor/dailymail.py +++ b/yt_dlp/extractor/dailymail.py @@ -63,7 +63,6 @@ class DailyMailIE(InfoExtractor): 'protocol': protocol, 'ext': 'mp4' if is_hls else None, }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/dailymotion.py b/yt_dlp/extractor/dailymotion.py index 65a9feec5..2a44718fb 100644 --- a/yt_dlp/extractor/dailymotion.py +++ b/yt_dlp/extractor/dailymotion.py @@ -293,7 +293,6 @@ class DailymotionIE(DailymotionBaseInfoExtractor): f['url'] = f['url'].split('#')[0] if not f.get('fps') and f['format_id'].endswith('@60'): f['fps'] = 60 - self._sort_formats(formats) subtitles = {} subtitles_data = try_get(metadata, lambda x: x['subtitles']['data'], dict) or {} diff --git a/yt_dlp/extractor/dailywire.py b/yt_dlp/extractor/dailywire.py index 1f27797ad..f177c9d9c 100644 --- a/yt_dlp/extractor/dailywire.py +++ b/yt_dlp/extractor/dailywire.py @@ -67,7 +67,6 @@ class DailyWireIE(DailyWireBaseIE): format_, subs_ = self._extract_m3u8_formats_and_subtitles(url, slug) formats.extend(format_) self._merge_subtitles(subs_, target=subtitles) - self._sort_formats(formats) return { 'id': episode_info['id'], 'display_id': slug, diff --git a/yt_dlp/extractor/damtomo.py b/yt_dlp/extractor/damtomo.py index 962d9741b..0e08e4f65 100644 --- a/yt_dlp/extractor/damtomo.py +++ b/yt_dlp/extractor/damtomo.py @@ -36,7 +36,6 @@ class DamtomoBaseIE(InfoExtractor): if not m3u8_url: raise ExtractorError('Failed to obtain m3u8 URL') formats = self._extract_m3u8_formats(m3u8_url, video_id, ext='mp4') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/daystar.py b/yt_dlp/extractor/daystar.py index 4f59d904f..ef3520a21 100644 --- a/yt_dlp/extractor/daystar.py +++ b/yt_dlp/extractor/daystar.py @@ -36,7 +36,6 @@ class DaystarClipIE(InfoExtractor): video_id, 'mp4', fatal=False, headers={'Referer': src_iframe}) formats.extend(fmts) subtitles = self._merge_subtitles(subtitles, subs) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/deezer.py b/yt_dlp/extractor/deezer.py index bee1c7501..f61f12af0 100644 --- a/yt_dlp/extractor/deezer.py +++ b/yt_dlp/extractor/deezer.py @@ -62,7 +62,6 @@ class DeezerPlaylistIE(DeezerBaseInfoExtractor): 'preference': -100, # Only the first 30 seconds 'ext': 'mp3', }] - self._sort_formats(formats) artists = ', '.join( orderedSet(a.get('ART_NAME') for a in s.get('ARTISTS'))) entries.append({ @@ -115,7 +114,6 @@ class DeezerAlbumIE(DeezerBaseInfoExtractor): 'preference': -100, # Only the first 30 seconds 'ext': 'mp3', }] - self._sort_formats(formats) artists = ', '.join( orderedSet(a.get('ART_NAME') for a in s.get('ARTISTS'))) entries.append({ diff --git a/yt_dlp/extractor/democracynow.py b/yt_dlp/extractor/democracynow.py index af327e6c6..1624d085c 100644 --- a/yt_dlp/extractor/democracynow.py +++ b/yt_dlp/extractor/democracynow.py @@ -59,8 +59,6 @@ class DemocracynowIE(InfoExtractor): 'vcodec': 'none' if key == 'audio' else None, }) - self._sort_formats(formats) - default_lang = 'en' subtitles = {} diff --git a/yt_dlp/extractor/detik.py b/yt_dlp/extractor/detik.py index 7209e6611..f14805424 100644 --- a/yt_dlp/extractor/detik.py +++ b/yt_dlp/extractor/detik.py @@ -146,7 +146,6 @@ class DetikEmbedIE(InfoExtractor): } formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_url, display_id) - self._sort_formats(formats) json_ld_data = self._search_json_ld(webpage, display_id, default={}) yield merge_dicts(json_ld_data, extra_info_dict, { diff --git a/yt_dlp/extractor/dfb.py b/yt_dlp/extractor/dfb.py index 5aca72988..c4fb5c2a4 100644 --- a/yt_dlp/extractor/dfb.py +++ b/yt_dlp/extractor/dfb.py @@ -41,7 +41,6 @@ class DFBIE(InfoExtractor): formats.extend(self._extract_m3u8_formats( manifest_url, display_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/digitalconcerthall.py b/yt_dlp/extractor/digitalconcerthall.py index 3813a51fe..3461e36eb 100644 --- a/yt_dlp/extractor/digitalconcerthall.py +++ b/yt_dlp/extractor/digitalconcerthall.py @@ -88,7 +88,6 @@ class DigitalConcertHallIE(InfoExtractor): m3u8_url = traverse_obj( stream_info, ('channel', lambda k, _: k.startswith('vod_mixed'), 'stream', 0, 'url'), get_all=False) formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', 'm3u8_native', fatal=False) - self._sort_formats(formats) yield { 'id': video_id, diff --git a/yt_dlp/extractor/digiteka.py b/yt_dlp/extractor/digiteka.py index 5fbc42ffe..912e33ba7 100644 --- a/yt_dlp/extractor/digiteka.py +++ b/yt_dlp/extractor/digiteka.py @@ -81,8 +81,6 @@ class DigitekaIE(InfoExtractor): 'format_id': source.get('label'), }) - self._sort_formats(formats) - title = deliver_info['title'] thumbnail = jwconf.get('image') duration = int_or_none(deliver_info.get('duration')) diff --git a/yt_dlp/extractor/discoverygo.py b/yt_dlp/extractor/discoverygo.py index 7b4278c88..1f3d8e31c 100644 --- a/yt_dlp/extractor/discoverygo.py +++ b/yt_dlp/extractor/discoverygo.py @@ -50,7 +50,6 @@ class DiscoveryGoBaseIE(InfoExtractor): elif stream_kind == 'hds': formats.extend(self._extract_f4m_formats( stream_url, display_id, f4m_id=stream_kind, fatal=False)) - self._sort_formats(formats) video_id = video.get('id') or display_id description = video.get('description', {}).get('detailed') diff --git a/yt_dlp/extractor/disney.py b/yt_dlp/extractor/disney.py index f9af59a57..430de326f 100644 --- a/yt_dlp/extractor/disney.py +++ b/yt_dlp/extractor/disney.py @@ -134,7 +134,6 @@ class DisneyIE(InfoExtractor): self.raise_no_formats( '%s said: %s' % (self.IE_NAME, page_data['translations']['video_expired']), expected=True) - self._sort_formats(formats) subtitles = {} for caption in video_data.get('captions', []): diff --git a/yt_dlp/extractor/dispeak.py b/yt_dlp/extractor/dispeak.py index d4f3324e7..37f89b9bc 100644 --- a/yt_dlp/extractor/dispeak.py +++ b/yt_dlp/extractor/dispeak.py @@ -117,7 +117,6 @@ class DigitallySpeakingIE(InfoExtractor): video_formats = self._parse_mp4(metadata) if video_formats is None: video_formats = self._parse_flv(metadata) - self._sort_formats(video_formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/dlive.py b/yt_dlp/extractor/dlive.py index 31b4a568f..30fcf9fce 100644 --- a/yt_dlp/extractor/dlive.py +++ b/yt_dlp/extractor/dlive.py @@ -40,7 +40,6 @@ class DLiveVODIE(InfoExtractor): title = broadcast['title'] formats = self._extract_m3u8_formats( broadcast['playbackUrl'], vod_id, 'mp4', 'm3u8_native') - self._sort_formats(formats) return { 'id': vod_id, 'title': title, @@ -79,7 +78,6 @@ class DLiveStreamIE(InfoExtractor): formats = self._extract_m3u8_formats( 'https://live.prd.dlive.tv/hls/live/%s.m3u8' % username, display_name, 'mp4') - self._sort_formats(formats) return { 'id': display_name, 'title': title, diff --git a/yt_dlp/extractor/dplay.py b/yt_dlp/extractor/dplay.py index 3f0b315a5..8eb4d8ffa 100644 --- a/yt_dlp/extractor/dplay.py +++ b/yt_dlp/extractor/dplay.py @@ -126,7 +126,6 @@ class DPlayBaseIE(InfoExtractor): 'url': format_url, 'format_id': format_id, }) - self._sort_formats(formats) creator = series = None tags = [] diff --git a/yt_dlp/extractor/drbonanza.py b/yt_dlp/extractor/drbonanza.py index dca8c89d0..824d70def 100644 --- a/yt_dlp/extractor/drbonanza.py +++ b/yt_dlp/extractor/drbonanza.py @@ -30,7 +30,6 @@ class DRBonanzaIE(InfoExtractor): info = self._parse_html5_media_entries( url, webpage, display_id, m3u8_id='hls', m3u8_entry_protocol='m3u8_native')[0] - self._sort_formats(info['formats']) asset = self._parse_json( self._search_regex( diff --git a/yt_dlp/extractor/dropbox.py b/yt_dlp/extractor/dropbox.py index 54d97a25d..214b309bf 100644 --- a/yt_dlp/extractor/dropbox.py +++ b/yt_dlp/extractor/dropbox.py @@ -63,7 +63,6 @@ class DropboxIE(InfoExtractor): video_url = re.sub(r'[?&]dl=0', '', url) video_url += ('?' if '?' not in video_url else '&') + 'dl=1' formats.append({'url': video_url, 'format_id': 'original', 'format_note': 'Original', 'quality': 1}) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/drtuber.py b/yt_dlp/extractor/drtuber.py index 824c2be12..e5dab6ac0 100644 --- a/yt_dlp/extractor/drtuber.py +++ b/yt_dlp/extractor/drtuber.py @@ -58,7 +58,6 @@ class DrTuberIE(InfoExtractor): 'quality': 2 if format_id == 'hq' else 1, 'url': video_url }) - self._sort_formats(formats) duration = int_or_none(video_data.get('duration')) or parse_duration( video_data.get('duration_format')) diff --git a/yt_dlp/extractor/drtv.py b/yt_dlp/extractor/drtv.py index 708b72fae..128f43914 100644 --- a/yt_dlp/extractor/drtv.py +++ b/yt_dlp/extractor/drtv.py @@ -300,8 +300,6 @@ class DRTVIE(InfoExtractor): 'Unfortunately, DR is not allowed to show this program outside Denmark.', countries=self._GEO_COUNTRIES) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, @@ -366,7 +364,6 @@ class DRTVLiveIE(InfoExtractor): formats.extend(self._extract_f4m_formats(update_url_query( '%s/%s' % (server, stream_path), {'hdcore': '3.7.0'}), channel_id, f4m_id=link_type, fatal=False)) - self._sort_formats(formats) return { 'id': channel_id, diff --git a/yt_dlp/extractor/dumpert.py b/yt_dlp/extractor/dumpert.py index dc61115ff..010c2d092 100644 --- a/yt_dlp/extractor/dumpert.py +++ b/yt_dlp/extractor/dumpert.py @@ -48,7 +48,6 @@ class DumpertIE(InfoExtractor): 'format_id': version, 'quality': quality(version), }) - self._sort_formats(formats) thumbnails = [] stills = item.get('stills') or {} diff --git a/yt_dlp/extractor/dvtv.py b/yt_dlp/extractor/dvtv.py index 61d469f11..e67143370 100644 --- a/yt_dlp/extractor/dvtv.py +++ b/yt_dlp/extractor/dvtv.py @@ -142,7 +142,6 @@ class DVTVIE(InfoExtractor): 'format_id': join_nonempty('http', ext, label), 'height': int_or_none(height), }) - self._sort_formats(formats) return { 'id': data.get('mediaid') or video_id, diff --git a/yt_dlp/extractor/dw.py b/yt_dlp/extractor/dw.py index ee2365ddd..9c4a08e54 100644 --- a/yt_dlp/extractor/dw.py +++ b/yt_dlp/extractor/dw.py @@ -62,7 +62,6 @@ class DWIE(InfoExtractor): transform_source=lambda s: s.replace( 'rtmp://tv-od.dw.de/flash/', 'http://tv-download.dw.de/dwtv_video/flv/')) - self._sort_formats(formats) upload_date = hidden_inputs.get('display_date') if not upload_date: diff --git a/yt_dlp/extractor/eagleplatform.py b/yt_dlp/extractor/eagleplatform.py index 7e5047b56..9ebd24d80 100644 --- a/yt_dlp/extractor/eagleplatform.py +++ b/yt_dlp/extractor/eagleplatform.py @@ -192,8 +192,6 @@ class EaglePlatformIE(InfoExtractor): f['url'] = format_url formats.append(f) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/egghead.py b/yt_dlp/extractor/egghead.py index d5c954961..a4b2a12f6 100644 --- a/yt_dlp/extractor/egghead.py +++ b/yt_dlp/extractor/egghead.py @@ -117,7 +117,6 @@ class EggheadLessonIE(EggheadBaseIE): formats.append({ 'url': format_url, }) - self._sort_formats(formats) return { 'id': lesson_id, diff --git a/yt_dlp/extractor/einthusan.py b/yt_dlp/extractor/einthusan.py index 37be68c61..53bc2535d 100644 --- a/yt_dlp/extractor/einthusan.py +++ b/yt_dlp/extractor/einthusan.py @@ -89,8 +89,6 @@ class EinthusanIE(InfoExtractor): 'url': mp4_url, }) - self._sort_formats(formats) - description = get_elements_by_class('synopsis', webpage)[0] thumbnail = self._html_search_regex( r''']+src=(["'])(?P(?!\1).+?/moviecovers/(?!\1).+?)\1''', diff --git a/yt_dlp/extractor/eitb.py b/yt_dlp/extractor/eitb.py index 01a47f6fd..bd027da6b 100644 --- a/yt_dlp/extractor/eitb.py +++ b/yt_dlp/extractor/eitb.py @@ -71,8 +71,6 @@ class EitbIE(InfoExtractor): '%s?hdcore=3.7.0' % hds_url.replace('euskalsvod', 'euskalvod'), video_id, f4m_id='hds', fatal=False)) - self._sort_formats(formats) - return { 'id': video_id, 'title': media.get('NAME_ES') or media.get('name') or media['NAME_EU'], diff --git a/yt_dlp/extractor/ellentube.py b/yt_dlp/extractor/ellentube.py index bcd458cdf..6eb00f9c9 100644 --- a/yt_dlp/extractor/ellentube.py +++ b/yt_dlp/extractor/ellentube.py @@ -28,7 +28,6 @@ class EllenTubeBaseIE(InfoExtractor): entry_protocol='m3u8_native', m3u8_id='hls') duration = int_or_none(entry.get('duration')) break - self._sort_formats(formats) def get_insight(kind): return int_or_none(try_get( diff --git a/yt_dlp/extractor/elonet.py b/yt_dlp/extractor/elonet.py index f99e12250..c5558ffcd 100644 --- a/yt_dlp/extractor/elonet.py +++ b/yt_dlp/extractor/elonet.py @@ -53,7 +53,6 @@ class ElonetIE(InfoExtractor): else: formats, subtitles = [], {} self.raise_no_formats(f'Unknown streaming format {ext}') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/epicon.py b/yt_dlp/extractor/epicon.py index 89424785e..3bfcc5470 100644 --- a/yt_dlp/extractor/epicon.py +++ b/yt_dlp/extractor/epicon.py @@ -59,7 +59,6 @@ class EpiconIE(InfoExtractor): description = self._og_search_description(webpage) or None thumbnail = self._og_search_thumbnail(webpage) or None formats = self._extract_m3u8_formats(data_json['url']['video_url'], id) - self._sort_formats(formats) subtitles = {} for subtitle in data_json.get('subtitles', []): diff --git a/yt_dlp/extractor/eporner.py b/yt_dlp/extractor/eporner.py index 6bc70c5c6..a2337979b 100644 --- a/yt_dlp/extractor/eporner.py +++ b/yt_dlp/extractor/eporner.py @@ -106,7 +106,6 @@ class EpornerIE(InfoExtractor): 'height': height, 'fps': fps, }) - self._sort_formats(formats) json_ld = self._search_json_ld(webpage, display_id, default={}) diff --git a/yt_dlp/extractor/ertgr.py b/yt_dlp/extractor/ertgr.py index eb52ad031..9ecdf5d3b 100644 --- a/yt_dlp/extractor/ertgr.py +++ b/yt_dlp/extractor/ertgr.py @@ -73,7 +73,7 @@ class ERTFlixCodenameIE(ERTFlixBaseIE): }, ] - def _extract_formats_and_subs(self, video_id, allow_none=True): + def _extract_formats_and_subs(self, video_id): media_info = self._call_api(video_id, codename=video_id) formats, subs = [], {} for media_file in try_get(media_info, lambda x: x['MediaFiles'], list) or []: @@ -97,8 +97,6 @@ class ERTFlixCodenameIE(ERTFlixBaseIE): formats.extend(formats_) self._merge_subtitles(subs_, target=subs) - if formats or not allow_none: - self._sort_formats(formats) return formats, subs def _real_extract(self, url): @@ -292,7 +290,6 @@ class ERTWebtvEmbedIE(InfoExtractor): formats, subs = self._extract_m3u8_formats_and_subtitles( f'https://mediastream.ert.gr/vodedge/_definst_/mp4:dvrorigin/{video_id}/playlist.m3u8', video_id, 'mp4') - self._sort_formats(formats) thumbnail_id = parse_qs(url).get('bgimg', [None])[0] if thumbnail_id and not thumbnail_id.startswith('http'): thumbnail_id = f'https://program.ert.gr{thumbnail_id}' diff --git a/yt_dlp/extractor/escapist.py b/yt_dlp/extractor/escapist.py index 5d9c46f72..85a1cbf40 100644 --- a/yt_dlp/extractor/escapist.py +++ b/yt_dlp/extractor/escapist.py @@ -95,7 +95,6 @@ class EscapistIE(InfoExtractor): 'format_id': '%s-%sp' % (determine_ext(video['src']), video['res']), 'height': int_or_none(video.get('res')), } for video in data['files']['videos']] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/espn.py b/yt_dlp/extractor/espn.py index ba0a98bea..f4b0134ab 100644 --- a/yt_dlp/extractor/espn.py +++ b/yt_dlp/extractor/espn.py @@ -162,7 +162,6 @@ class ESPNIE(OnceIE): links = clip.get('links', {}) traverse_source(links.get('source', {})) traverse_source(links.get('mobile', {})) - self._sort_formats(formats) description = clip.get('caption') or clip.get('description') thumbnail = clip.get('thumbnail') @@ -269,7 +268,6 @@ class ESPNCricInfoIE(InfoExtractor): 'url': item['url'], 'vcodec': 'none', }) - self._sort_formats(formats) return { 'id': id, 'title': data_json.get('title'), @@ -400,7 +398,6 @@ class WatchESPNIE(AdobePassIE): m3u8_url, headers = asset['stream'], {} formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4', m3u8_id='hls') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/esri.py b/yt_dlp/extractor/esri.py index 1736788db..02e7efaf0 100644 --- a/yt_dlp/extractor/esri.py +++ b/yt_dlp/extractor/esri.py @@ -43,7 +43,6 @@ class EsriVideoIE(InfoExtractor): 'height': int(height), 'filesize_approx': parse_filesize(filesize), }) - self._sort_formats(formats) title = self._html_search_meta('title', webpage, 'title') description = self._html_search_meta( diff --git a/yt_dlp/extractor/europa.py b/yt_dlp/extractor/europa.py index ea20b4d4d..c2b493765 100644 --- a/yt_dlp/extractor/europa.py +++ b/yt_dlp/extractor/europa.py @@ -76,7 +76,6 @@ class EuropaIE(InfoExtractor): 'format_note': xpath_text(file_, './lglabel'), 'language_preference': language_preference(lang) }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/eurosport.py b/yt_dlp/extractor/eurosport.py index 5681499fb..654e11206 100644 --- a/yt_dlp/extractor/eurosport.py +++ b/yt_dlp/extractor/eurosport.py @@ -83,8 +83,6 @@ class EurosportIE(InfoExtractor): formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) - self._sort_formats(formats) - return { 'id': json_data['id'], 'title': json_ld_data.get('title') or self._og_search_title(webpage), diff --git a/yt_dlp/extractor/euscreen.py b/yt_dlp/extractor/euscreen.py index 4435f08e0..65a1dc7c5 100644 --- a/yt_dlp/extractor/euscreen.py +++ b/yt_dlp/extractor/euscreen.py @@ -45,7 +45,6 @@ class EUScreenIE(InfoExtractor): formats = [{ 'url': source['src'], } for source in video_json.get('sources', [])] - self._sort_formats(formats) return { 'id': id, diff --git a/yt_dlp/extractor/expotv.py b/yt_dlp/extractor/expotv.py index 92eaf4248..bda6e3cb2 100644 --- a/yt_dlp/extractor/expotv.py +++ b/yt_dlp/extractor/expotv.py @@ -49,7 +49,6 @@ class ExpoTVIE(InfoExtractor): r'filename=.*\.([a-z0-9_A-Z]+)&', media_url, 'file extension', default=None) or fcfg.get('type'), }) - self._sort_formats(formats) title = self._og_search_title(webpage) description = self._og_search_description(webpage) diff --git a/yt_dlp/extractor/expressen.py b/yt_dlp/extractor/expressen.py index 5381e9880..86967b631 100644 --- a/yt_dlp/extractor/expressen.py +++ b/yt_dlp/extractor/expressen.py @@ -70,7 +70,6 @@ class ExpressenIE(InfoExtractor): formats = [{ 'url': stream, }] - self._sort_formats(formats) title = info.get('titleRaw') or data['title'] description = info.get('descriptionRaw') diff --git a/yt_dlp/extractor/facebook.py b/yt_dlp/extractor/facebook.py index 35acbc643..1404be612 100644 --- a/yt_dlp/extractor/facebook.py +++ b/yt_dlp/extractor/facebook.py @@ -461,13 +461,12 @@ class FacebookIE(InfoExtractor): formats.extend(self._parse_mpd_formats( compat_etree_fromstring(urllib.parse.unquote_plus(dash_manifest)))) - def process_formats(formats): + def process_formats(info): # Downloads with browser's User-Agent are rate limited. Working around # with non-browser User-Agent. - for f in formats: + for f in info['formats']: f.setdefault('http_headers', {})['User-Agent'] = 'facebookexternalhit/1.1' - - self._sort_formats(formats, ('res', 'quality')) + info['_format_sort_fields'] = ('res', 'quality') def extract_relay_data(_filter): return self._parse_json(self._search_regex( @@ -510,7 +509,6 @@ class FacebookIE(InfoExtractor): 'url': playable_url, }) extract_dash_manifest(video, formats) - process_formats(formats) v_id = video.get('videoId') or video.get('id') or video_id info = { 'id': v_id, @@ -521,6 +519,7 @@ class FacebookIE(InfoExtractor): 'timestamp': int_or_none(video.get('publish_time')), 'duration': float_or_none(video.get('playable_duration_in_ms'), 1000), } + process_formats(info) description = try_get(video, lambda x: x['savable_description']['text']) title = video.get('name') if title: @@ -687,13 +686,12 @@ class FacebookIE(InfoExtractor): if subtitles_src: subtitles.setdefault('en', []).append({'url': subtitles_src}) - process_formats(formats) - info_dict = { 'id': video_id, 'formats': formats, 'subtitles': subtitles, } + process_formats(info_dict) info_dict.update(extract_metadata(webpage)) return info_dict diff --git a/yt_dlp/extractor/faz.py b/yt_dlp/extractor/faz.py index cc12fda2b..bca62add9 100644 --- a/yt_dlp/extractor/faz.py +++ b/yt_dlp/extractor/faz.py @@ -78,7 +78,6 @@ class FazIE(InfoExtractor): 'tbr': tbr or int(mobj.group(3)), }) formats.append(f) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/fc2.py b/yt_dlp/extractor/fc2.py index 3501c4cf6..dd5e088fc 100644 --- a/yt_dlp/extractor/fc2.py +++ b/yt_dlp/extractor/fc2.py @@ -250,7 +250,6 @@ class FC2LiveIE(InfoExtractor): 'Referer': url, })) - self._sort_formats(formats) for fmt in formats: fmt.update({ 'protocol': 'fc2_live', diff --git a/yt_dlp/extractor/fczenit.py b/yt_dlp/extractor/fczenit.py index df40888e1..8175b6b0f 100644 --- a/yt_dlp/extractor/fczenit.py +++ b/yt_dlp/extractor/fczenit.py @@ -38,8 +38,6 @@ class FczenitIE(InfoExtractor): 'height': int_or_none(q.get('label')), } for q in msi_data['qualities'] if q.get('url')] - self._sort_formats(formats) - tags = [tag['label'] for tag in msi_data.get('tags', []) if tag.get('label')] return { diff --git a/yt_dlp/extractor/fifa.py b/yt_dlp/extractor/fifa.py index e170b67a7..dc00edcb3 100644 --- a/yt_dlp/extractor/fifa.py +++ b/yt_dlp/extractor/fifa.py @@ -80,7 +80,6 @@ class FifaIE(InfoExtractor): }) formats, subtitles = self._extract_m3u8_formats_and_subtitles(content_data['playURL'], video_id) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/filmmodu.py b/yt_dlp/extractor/filmmodu.py index d74131192..9eb550eed 100644 --- a/yt_dlp/extractor/filmmodu.py +++ b/yt_dlp/extractor/filmmodu.py @@ -51,8 +51,6 @@ class FilmmoduIE(InfoExtractor): 'protocol': 'm3u8_native', } for source in data['sources']] - self._sort_formats(formats) - subtitles = {} if data.get('subtitle'): diff --git a/yt_dlp/extractor/filmon.py b/yt_dlp/extractor/filmon.py index 7040231be..9a93cb984 100644 --- a/yt_dlp/extractor/filmon.py +++ b/yt_dlp/extractor/filmon.py @@ -65,7 +65,6 @@ class FilmOnIE(InfoExtractor): 'quality': QUALITY(stream.get('quality')), 'protocol': 'm3u8_native', }) - self._sort_formats(formats) thumbnails = [] poster = response.get('poster', {}) @@ -153,7 +152,6 @@ class FilmOnChannelIE(InfoExtractor): 'ext': 'mp4', 'quality': QUALITY(quality), }) - self._sort_formats(formats) thumbnails = [] for name, width, height in self._THUMBNAIL_RES: diff --git a/yt_dlp/extractor/firsttv.py b/yt_dlp/extractor/firsttv.py index 99c27e0c3..f74bd132f 100644 --- a/yt_dlp/extractor/firsttv.py +++ b/yt_dlp/extractor/firsttv.py @@ -123,7 +123,6 @@ class FirstTVIE(InfoExtractor): % (path, m3u8_path), display_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)) - self._sort_formats(formats) thumbnail = item.get('poster') or self._og_search_thumbnail(webpage) duration = int_or_none(item.get('duration') or self._html_search_meta( diff --git a/yt_dlp/extractor/flickr.py b/yt_dlp/extractor/flickr.py index 9f60a6b1f..89a40d7e2 100644 --- a/yt_dlp/extractor/flickr.py +++ b/yt_dlp/extractor/flickr.py @@ -89,7 +89,6 @@ class FlickrIE(InfoExtractor): 'url': stream['_content'], 'quality': preference(stream_type), }) - self._sort_formats(formats) owner = video_info.get('owner', {}) uploader_id = owner.get('nsid') diff --git a/yt_dlp/extractor/folketinget.py b/yt_dlp/extractor/folketinget.py index 0e69fa32f..55a11e591 100644 --- a/yt_dlp/extractor/folketinget.py +++ b/yt_dlp/extractor/folketinget.py @@ -59,7 +59,6 @@ class FolketingetIE(InfoExtractor): 'url': xpath_text(n, './url', fatal=True), 'tbr': int_or_none(n.attrib['bitrate']), } for n in doc.findall('.//streams/stream')] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/fourtube.py b/yt_dlp/extractor/fourtube.py index c6af100f3..b6368b87d 100644 --- a/yt_dlp/extractor/fourtube.py +++ b/yt_dlp/extractor/fourtube.py @@ -35,7 +35,6 @@ class FourTubeBaseIE(InfoExtractor): 'resolution': format + 'p', 'quality': int(format), } for format in sources] - self._sort_formats(formats) return formats def _real_extract(self, url): diff --git a/yt_dlp/extractor/fourzerostudio.py b/yt_dlp/extractor/fourzerostudio.py index e1804e39e..c388a3a07 100644 --- a/yt_dlp/extractor/fourzerostudio.py +++ b/yt_dlp/extractor/fourzerostudio.py @@ -29,7 +29,6 @@ class FourZeroStudioArchiveIE(InfoExtractor): 'ssrRefs', lambda _, v: v['__typename'] == 'PublicUser', 'id'), get_all=False) formats, subs = self._extract_m3u8_formats_and_subtitles(pcb['archiveUrl'], video_id, ext='mp4') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/fox.py b/yt_dlp/extractor/fox.py index 53826630f..15c0c48c1 100644 --- a/yt_dlp/extractor/fox.py +++ b/yt_dlp/extractor/fox.py @@ -132,7 +132,6 @@ class FOXIE(InfoExtractor): formats = self._extract_m3u8_formats( m3u8_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') - self._sort_formats(formats) data = try_get( video, lambda x: x['trackingData']['properties'], dict) or {} diff --git a/yt_dlp/extractor/foxgay.py b/yt_dlp/extractor/foxgay.py index b285464ec..f4f29c65d 100644 --- a/yt_dlp/extractor/foxgay.py +++ b/yt_dlp/extractor/foxgay.py @@ -48,8 +48,6 @@ class FoxgayIE(InfoExtractor): } for source, resolution in zip( video_data['sources'], video_data.get('resolutions', itertools.repeat(None)))] - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/fptplay.py b/yt_dlp/extractor/fptplay.py index 1872d8a1c..85613bafe 100644 --- a/yt_dlp/extractor/fptplay.py +++ b/yt_dlp/extractor/fptplay.py @@ -59,7 +59,6 @@ class FptplayIE(InfoExtractor): info = self._download_json( self.get_api_with_st_token(video_id, int(slug_episode) - 1 if slug_episode else 0), video_id) formats, subtitles = self._extract_m3u8_formats_and_subtitles(info['data']['url'], video_id, 'mp4') - self._sort_formats(formats) return { 'id': video_id, 'title': join_nonempty(title, real_episode, delim=' - '), diff --git a/yt_dlp/extractor/francetv.py b/yt_dlp/extractor/francetv.py index 56a00a238..052317204 100644 --- a/yt_dlp/extractor/francetv.py +++ b/yt_dlp/extractor/francetv.py @@ -191,8 +191,6 @@ class FranceTVIE(InfoExtractor): } for sheet in spritesheets] }) - self._sort_formats(formats) - if subtitle: title += ' - %s' % subtitle title = title.strip() diff --git a/yt_dlp/extractor/freesound.py b/yt_dlp/extractor/freesound.py index 9724dbdf0..8b5f2278c 100644 --- a/yt_dlp/extractor/freesound.py +++ b/yt_dlp/extractor/freesound.py @@ -63,7 +63,6 @@ class FreesoundIE(InfoExtractor): 'format_note': channels, 'quality': quality, } for quality, format_url in enumerate(audio_urls)] - self._sort_formats(formats) return { 'id': audio_id, diff --git a/yt_dlp/extractor/freetv.py b/yt_dlp/extractor/freetv.py index f38bae90b..757a10d01 100644 --- a/yt_dlp/extractor/freetv.py +++ b/yt_dlp/extractor/freetv.py @@ -43,7 +43,6 @@ class FreeTvMoviesIE(FreeTvBaseIE): video_id, video_url = api_response['displayMeta']['contentID'], api_response['displayMeta']['streamURLVideo'] formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_url, video_id, 'mp4') - self._sort_formats(formats) return { 'id': video_id, @@ -106,7 +105,6 @@ class FreeTvIE(FreeTvBaseIE): for episode in episodes: video_id = str(episode['contentID']) formats, subtitles = self._extract_m3u8_formats_and_subtitles(episode['streamURL'], video_id, 'mp4') - self._sort_formats(formats) yield { 'id': video_id, diff --git a/yt_dlp/extractor/frontendmasters.py b/yt_dlp/extractor/frontendmasters.py index e0529b7ba..3bae8add0 100644 --- a/yt_dlp/extractor/frontendmasters.py +++ b/yt_dlp/extractor/frontendmasters.py @@ -160,7 +160,6 @@ class FrontendMastersIE(FrontendMastersBaseIE): 'format_id': format_id, }) formats.append(f) - self._sort_formats(formats) subtitles = { 'en': [{ diff --git a/yt_dlp/extractor/fujitv.py b/yt_dlp/extractor/fujitv.py index d7f49accd..668bb2743 100644 --- a/yt_dlp/extractor/fujitv.py +++ b/yt_dlp/extractor/fujitv.py @@ -57,7 +57,6 @@ class FujiTVFODPlus7IE(InfoExtractor): self._BITRATE_MAP.get(f.get('tbr'), ())))) formats.extend(fmt) subtitles = self._merge_subtitles(subtitles, subs) - self._sort_formats(formats, ['tbr']) return { 'id': video_id, @@ -68,4 +67,5 @@ class FujiTVFODPlus7IE(InfoExtractor): 'formats': formats, 'subtitles': subtitles, 'thumbnail': f'{self._BASE_URL}img/program/{series_id}/episode/{video_id}_a.jpg', + '_format_sort_fields': ('tbr', ) } diff --git a/yt_dlp/extractor/funimation.py b/yt_dlp/extractor/funimation.py index c70cf50c7..18363c1b9 100644 --- a/yt_dlp/extractor/funimation.py +++ b/yt_dlp/extractor/funimation.py @@ -247,7 +247,6 @@ class FunimationIE(FunimationBaseIE): self.raise_no_formats( 'There are no video formats matching the requested languages/versions', expected=True, video_id=display_id) self._remove_duplicate_formats(formats) - self._sort_formats(formats, ('lang', 'source')) return { 'id': episode_id, @@ -266,6 +265,7 @@ class FunimationIE(FunimationBaseIE): 'formats': formats, 'thumbnails': thumbnails, 'subtitles': subtitles, + '_format_sort_fields': ('lang', 'source'), } def _get_subtitles(self, subtitles, experience_id, episode, display_id, format_name): diff --git a/yt_dlp/extractor/fusion.py b/yt_dlp/extractor/fusion.py index 46bda49ea..689422fca 100644 --- a/yt_dlp/extractor/fusion.py +++ b/yt_dlp/extractor/fusion.py @@ -70,7 +70,6 @@ class FusionIE(InfoExtractor): 'protocol': 'm3u8_native' if ext == 'm3u8' else 'https', }) if formats: - self._sort_formats(formats) info['formats'] = formats else: info.update({ diff --git a/yt_dlp/extractor/gab.py b/yt_dlp/extractor/gab.py index 7ed81f761..5016e2ff9 100644 --- a/yt_dlp/extractor/gab.py +++ b/yt_dlp/extractor/gab.py @@ -54,7 +54,6 @@ class GabTVIE(InfoExtractor): else: frmt['height'] = str_to_int(resolution.replace('p', '')) formats.append(frmt) - self._sort_formats(formats) return { 'id': id, @@ -120,8 +119,6 @@ class GabIE(InfoExtractor): } for url, f in ((media.get('url'), metadata.get('original') or {}), (media.get('source_mp4'), metadata.get('playable') or {})) if url] - self._sort_formats(formats) - author = json_data.get('account') or {} entries.append({ 'id': f'{post_id}-{idx}', diff --git a/yt_dlp/extractor/gaia.py b/yt_dlp/extractor/gaia.py index 4ace0544a..c84386f2c 100644 --- a/yt_dlp/extractor/gaia.py +++ b/yt_dlp/extractor/gaia.py @@ -88,7 +88,6 @@ class GaiaIE(InfoExtractor): media_id, headers=headers) formats = self._extract_m3u8_formats( media['mediaUrls']['bcHLS'], media_id, 'mp4') - self._sort_formats(formats) subtitles = {} text_tracks = media.get('textTracks', {}) diff --git a/yt_dlp/extractor/gamespot.py b/yt_dlp/extractor/gamespot.py index e1d317377..8dec2522c 100644 --- a/yt_dlp/extractor/gamespot.py +++ b/yt_dlp/extractor/gamespot.py @@ -65,8 +65,6 @@ class GameSpotIE(OnceIE): formats.extend(self._extract_mpd_formats( mpd_url, page_id, mpd_id='dash', fatal=False)) - self._sort_formats(formats) - return { 'id': data_video.get('guid') or page_id, 'display_id': page_id, diff --git a/yt_dlp/extractor/gaskrank.py b/yt_dlp/extractor/gaskrank.py index 76ddcc40e..e0bbdae0a 100644 --- a/yt_dlp/extractor/gaskrank.py +++ b/yt_dlp/extractor/gaskrank.py @@ -93,6 +93,5 @@ class GaskrankIE(InfoExtractor): 'view_count': view_count, 'average_rating': average_rating, }) - self._sort_formats(entry['formats']) return entry diff --git a/yt_dlp/extractor/gedidigital.py b/yt_dlp/extractor/gedidigital.py index 4cc678021..1878d636d 100644 --- a/yt_dlp/extractor/gedidigital.py +++ b/yt_dlp/extractor/gedidigital.py @@ -186,7 +186,6 @@ class GediDigitalIE(InfoExtractor): duration = int_or_none(v) self._clean_formats(formats) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/generic.py b/yt_dlp/extractor/generic.py index 21e92cba6..85581e622 100644 --- a/yt_dlp/extractor/generic.py +++ b/yt_dlp/extractor/generic.py @@ -2619,7 +2619,6 @@ class GenericIE(InfoExtractor): 'vcodec': 'none' if m.group('type') == 'audio' else None }] info_dict['direct'] = True - self._sort_formats(formats) info_dict.update({ 'formats': formats, 'subtitles': subtitles, @@ -2637,7 +2636,6 @@ class GenericIE(InfoExtractor): if first_bytes.startswith(b'#EXTM3U'): self.report_detected('M3U playlist') info_dict['formats'], info_dict['subtitles'] = self._extract_m3u8_formats_and_subtitles(url, video_id, 'mp4') - self._sort_formats(info_dict['formats']) return info_dict # Maybe it's a direct link to a video? @@ -2671,12 +2669,10 @@ class GenericIE(InfoExtractor): elif doc.tag == 'SmoothStreamingMedia': info_dict['formats'], info_dict['subtitles'] = self._parse_ism_formats_and_subtitles(doc, url) self.report_detected('ISM manifest') - self._sort_formats(info_dict['formats']) return info_dict elif re.match(r'^(?:{[^}]+})?smil$', doc.tag): smil = self._parse_smil(doc, url, video_id) self.report_detected('SMIL file') - self._sort_formats(smil['formats']) return smil elif doc.tag == '{http://xspf.org/ns/0/}playlist': self.report_detected('XSPF playlist') @@ -2691,12 +2687,10 @@ class GenericIE(InfoExtractor): mpd_base_url=full_response.geturl().rpartition('/')[0], mpd_url=url) self.report_detected('DASH manifest') - self._sort_formats(info_dict['formats']) return info_dict elif re.match(r'^{http://ns\.adobe\.com/f4m/[12]\.0}manifest$', doc.tag): info_dict['formats'] = self._parse_f4m_formats(doc, url, video_id) self.report_detected('F4M manifest') - self._sort_formats(info_dict['formats']) return info_dict except xml.etree.ElementTree.ParseError: pass @@ -2840,7 +2834,6 @@ class GenericIE(InfoExtractor): }) if formats or subtitles: self.report_detected('video.js embed') - self._sort_formats(formats) return [{'formats': formats, 'subtitles': subtitles}] # Looking for http://schema.org/VideoObject @@ -2923,8 +2916,6 @@ class GenericIE(InfoExtractor): if not formats[-1].get('height'): formats[-1]['quality'] = 1 - self._sort_formats(formats) - return [{ 'id': flashvars['video_id'], 'display_id': display_id, @@ -3073,9 +3064,6 @@ class GenericIE(InfoExtractor): else: entry_info_dict['url'] = video_url - if entry_info_dict.get('formats'): - self._sort_formats(entry_info_dict['formats']) - entries.append(entry_info_dict) if len(entries) > 1: diff --git a/yt_dlp/extractor/genericembeds.py b/yt_dlp/extractor/genericembeds.py index 45e1618ba..9b4f14dd1 100644 --- a/yt_dlp/extractor/genericembeds.py +++ b/yt_dlp/extractor/genericembeds.py @@ -30,7 +30,6 @@ class HTML5MediaEmbedIE(InfoExtractor): make_archive_id('generic', f'{video_id}-{num}' if len(entries) > 1 else video_id), ], }) - self._sort_formats(entry['formats']) yield entry diff --git a/yt_dlp/extractor/gettr.py b/yt_dlp/extractor/gettr.py index 9bd6200b6..7795dc56f 100644 --- a/yt_dlp/extractor/gettr.py +++ b/yt_dlp/extractor/gettr.py @@ -121,8 +121,6 @@ class GettrIE(GettrBaseIE): 'height': int_or_none(post_data.get('vid_hgt')), }) - self._sort_formats(formats) - return { 'id': post_id, 'title': title, @@ -192,8 +190,6 @@ class GettrStreamingIE(GettrBaseIE): 'url': urljoin(self._MEDIA_BASE_URL, thumbnail), } for thumbnail in try_get(video_info, lambda x: x['postData']['imgs'], list) or []] - self._sort_formats(formats) - return { 'id': video_id, 'title': try_get(video_info, lambda x: x['postData']['ttl'], str), diff --git a/yt_dlp/extractor/gfycat.py b/yt_dlp/extractor/gfycat.py index 9d091c113..edc2e56e4 100644 --- a/yt_dlp/extractor/gfycat.py +++ b/yt_dlp/extractor/gfycat.py @@ -127,7 +127,6 @@ class GfycatIE(InfoExtractor): 'filesize': filesize, 'quality': quality(format_id), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/giantbomb.py b/yt_dlp/extractor/giantbomb.py index 5d6b208aa..112572366 100644 --- a/yt_dlp/extractor/giantbomb.py +++ b/yt_dlp/extractor/giantbomb.py @@ -74,8 +74,6 @@ class GiantBombIE(InfoExtractor): if youtube_id: return self.url_result(youtube_id, 'Youtube') - self._sort_formats(formats) - return { 'id': video_id, 'display_id': display_id, diff --git a/yt_dlp/extractor/giga.py b/yt_dlp/extractor/giga.py index e728598f7..b59c129ab 100644 --- a/yt_dlp/extractor/giga.py +++ b/yt_dlp/extractor/giga.py @@ -59,7 +59,6 @@ class GigaIE(InfoExtractor): 'format_id': '%s-%s' % (fmt['quality'], fmt['type'].split('/')[-1]), 'quality': quality(fmt['quality']), }) - self._sort_formats(formats) title = self._html_search_meta( 'title', webpage, 'title', fatal=True) diff --git a/yt_dlp/extractor/globo.py b/yt_dlp/extractor/globo.py index fb2a3fab2..a7be2cb76 100644 --- a/yt_dlp/extractor/globo.py +++ b/yt_dlp/extractor/globo.py @@ -139,7 +139,6 @@ class GloboIE(InfoExtractor): fmts, subtitles = self._extract_m3u8_formats_and_subtitles( signed_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False) formats.extend(fmts) - self._sort_formats(formats) for resource in video['resources']: if resource.get('type') == 'subtitle': diff --git a/yt_dlp/extractor/glomex.py b/yt_dlp/extractor/glomex.py index 86fe1b024..22aac0db9 100644 --- a/yt_dlp/extractor/glomex.py +++ b/yt_dlp/extractor/glomex.py @@ -82,7 +82,6 @@ class GlomexBaseIE(InfoExtractor): if video.get('language'): for fmt in formats: fmt['language'] = video['language'] - self._sort_formats(formats) images = (video.get('images') or []) + [video.get('image') or {}] thumbnails = [{ diff --git a/yt_dlp/extractor/go.py b/yt_dlp/extractor/go.py index 9b8723ea1..b075a02e0 100644 --- a/yt_dlp/extractor/go.py +++ b/yt_dlp/extractor/go.py @@ -293,7 +293,6 @@ class GoIE(AdobePassIE): 'height': height, }) formats.append(f) - self._sort_formats(formats) for cc in video_data.get('closedcaption', {}).get('src', []): cc_url = cc.get('value') diff --git a/yt_dlp/extractor/golem.py b/yt_dlp/extractor/golem.py index 8416b5aa4..c33d95019 100644 --- a/yt_dlp/extractor/golem.py +++ b/yt_dlp/extractor/golem.py @@ -51,7 +51,6 @@ class GolemIE(InfoExtractor): 'filesize': self._int(e.findtext('filesize'), 'filesize'), 'ext': determine_ext(e.findtext('./filename')), }) - self._sort_formats(formats) info['formats'] = formats thumbnails = [] diff --git a/yt_dlp/extractor/goodgame.py b/yt_dlp/extractor/goodgame.py index 0866647e6..c17ad56f4 100644 --- a/yt_dlp/extractor/goodgame.py +++ b/yt_dlp/extractor/goodgame.py @@ -41,7 +41,6 @@ class GoodGameIE(InfoExtractor): else: self.raise_no_formats('User is offline', expected=True, video_id=channel_name) - self._sort_formats(formats) return { 'id': player_id, 'formats': formats, diff --git a/yt_dlp/extractor/googledrive.py b/yt_dlp/extractor/googledrive.py index cb123b874..e027ea7c4 100644 --- a/yt_dlp/extractor/googledrive.py +++ b/yt_dlp/extractor/googledrive.py @@ -253,8 +253,6 @@ class GoogleDriveIE(InfoExtractor): if not formats and reason: self.raise_no_formats(reason, expected=True) - self._sort_formats(formats) - hl = get_value('hl') subtitles_id = None ttsurl = get_value('ttsurl') diff --git a/yt_dlp/extractor/goplay.py b/yt_dlp/extractor/goplay.py index 31267e1aa..2882b49dd 100644 --- a/yt_dlp/extractor/goplay.py +++ b/yt_dlp/extractor/goplay.py @@ -81,7 +81,6 @@ class GoPlayIE(InfoExtractor): formats, subs = self._extract_m3u8_formats_and_subtitles( api['video']['S'], video_id, ext='mp4', m3u8_id='HLS') - self._sort_formats(formats) info_dict.update({ 'id': video_id, diff --git a/yt_dlp/extractor/gopro.py b/yt_dlp/extractor/gopro.py index 14d6b2187..ae965374c 100644 --- a/yt_dlp/extractor/gopro.py +++ b/yt_dlp/extractor/gopro.py @@ -78,8 +78,6 @@ class GoProIE(InfoExtractor): 'height': int_or_none(fmt.get('height')), }) - self._sort_formats(formats) - title = str_or_none( try_get(metadata, lambda x: x['collection']['title']) or self._html_search_meta(['og:title', 'twitter:title'], webpage) diff --git a/yt_dlp/extractor/gronkh.py b/yt_dlp/extractor/gronkh.py index c112c7857..b6cf14117 100644 --- a/yt_dlp/extractor/gronkh.py +++ b/yt_dlp/extractor/gronkh.py @@ -37,7 +37,6 @@ class GronkhIE(InfoExtractor): 'url': data_json['vtt_url'], 'ext': 'vtt', }) - self._sort_formats(formats) return { 'id': id, 'title': data_json.get('title'), diff --git a/yt_dlp/extractor/hbo.py b/yt_dlp/extractor/hbo.py index f54628665..530bdb727 100644 --- a/yt_dlp/extractor/hbo.py +++ b/yt_dlp/extractor/hbo.py @@ -112,7 +112,6 @@ class HBOBaseIE(InfoExtractor): 'width': format_info.get('width'), 'height': format_info.get('height'), }) - self._sort_formats(formats) thumbnails = [] card_sizes = xpath_element(video_data, 'titleCardSizes') diff --git a/yt_dlp/extractor/hearthisat.py b/yt_dlp/extractor/hearthisat.py index 9aa1325af..d1a400d8c 100644 --- a/yt_dlp/extractor/hearthisat.py +++ b/yt_dlp/extractor/hearthisat.py @@ -81,7 +81,6 @@ class HearThisAtIE(InfoExtractor): 'acodec': ext, 'quality': 2, # Usually better quality }) - self._sort_formats(formats) return { 'id': track_id, diff --git a/yt_dlp/extractor/heise.py b/yt_dlp/extractor/heise.py index 86661d75a..27d737c04 100644 --- a/yt_dlp/extractor/heise.py +++ b/yt_dlp/extractor/heise.py @@ -194,7 +194,6 @@ class HeiseIE(InfoExtractor): 'format_id': '%s_%s' % (ext, label), 'height': height, }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/hellporno.py b/yt_dlp/extractor/hellporno.py index fd0327228..fa32b27c8 100644 --- a/yt_dlp/extractor/hellporno.py +++ b/yt_dlp/extractor/hellporno.py @@ -39,7 +39,6 @@ class HellPornoIE(InfoExtractor): title = remove_end(self._html_extract_title(webpage), ' - Hell Porno') info = self._parse_html5_media_entries(url, webpage, display_id)[0] - self._sort_formats(info['formats']) video_id = self._search_regex( (r'chs_object\s*=\s*["\'](\d+)', diff --git a/yt_dlp/extractor/helsinki.py b/yt_dlp/extractor/helsinki.py index b7c826055..e518cae1a 100644 --- a/yt_dlp/extractor/helsinki.py +++ b/yt_dlp/extractor/helsinki.py @@ -29,7 +29,6 @@ class HelsinkiIE(InfoExtractor): 'url': s['file'], 'ext': 'mp4', } for s in params['sources']] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/hidive.py b/yt_dlp/extractor/hidive.py index 50d49adf0..3a53f2c45 100644 --- a/yt_dlp/extractor/hidive.py +++ b/yt_dlp/extractor/hidive.py @@ -103,7 +103,6 @@ class HiDiveIE(InfoExtractor): f['language'] = audio f['format_note'] = f'{version}, {extra}' formats.extend(frmt) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/hitbox.py b/yt_dlp/extractor/hitbox.py index fdcf6770d..f0c689883 100644 --- a/yt_dlp/extractor/hitbox.py +++ b/yt_dlp/extractor/hitbox.py @@ -118,7 +118,6 @@ class HitboxIE(InfoExtractor): 'tbr': bitrate, 'format_note': label, }) - self._sort_formats(formats) metadata = self._extract_metadata( 'https://www.smashcast.tv/api/media/video', video_id) @@ -200,7 +199,6 @@ class HitboxLiveIE(HitboxIE): # XXX: Do not subclass from concrete IE 'page_url': url, 'player_url': 'http://www.hitbox.tv/static/player/flowplayer/flowplayer.commercial-3.2.16.swf', }) - self._sort_formats(formats) metadata = self._extract_metadata( 'https://www.smashcast.tv/api/media/live', video_id) diff --git a/yt_dlp/extractor/hketv.py b/yt_dlp/extractor/hketv.py index 4c616d1dd..10879564f 100644 --- a/yt_dlp/extractor/hketv.py +++ b/yt_dlp/extractor/hketv.py @@ -137,7 +137,6 @@ class HKETVIE(InfoExtractor): 'width': w, 'height': h, }) - self._sort_formats(formats) subtitles = {} tracks = try_get(playlist0, lambda x: x['tracks'], list) or [] diff --git a/yt_dlp/extractor/hotstar.py b/yt_dlp/extractor/hotstar.py index 48aa6e94a..8725c9436 100644 --- a/yt_dlp/extractor/hotstar.py +++ b/yt_dlp/extractor/hotstar.py @@ -227,7 +227,6 @@ class HotStarIE(HotStarBaseIE): if not formats and geo_restricted: self.raise_geo_restricted(countries=['IN'], metadata_available=True) - self._sort_formats(formats) for f in formats: f.setdefault('http_headers', {}).update(headers) diff --git a/yt_dlp/extractor/howstuffworks.py b/yt_dlp/extractor/howstuffworks.py index c49c0899e..238fc0b42 100644 --- a/yt_dlp/extractor/howstuffworks.py +++ b/yt_dlp/extractor/howstuffworks.py @@ -75,8 +75,6 @@ class HowStuffWorksIE(InfoExtractor): 'vbr': vbr, }) - self._sort_formats(formats) - return { 'id': '%s' % video_id, 'display_id': display_id, diff --git a/yt_dlp/extractor/hrfensehen.py b/yt_dlp/extractor/hrfensehen.py index 447782019..35e9f67c4 100644 --- a/yt_dlp/extractor/hrfensehen.py +++ b/yt_dlp/extractor/hrfensehen.py @@ -58,8 +58,6 @@ class HRFernsehenIE(InfoExtractor): stream_format['tbr'] = int_or_none(quality_information.group(4)) stream_formats.append(stream_format) - - self._sort_formats(stream_formats) return stream_formats def _real_extract(self, url): diff --git a/yt_dlp/extractor/hrti.py b/yt_dlp/extractor/hrti.py index 773ae0c9a..cfec80d14 100644 --- a/yt_dlp/extractor/hrti.py +++ b/yt_dlp/extractor/hrti.py @@ -144,7 +144,6 @@ class HRTiIE(HRTiBaseIE): formats = self._extract_m3u8_formats( m3u8_url, display_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') - self._sort_formats(formats) description = clean_html(title_info.get('summary_long')) age_limit = parse_age_limit(video.get('parental_control', {}).get('rating')) diff --git a/yt_dlp/extractor/hse.py b/yt_dlp/extractor/hse.py index 9faf46a5d..3cb21d2dd 100644 --- a/yt_dlp/extractor/hse.py +++ b/yt_dlp/extractor/hse.py @@ -25,7 +25,6 @@ class HSEShowBaseInfoExtractor(InfoExtractor): fmts, subs = self._extract_m3u8_formats_and_subtitles(src['url'], video_id, ext='mp4') formats.extend(fmts) subtitles = self._merge_subtitles(subtitles, subs) - self._sort_formats(formats) return formats, subtitles diff --git a/yt_dlp/extractor/huffpost.py b/yt_dlp/extractor/huffpost.py index 27ebc8b6c..69fdc34ef 100644 --- a/yt_dlp/extractor/huffpost.py +++ b/yt_dlp/extractor/huffpost.py @@ -79,8 +79,6 @@ class HuffPostIE(InfoExtractor): 'vcodec': 'none' if key.startswith('audio/') else None, }) - self._sort_formats(formats) - return { 'id': video_id, 'title': video_title, diff --git a/yt_dlp/extractor/hungama.py b/yt_dlp/extractor/hungama.py index 717f50a83..2e9939601 100644 --- a/yt_dlp/extractor/hungama.py +++ b/yt_dlp/extractor/hungama.py @@ -53,7 +53,6 @@ class HungamaIE(InfoExtractor): }) formats = self._extract_m3u8_formats(video_json['stream_url'], video_id, ext='mp4', m3u8_id='hls') - self._sort_formats(formats) json_ld = self._search_json_ld( self._download_webpage(url, video_id, fatal=False) or '', video_id, fatal=False) diff --git a/yt_dlp/extractor/huya.py b/yt_dlp/extractor/huya.py index c05e77c32..b6e9eec24 100644 --- a/yt_dlp/extractor/huya.py +++ b/yt_dlp/extractor/huya.py @@ -93,8 +93,6 @@ class HuyaLiveIE(InfoExtractor): **self._RESOLUTION.get(si.get('sDisplayName'), {}), }) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/icareus.py b/yt_dlp/extractor/icareus.py index dc7a2f0ba..d081cf42e 100644 --- a/yt_dlp/extractor/icareus.py +++ b/yt_dlp/extractor/icareus.py @@ -169,7 +169,6 @@ class IcareusIE(InfoExtractor): 'url': url_or_none(info.get('thumbnail') or assets.get('thumbnail')) }] - self._sort_formats(formats) return merge_dicts({ 'id': video_id, 'title': None, diff --git a/yt_dlp/extractor/ichinanalive.py b/yt_dlp/extractor/ichinanalive.py index ffff36cc1..9d55ddc02 100644 --- a/yt_dlp/extractor/ichinanalive.py +++ b/yt_dlp/extractor/ichinanalive.py @@ -73,8 +73,6 @@ class IchinanaLiveIE(InfoExtractor): 'acodec': 'aac', }) - self._sort_formats(formats) - return { 'id': video_id, 'title': uploader or video_id, @@ -147,8 +145,6 @@ class IchinanaLiveClipIE(InfoExtractor): 'http_headers': {'Referer': url}, }) - self._sort_formats(formats) - return { 'id': video_id, 'title': uploader or video_id, diff --git a/yt_dlp/extractor/ign.py b/yt_dlp/extractor/ign.py index bfb1e9d64..d4797d35e 100644 --- a/yt_dlp/extractor/ign.py +++ b/yt_dlp/extractor/ign.py @@ -102,8 +102,6 @@ class IGNIE(IGNBaseIE): 'url': mezzanine_url, }) - self._sort_formats(formats) - thumbnails = [] for thumbnail in (video.get('thumbnails') or []): thumbnail_url = thumbnail.get('url') diff --git a/yt_dlp/extractor/imdb.py b/yt_dlp/extractor/imdb.py index 74cab7dc1..557a3b7b7 100644 --- a/yt_dlp/extractor/imdb.py +++ b/yt_dlp/extractor/imdb.py @@ -100,7 +100,6 @@ class ImdbIE(InfoExtractor): 'ext': ext, 'quality': quality(format_id), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/imggaming.py b/yt_dlp/extractor/imggaming.py index 5b8bfda96..8e220fd9f 100644 --- a/yt_dlp/extractor/imggaming.py +++ b/yt_dlp/extractor/imggaming.py @@ -103,7 +103,6 @@ class ImgGamingBaseIE(InfoExtractor): formats.extend(self._extract_mpd_formats( media_url, media_id, mpd_id='dash', fatal=False, headers=self._MANIFEST_HEADERS)) - self._sort_formats(formats) subtitles = {} for subtitle in video_data.get('subtitles', []): diff --git a/yt_dlp/extractor/imgur.py b/yt_dlp/extractor/imgur.py index 21c56d879..bff6ed57f 100644 --- a/yt_dlp/extractor/imgur.py +++ b/yt_dlp/extractor/imgur.py @@ -84,8 +84,6 @@ class ImgurIE(InfoExtractor): }, }) - self._sort_formats(formats) - return { 'id': video_id, 'formats': formats, diff --git a/yt_dlp/extractor/indavideo.py b/yt_dlp/extractor/indavideo.py index b397c168c..4fa97d8bb 100644 --- a/yt_dlp/extractor/indavideo.py +++ b/yt_dlp/extractor/indavideo.py @@ -89,7 +89,6 @@ class IndavideoEmbedIE(InfoExtractor): 'url': video_url, 'height': height, }) - self._sort_formats(formats) timestamp = video.get('date') if timestamp: diff --git a/yt_dlp/extractor/infoq.py b/yt_dlp/extractor/infoq.py index 6b31701eb..192bcfe35 100644 --- a/yt_dlp/extractor/infoq.py +++ b/yt_dlp/extractor/infoq.py @@ -128,8 +128,6 @@ class InfoQIE(BokeCCBaseIE): + self._extract_http_video(webpage) + self._extract_http_audio(webpage, video_id)) - self._sort_formats(formats) - return { 'id': video_id, 'title': video_title, diff --git a/yt_dlp/extractor/instagram.py b/yt_dlp/extractor/instagram.py index fc08f377c..02335138f 100644 --- a/yt_dlp/extractor/instagram.py +++ b/yt_dlp/extractor/instagram.py @@ -155,7 +155,6 @@ class InstagramBaseIE(InfoExtractor): } for format in videos_list or []] if dash_manifest_raw: formats.extend(self._parse_mpd_formats(self._parse_xml(dash_manifest_raw, media_id), mpd_id='dash')) - self._sort_formats(formats) thumbnails = [{ 'url': thumbnail.get('url'), @@ -494,7 +493,6 @@ class InstagramIE(InstagramBaseIE): dash = traverse_obj(media, ('dash_info', 'video_dash_manifest')) if dash: formats.extend(self._parse_mpd_formats(self._parse_xml(dash, video_id), mpd_id='dash')) - self._sort_formats(formats) comment_data = traverse_obj(media, ('edge_media_to_parent_comment', 'edges')) comments = [{ diff --git a/yt_dlp/extractor/internazionale.py b/yt_dlp/extractor/internazionale.py index c8f70785f..1b1cb574a 100644 --- a/yt_dlp/extractor/internazionale.py +++ b/yt_dlp/extractor/internazionale.py @@ -60,7 +60,6 @@ class InternazionaleIE(InfoExtractor): entry_protocol='m3u8_native', m3u8_id='hls', fatal=False) formats.extend(self._extract_mpd_formats( video_base + 'mpd', display_id, mpd_id='dash', fatal=False)) - self._sort_formats(formats) timestamp = unified_timestamp(self._html_search_meta( 'article:published_time', webpage, 'timestamp')) diff --git a/yt_dlp/extractor/internetvideoarchive.py b/yt_dlp/extractor/internetvideoarchive.py index 6a8e30d73..9d2574cb0 100644 --- a/yt_dlp/extractor/internetvideoarchive.py +++ b/yt_dlp/extractor/internetvideoarchive.py @@ -48,7 +48,6 @@ class InternetVideoArchiveIE(InfoExtractor): replace_url('.mpd'), video_id, mpd_id='dash', fatal=False)) formats.extend(self._extract_ism_formats( replace_url('Manifest'), video_id, ism_id='mss', fatal=False)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/iprima.py b/yt_dlp/extractor/iprima.py index c98fe5b42..181820542 100644 --- a/yt_dlp/extractor/iprima.py +++ b/yt_dlp/extractor/iprima.py @@ -148,7 +148,6 @@ class IPrimaIE(InfoExtractor): elif manifest_type == 'DASH' or ext == 'mpd': formats += self._extract_mpd_formats( manifest_url, video_id, mpd_id='dash', fatal=False) - self._sort_formats(formats) final_result = self._search_json_ld(webpage, video_id, default={}) final_result.update({ @@ -248,8 +247,6 @@ class IPrimaCNNIE(InfoExtractor): if not formats and '>GEO_IP_NOT_ALLOWED<' in playerpage: self.raise_geo_restricted(countries=['CZ'], metadata_available=True) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/iqiyi.py b/yt_dlp/extractor/iqiyi.py index bb77647f8..dbc688fb9 100644 --- a/yt_dlp/extractor/iqiyi.py +++ b/yt_dlp/extractor/iqiyi.py @@ -385,7 +385,6 @@ class IqiyiIE(InfoExtractor): self._sleep(5, video_id) - self._sort_formats(formats) title = (get_element_by_id('widget-videotitle', webpage) or clean_html(get_element_by_attribute('class', 'mod-play-tit', webpage)) or self._html_search_regex(r']+data-videochanged-title="word"[^>]*>([^<]+)', webpage, 'title')) @@ -667,8 +666,6 @@ class IqIE(InfoExtractor): }) formats.extend(extracted_formats) - self._sort_formats(formats) - for sub_format in traverse_obj(initial_format_data, ('program', 'stl', ...), expected_type=dict, default=[]): lang = self._LID_TAGS.get(str_or_none(sub_format.get('lid')), sub_format.get('_name')) subtitles.setdefault(lang, []).extend([{ diff --git a/yt_dlp/extractor/islamchannel.py b/yt_dlp/extractor/islamchannel.py index bac852b12..253a846b7 100644 --- a/yt_dlp/extractor/islamchannel.py +++ b/yt_dlp/extractor/islamchannel.py @@ -41,7 +41,6 @@ class IslamChannelIE(InfoExtractor): traverse_obj(show_stream, ('response', 'tokenization', 'url')), video_id, headers=headers) formats, subs = self._extract_m3u8_formats_and_subtitles(traverse_obj(streams, ('Streams', 'Adaptive')), video_id, 'mp4') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/itv.py b/yt_dlp/extractor/itv.py index 26d77a469..9ac7be307 100644 --- a/yt_dlp/extractor/itv.py +++ b/yt_dlp/extractor/itv.py @@ -172,7 +172,6 @@ class ITVIE(InfoExtractor): formats.append({ 'url': href, }) - self._sort_formats(formats) info = self._search_json_ld(webpage, video_id, default={}) if not info: json_ld = self._parse_json(self._search_regex( diff --git a/yt_dlp/extractor/ivi.py b/yt_dlp/extractor/ivi.py index 6772fcbb9..dc6a48196 100644 --- a/yt_dlp/extractor/ivi.py +++ b/yt_dlp/extractor/ivi.py @@ -166,7 +166,6 @@ class IviIE(InfoExtractor): 'quality': quality(content_format), 'filesize': int_or_none(f.get('size_in_bytes')), }) - self._sort_formats(formats) compilation = result.get('compilation') episode = title if compilation else None diff --git a/yt_dlp/extractor/ivideon.py b/yt_dlp/extractor/ivideon.py index 538a961b7..7d1e554c2 100644 --- a/yt_dlp/extractor/ivideon.py +++ b/yt_dlp/extractor/ivideon.py @@ -67,7 +67,6 @@ class IvideonIE(InfoExtractor): 'ext': 'flv', 'quality': quality(format_id), } for format_id in self._QUALITIES] - self._sort_formats(formats) return { 'id': server_id, diff --git a/yt_dlp/extractor/iwara.py b/yt_dlp/extractor/iwara.py index f77c5d44d..ec3e59c6d 100644 --- a/yt_dlp/extractor/iwara.py +++ b/yt_dlp/extractor/iwara.py @@ -116,8 +116,6 @@ class IwaraIE(IwaraBaseIE): 'quality': 1 if format_id == 'Source' else 0, }) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/ixigua.py b/yt_dlp/extractor/ixigua.py index 163edf480..1f086d2bd 100644 --- a/yt_dlp/extractor/ixigua.py +++ b/yt_dlp/extractor/ixigua.py @@ -67,7 +67,6 @@ class IxiguaIE(InfoExtractor): json_data = self._get_json_data(webpage, video_id)['anyVideo']['gidInformation']['packerData']['video'] formats = list(self._media_selector(json_data.get('videoResource'))) - self._sort_formats(formats) return { 'id': video_id, 'title': json_data.get('title'), diff --git a/yt_dlp/extractor/izlesene.py b/yt_dlp/extractor/izlesene.py index 6520ecf6d..5cdf8709d 100644 --- a/yt_dlp/extractor/izlesene.py +++ b/yt_dlp/extractor/izlesene.py @@ -78,7 +78,6 @@ class IzleseneIE(InfoExtractor): 'ext': ext, 'height': height, }) - self._sort_formats(formats) description = self._og_search_description(webpage, default=None) thumbnail = video.get('posterURL') or self._proto_relative_url( diff --git a/yt_dlp/extractor/jable.py b/yt_dlp/extractor/jable.py index 6840654cc..84c3225e4 100644 --- a/yt_dlp/extractor/jable.py +++ b/yt_dlp/extractor/jable.py @@ -45,7 +45,6 @@ class JableIE(InfoExtractor): webpage = self._download_webpage(url, video_id) formats = self._extract_m3u8_formats( self._search_regex(r'var\s+hlsUrl\s*=\s*\'([^\']+)', webpage, 'hls_url'), video_id, 'mp4', m3u8_id='hls') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/jamendo.py b/yt_dlp/extractor/jamendo.py index 578e57a67..a2bbba397 100644 --- a/yt_dlp/extractor/jamendo.py +++ b/yt_dlp/extractor/jamendo.py @@ -87,7 +87,6 @@ class JamendoIE(InfoExtractor): ('ogg1', 'ogg', 'ogg'), ('flac', 'flac', 'flac'), ))] - self._sort_formats(formats) urls = [] thumbnails = [] diff --git a/yt_dlp/extractor/japandiet.py b/yt_dlp/extractor/japandiet.py index f2f50db7a..6c650568a 100644 --- a/yt_dlp/extractor/japandiet.py +++ b/yt_dlp/extractor/japandiet.py @@ -122,7 +122,6 @@ class ShugiinItvLiveRoomIE(ShugiinItvBaseIE): formats, subtitles = self._extract_m3u8_formats_and_subtitles( f'https://hlslive.shugiintv.go.jp/{room_id}/amlst:{room_id}/playlist.m3u8', room_id, ext='mp4') - self._sort_formats(formats) return { 'id': room_id, @@ -160,7 +159,6 @@ class ShugiinItvVodIE(ShugiinItvBaseIE): m3u8_url = re.sub(r'^http://', 'https://', m3u8_url) formats, subtitles = self._extract_m3u8_formats_and_subtitles( m3u8_url, video_id, ext='mp4') - self._sort_formats(formats) title = self._html_search_regex( (r'(.+)\s*\(\d+分\)', @@ -264,7 +262,6 @@ class SangiinIE(InfoExtractor): 'm3u8 url', group=2) formats, subs = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/jixie.py b/yt_dlp/extractor/jixie.py index 7480af050..4830e61c1 100644 --- a/yt_dlp/extractor/jixie.py +++ b/yt_dlp/extractor/jixie.py @@ -31,7 +31,6 @@ class JixieBaseIE(InfoExtractor): 'ext': 'mp4', }) - self._sort_formats(formats) return { 'id': video_id, 'display_id': display_id, diff --git a/yt_dlp/extractor/joj.py b/yt_dlp/extractor/joj.py index 298b37823..9b622845a 100644 --- a/yt_dlp/extractor/joj.py +++ b/yt_dlp/extractor/joj.py @@ -81,7 +81,6 @@ class JojIE(InfoExtractor): r'(\d+)[pP]', format_id or path, 'height', default=None)), }) - self._sort_formats(formats) thumbnail = self._og_search_thumbnail(webpage) diff --git a/yt_dlp/extractor/kakao.py b/yt_dlp/extractor/kakao.py index a5014d931..1f0f0a5d5 100644 --- a/yt_dlp/extractor/kakao.py +++ b/yt_dlp/extractor/kakao.py @@ -120,7 +120,6 @@ class KakaoIE(InfoExtractor): 'filesize': int_or_none(fmt.get('filesize')), 'tbr': int_or_none(fmt.get('kbps')), }) - self._sort_formats(formats) thumbs = [] for thumb in clip.get('clipChapterThumbnailList') or []: diff --git a/yt_dlp/extractor/kaltura.py b/yt_dlp/extractor/kaltura.py index 677f989a7..95e2deea5 100644 --- a/yt_dlp/extractor/kaltura.py +++ b/yt_dlp/extractor/kaltura.py @@ -518,8 +518,6 @@ class KalturaIE(InfoExtractor): formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) - self._sort_formats(formats) - if captions: for caption in captions.get('objects', []): # Continue if caption is not ready diff --git a/yt_dlp/extractor/keezmovies.py b/yt_dlp/extractor/keezmovies.py index 1c2d5c01c..b50da420c 100644 --- a/yt_dlp/extractor/keezmovies.py +++ b/yt_dlp/extractor/keezmovies.py @@ -5,7 +5,6 @@ from ..aes import aes_decrypt_text from ..compat import compat_urllib_parse_unquote from ..utils import ( determine_ext, - ExtractorError, format_field, int_or_none, str_to_int, @@ -103,12 +102,6 @@ class KeezMoviesIE(InfoExtractor): self.raise_no_formats( 'Video %s is no longer available' % video_id, expected=True) - try: - self._sort_formats(formats) - except ExtractorError: - if fatal: - raise - if not title: title = self._html_search_regex( r']*>([^<]+)', webpage, 'title') diff --git a/yt_dlp/extractor/kelbyone.py b/yt_dlp/extractor/kelbyone.py index dea056c12..2ca9ad426 100644 --- a/yt_dlp/extractor/kelbyone.py +++ b/yt_dlp/extractor/kelbyone.py @@ -59,7 +59,6 @@ class KelbyOneIE(InfoExtractor): subtitles.setdefault('en', []).append({ 'url': track['file'], }) - self._sort_formats(formats) yield { 'id': video_id, 'title': item['title'], diff --git a/yt_dlp/extractor/kinja.py b/yt_dlp/extractor/kinja.py index 3747d8eea..df1386fb8 100644 --- a/yt_dlp/extractor/kinja.py +++ b/yt_dlp/extractor/kinja.py @@ -147,7 +147,6 @@ class KinjaEmbedIE(InfoExtractor): formats.extend(self._extract_m3u8_formats( m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)) - self._sort_formats(formats) thumbnail = None poster = data.get('poster') or {} @@ -195,8 +194,6 @@ class KinjaEmbedIE(InfoExtractor): 'url': fallback_rendition_url, }) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/kinopoisk.py b/yt_dlp/extractor/kinopoisk.py index 84a2489a3..5db908349 100644 --- a/yt_dlp/extractor/kinopoisk.py +++ b/yt_dlp/extractor/kinopoisk.py @@ -44,7 +44,6 @@ class KinoPoiskIE(InfoExtractor): formats = self._extract_m3u8_formats( data['playlistEntity']['uri'], video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') - self._sort_formats(formats) description = dict_get( film, ('descriptscription', 'description', diff --git a/yt_dlp/extractor/konserthusetplay.py b/yt_dlp/extractor/konserthusetplay.py index 1e177c363..10767f1b6 100644 --- a/yt_dlp/extractor/konserthusetplay.py +++ b/yt_dlp/extractor/konserthusetplay.py @@ -95,8 +95,6 @@ class KonserthusetPlayIE(InfoExtractor): 'url': fallback_url, }) - self._sort_formats(formats) - title = player_config.get('title') or media['title'] description = player_config.get('mediaInfo', {}).get('description') thumbnail = media.get('image') diff --git a/yt_dlp/extractor/koo.py b/yt_dlp/extractor/koo.py index 892d355ba..9cfec5eb9 100644 --- a/yt_dlp/extractor/koo.py +++ b/yt_dlp/extractor/koo.py @@ -101,7 +101,6 @@ class KooIE(InfoExtractor): if not formats: self.raise_no_formats('No video/audio found at the provided url.', expected=True) - self._sort_formats(formats) return { 'id': id, 'title': clean_html(item_json.get('title')), diff --git a/yt_dlp/extractor/kusi.py b/yt_dlp/extractor/kusi.py index 4fec2c2b2..a23ad8945 100644 --- a/yt_dlp/extractor/kusi.py +++ b/yt_dlp/extractor/kusi.py @@ -71,7 +71,6 @@ class KUSIIE(InfoExtractor): 'width': int_or_none(quality.attrib.get('width')), 'vbr': float_or_none(quality.attrib.get('bitratebits'), scale=1000), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/kuwo.py b/yt_dlp/extractor/kuwo.py index 0c9518e66..cfec1c50f 100644 --- a/yt_dlp/extractor/kuwo.py +++ b/yt_dlp/extractor/kuwo.py @@ -104,7 +104,6 @@ class KuwoIE(KuwoBaseIE): lrc_content = None formats = self._get_formats(song_id) - self._sort_formats(formats) album_id = self._html_search_regex( r']+href="http://www\.kuwo\.cn/album/(\d+)/"', @@ -339,8 +338,6 @@ class KuwoMvIE(KuwoBaseIE): 'format_id': 'mv', }) - self._sort_formats(formats) - return { 'id': song_id, 'title': song_name, diff --git a/yt_dlp/extractor/la7.py b/yt_dlp/extractor/la7.py index 8ce44cc13..68dc1d4df 100644 --- a/yt_dlp/extractor/la7.py +++ b/yt_dlp/extractor/la7.py @@ -78,8 +78,6 @@ class LA7IE(InfoExtractor): if http_f: formats.append(http_f) - self._sort_formats(formats) - return { 'id': video_id, 'title': self._og_search_title(webpage, default=None), @@ -136,7 +134,6 @@ class LA7PodcastEpisodeIE(InfoExtractor): 'format_id': ext, 'ext': ext, }] - self._sort_formats(formats) title = self._html_search_regex( (r'
(?P.+?)</', diff --git a/yt_dlp/extractor/laola1tv.py b/yt_dlp/extractor/laola1tv.py index a90ed16a0..416dd7eb4 100644 --- a/yt_dlp/extractor/laola1tv.py +++ b/yt_dlp/extractor/laola1tv.py @@ -49,7 +49,6 @@ class Laola1TvEmbedIE(InfoExtractor): formats = self._extract_akamai_formats( '%s?hdnea=%s' % (token_attrib['url'], token_attrib['auth']), video_id) - self._sort_formats(formats) return formats def _real_extract(self, url): diff --git a/yt_dlp/extractor/lbry.py b/yt_dlp/extractor/lbry.py index b2b61abac..b5def1e07 100644 --- a/yt_dlp/extractor/lbry.py +++ b/yt_dlp/extractor/lbry.py @@ -250,7 +250,6 @@ class LBRYIE(LBRYBaseIE): if determine_ext(final_url) == 'm3u8': info['formats'] = self._extract_m3u8_formats( final_url, display_id, 'mp4', 'm3u8_native', m3u8_id='hls', live=is_live, headers=headers) - self._sort_formats(info['formats']) else: info['url'] = streaming_url return { diff --git a/yt_dlp/extractor/lecture2go.py b/yt_dlp/extractor/lecture2go.py index bee4e7587..3a9b30a3c 100644 --- a/yt_dlp/extractor/lecture2go.py +++ b/yt_dlp/extractor/lecture2go.py @@ -49,8 +49,6 @@ class Lecture2GoIE(InfoExtractor): 'url': url, }) - self._sort_formats(formats) - creator = self._html_search_regex( r'<div[^>]+id="description">([^<]+)</div>', webpage, 'creator', fatal=False) duration = parse_duration(self._html_search_regex( diff --git a/yt_dlp/extractor/lecturio.py b/yt_dlp/extractor/lecturio.py index c3d0cb193..973764c63 100644 --- a/yt_dlp/extractor/lecturio.py +++ b/yt_dlp/extractor/lecturio.py @@ -137,7 +137,6 @@ class LecturioIE(LecturioBaseIE): 'height': int(mobj.group(1)), }) formats.append(f) - self._sort_formats(formats) subtitles = {} automatic_captions = {} diff --git a/yt_dlp/extractor/leeco.py b/yt_dlp/extractor/leeco.py index 258e396cb..85033b8f8 100644 --- a/yt_dlp/extractor/leeco.py +++ b/yt_dlp/extractor/leeco.py @@ -182,7 +182,6 @@ class LeIE(InfoExtractor): f['height'] = int_or_none(format_id[:-1]) formats.append(f) - self._sort_formats(formats, ('res', 'quality')) publish_time = parse_iso8601(self._html_search_regex( r'发布时间 ([^<>]+) ', page, 'publish time', default=None), @@ -196,6 +195,7 @@ class LeIE(InfoExtractor): 'thumbnail': playurl['pic'], 'description': description, 'timestamp': publish_time, + '_format_sort_fields': ('res', 'quality'), } @@ -356,7 +356,6 @@ class LetvCloudIE(InfoExtractor): media_id = uu + '_' + vu formats = self._get_formats('flash', uu, vu, media_id) + self._get_formats('html5', uu, vu, media_id) - self._sort_formats(formats) return { 'id': media_id, diff --git a/yt_dlp/extractor/lego.py b/yt_dlp/extractor/lego.py index 7d0238a1f..811b44758 100644 --- a/yt_dlp/extractor/lego.py +++ b/yt_dlp/extractor/lego.py @@ -113,7 +113,6 @@ class LEGOIE(InfoExtractor): 'width': quality[2], }), formats.append(f) - self._sort_formats(formats) subtitles = {} sub_file_id = video.get('SubFileId') diff --git a/yt_dlp/extractor/libraryofcongress.py b/yt_dlp/extractor/libraryofcongress.py index afe3c98a1..b76ca0908 100644 --- a/yt_dlp/extractor/libraryofcongress.py +++ b/yt_dlp/extractor/libraryofcongress.py @@ -126,8 +126,6 @@ class LibraryOfCongressIE(InfoExtractor): 'filesize_approx': parse_filesize(m.group('size')), }) - self._sort_formats(formats) - duration = float_or_none(data.get('duration')) view_count = int_or_none(data.get('viewCount')) diff --git a/yt_dlp/extractor/lifenews.py b/yt_dlp/extractor/lifenews.py index 8c7d2064d..919cfcb37 100644 --- a/yt_dlp/extractor/lifenews.py +++ b/yt_dlp/extractor/lifenews.py @@ -223,8 +223,6 @@ class LifeEmbedIE(InfoExtractor): else: extract_original(video_url) - self._sort_formats(formats) - thumbnail = thumbnail or self._search_regex( r'"image"\s*:\s*"([^"]+)', webpage, 'thumbnail', default=None) diff --git a/yt_dlp/extractor/likee.py b/yt_dlp/extractor/likee.py index b53e7a5ca..74ee2bea9 100644 --- a/yt_dlp/extractor/likee.py +++ b/yt_dlp/extractor/likee.py @@ -122,7 +122,6 @@ class LikeeIE(InfoExtractor): 'width': info.get('video_width'), 'quality': 1, }] - self._sort_formats(formats) return { 'id': video_id, 'title': info.get('msgText'), diff --git a/yt_dlp/extractor/limelight.py b/yt_dlp/extractor/limelight.py index 90065094b..e11ec43d6 100644 --- a/yt_dlp/extractor/limelight.py +++ b/yt_dlp/extractor/limelight.py @@ -179,8 +179,6 @@ class LimelightBaseIE(InfoExtractor): 'ext': ext, }) - self._sort_formats(formats) - subtitles = {} for flag in mobile_item.get('flags'): if flag == 'ClosedCaptions': diff --git a/yt_dlp/extractor/line.py b/yt_dlp/extractor/line.py index 09c512e50..3fab9c8a5 100644 --- a/yt_dlp/extractor/line.py +++ b/yt_dlp/extractor/line.py @@ -98,7 +98,6 @@ class LineLiveIE(LineLiveBaseIE): archive_status = item.get('archiveStatus') if archive_status != 'ARCHIVED': self.raise_no_formats('this video has been ' + archive_status.lower(), expected=True) - self._sort_formats(formats) info['formats'] = formats return info diff --git a/yt_dlp/extractor/linkedin.py b/yt_dlp/extractor/linkedin.py index 27f1080b4..2bf2e9a11 100644 --- a/yt_dlp/extractor/linkedin.py +++ b/yt_dlp/extractor/linkedin.py @@ -111,8 +111,6 @@ class LinkedInIE(LinkedInBaseIE): 'tbr': float_or_none(source.get('data-bitrate'), scale=1000), } for source in sources] - self._sort_formats(formats) - return { 'id': video_id, 'formats': formats, @@ -187,10 +185,6 @@ class LinkedInLearningIE(LinkedInLearningBaseIE): streaming_url, video_slug, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)) - # It seems like this would be correctly handled by default - # However, unless someone can confirm this, the old - # behaviour is being kept as-is - self._sort_formats(formats, ('res', 'source_preference')) subtitles = {} duration = int_or_none(video_data.get('durationInSeconds')) transcript_lines = try_get(video_data, lambda x: x['transcript']['lines'], expected_type=list) @@ -208,6 +202,10 @@ class LinkedInLearningIE(LinkedInLearningBaseIE): 'timestamp': float_or_none(video_data.get('publishedOn'), 1000), 'duration': duration, 'subtitles': subtitles, + # It seems like this would be correctly handled by default + # However, unless someone can confirm this, the old + # behaviour is being kept as-is + '_format_sort_fields': ('res', 'source_preference') } diff --git a/yt_dlp/extractor/linuxacademy.py b/yt_dlp/extractor/linuxacademy.py index bf22855a9..a570248b7 100644 --- a/yt_dlp/extractor/linuxacademy.py +++ b/yt_dlp/extractor/linuxacademy.py @@ -218,7 +218,6 @@ class LinuxAcademyIE(InfoExtractor): formats = self._extract_m3u8_formats( m3u8_url, item_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') - self._sort_formats(formats) info = { 'id': item_id, 'formats': formats, diff --git a/yt_dlp/extractor/livestream.py b/yt_dlp/extractor/livestream.py index 70449dce5..d883eafcf 100644 --- a/yt_dlp/extractor/livestream.py +++ b/yt_dlp/extractor/livestream.py @@ -126,7 +126,6 @@ class LivestreamIE(InfoExtractor): if f4m_url: formats.extend(self._extract_f4m_formats( f4m_url, video_id, f4m_id='hds', fatal=False)) - self._sort_formats(formats) comments = [{ 'author_id': comment.get('author_id'), @@ -171,7 +170,6 @@ class LivestreamIE(InfoExtractor): 'url': rtsp_url, 'format_id': 'rtsp', }) - self._sort_formats(formats) return { 'id': broadcast_id, @@ -300,7 +298,6 @@ class LivestreamOriginalIE(InfoExtractor): 'format_id': 'rtsp', }) - self._sort_formats(formats) return formats def _extract_folder(self, url, folder_id): diff --git a/yt_dlp/extractor/lnkgo.py b/yt_dlp/extractor/lnkgo.py index 9ea08ec5a..6282d2eaf 100644 --- a/yt_dlp/extractor/lnkgo.py +++ b/yt_dlp/extractor/lnkgo.py @@ -67,7 +67,6 @@ class LnkGoIE(InfoExtractor): formats = self._extract_m3u8_formats( self._M3U8_TEMPL % (prefix, video_info['videoUrl'], video_info.get('secureTokenParams') or ''), video_id, 'mp4', 'm3u8_native') - self._sort_formats(formats) return { 'id': video_id, @@ -149,7 +148,6 @@ class LnkIE(InfoExtractor): formats.extend(fmts) subtitles = self._merge_subtitles(subtitles, subs) - self._sort_formats(formats) return { 'id': id, 'title': video_json.get('title'), diff --git a/yt_dlp/extractor/lrt.py b/yt_dlp/extractor/lrt.py index a49fd592f..80d4d1cdb 100644 --- a/yt_dlp/extractor/lrt.py +++ b/yt_dlp/extractor/lrt.py @@ -37,7 +37,6 @@ class LRTStreamIE(LRTBaseIE): fmts, subs = self._extract_m3u8_formats_and_subtitles(stream_url, video_id, 'mp4', m3u8_id='hls', live=True) formats.extend(fmts) subtitles = self._merge_subtitles(subtitles, subs) - self._sort_formats(formats) stream_title = self._extract_js_var(webpage, 'video_title', 'LRT') return { diff --git a/yt_dlp/extractor/lynda.py b/yt_dlp/extractor/lynda.py index 1ae7f9d4f..768ce913e 100644 --- a/yt_dlp/extractor/lynda.py +++ b/yt_dlp/extractor/lynda.py @@ -157,7 +157,6 @@ class LyndaIE(LyndaBaseIE): 'format_id': '%s-%s' % (cdn, format_id) if cdn else format_id, 'height': int_or_none(format_id), }) - self._sort_formats(formats) conviva = self._download_json( 'https://www.lynda.com/ajax/player/conviva', video_id, @@ -207,7 +206,6 @@ class LyndaIE(LyndaBaseIE): } for format_id, video_url in prioritized_stream.items()]) self._check_formats(formats, video_id) - self._sort_formats(formats) subtitles = self.extract_subtitles(video_id) diff --git a/yt_dlp/extractor/mailru.py b/yt_dlp/extractor/mailru.py index 5f30d0eaa..387d211fe 100644 --- a/yt_dlp/extractor/mailru.py +++ b/yt_dlp/extractor/mailru.py @@ -160,7 +160,6 @@ class MailRuIE(InfoExtractor): 'height': height, 'http_headers': headers, }) - self._sort_formats(formats) meta_data = video_data['meta'] title = remove_end(meta_data['title'], '.mp4') diff --git a/yt_dlp/extractor/mainstreaming.py b/yt_dlp/extractor/mainstreaming.py index 213a1df57..fe5589d59 100644 --- a/yt_dlp/extractor/mainstreaming.py +++ b/yt_dlp/extractor/mainstreaming.py @@ -197,8 +197,6 @@ class MainStreamingIE(InfoExtractor): subtitles = self._merge_subtitles(m3u8_subs, mpd_subs) formats.extend(m3u8_formats + mpd_formats) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/malltv.py b/yt_dlp/extractor/malltv.py index 02f226be5..e1031d8da 100644 --- a/yt_dlp/extractor/malltv.py +++ b/yt_dlp/extractor/malltv.py @@ -72,7 +72,6 @@ class MallTVIE(InfoExtractor): formats = self._extract_m3u8_formats( video['VideoSource'], video_id, 'mp4', 'm3u8_native') - self._sort_formats(formats) subtitles = {} for s in (video.get('Subtitles') or {}): diff --git a/yt_dlp/extractor/mangomolo.py b/yt_dlp/extractor/mangomolo.py index 568831aa8..efaf66fa2 100644 --- a/yt_dlp/extractor/mangomolo.py +++ b/yt_dlp/extractor/mangomolo.py @@ -44,7 +44,6 @@ class MangomoloBaseIE(InfoExtractor): ], webpage, 'format url') formats = self._extract_wowza_formats( format_url, page_id, m3u8_entry_protocol, ['smil']) - self._sort_formats(formats) return { 'id': page_id, diff --git a/yt_dlp/extractor/manoto.py b/yt_dlp/extractor/manoto.py index dc8653f5d..2792e6e70 100644 --- a/yt_dlp/extractor/manoto.py +++ b/yt_dlp/extractor/manoto.py @@ -54,7 +54,6 @@ class ManotoTVIE(InfoExtractor): episode_json = self._download_json(_API_URL.format('showmodule', 'episodedetails', video_id), video_id) details = episode_json.get('details', {}) formats = self._extract_m3u8_formats(details.get('videoM3u8Url'), video_id, 'mp4') - self._sort_formats(formats) return { 'id': video_id, 'series': details.get('showTitle'), @@ -126,7 +125,6 @@ class ManotoTVLiveIE(InfoExtractor): details = json.get('details', {}) video_url = details.get('liveUrl') formats = self._extract_m3u8_formats(video_url, video_id, 'mp4', live=True) - self._sort_formats(formats) return { 'id': video_id, 'title': 'Manoto TV Live', diff --git a/yt_dlp/extractor/manyvids.py b/yt_dlp/extractor/manyvids.py index 63ff5f054..741745378 100644 --- a/yt_dlp/extractor/manyvids.py +++ b/yt_dlp/extractor/manyvids.py @@ -135,8 +135,6 @@ class ManyVidsIE(InfoExtractor): if 'transcoded' in f['format_id']: f['preference'] = f.get('preference', -1) - 1 - self._sort_formats(formats) - def get_likes(): likes = self._search_regex( r'''(<a\b[^>]*\bdata-id\s*=\s*(['"])%s\2[^>]*>)''' % (video_id, ), diff --git a/yt_dlp/extractor/massengeschmacktv.py b/yt_dlp/extractor/massengeschmacktv.py index 4508e4391..7dacb43e0 100644 --- a/yt_dlp/extractor/massengeschmacktv.py +++ b/yt_dlp/extractor/massengeschmacktv.py @@ -65,8 +65,6 @@ class MassengeschmackTVIE(InfoExtractor): 'vcodec': 'none' if format_id.startswith('Audio') else None, }) - self._sort_formats(formats) - return { 'id': episode, 'title': title, diff --git a/yt_dlp/extractor/masters.py b/yt_dlp/extractor/masters.py index d1ce07f10..716f1c961 100644 --- a/yt_dlp/extractor/masters.py +++ b/yt_dlp/extractor/masters.py @@ -25,7 +25,6 @@ class MastersIE(InfoExtractor): f'https://www.masters.com/relatedcontent/rest/v2/masters_v1/en/content/masters_v1_{video_id}_en', video_id) formats, subtitles = self._extract_m3u8_formats_and_subtitles(traverse_obj(content_resp, ('media', 'm3u8')), video_id, 'mp4') - self._sort_formats(formats) thumbnails = [{'id': name, 'url': url} for name, url in traverse_obj(content_resp, ('images', 0), default={}).items()] diff --git a/yt_dlp/extractor/matchtv.py b/yt_dlp/extractor/matchtv.py index 94ae20b26..a67fa9fe4 100644 --- a/yt_dlp/extractor/matchtv.py +++ b/yt_dlp/extractor/matchtv.py @@ -43,7 +43,6 @@ class MatchTVIE(InfoExtractor): })['data']['videoUrl'] f4m_url = xpath_text(self._download_xml(video_url, video_id), './to') formats = self._extract_f4m_formats(f4m_url, video_id) - self._sort_formats(formats) return { 'id': video_id, 'title': 'Матч ТВ - Прямой эфир', diff --git a/yt_dlp/extractor/mdr.py b/yt_dlp/extractor/mdr.py index b44cf809a..49f5b49a4 100644 --- a/yt_dlp/extractor/mdr.py +++ b/yt_dlp/extractor/mdr.py @@ -162,8 +162,6 @@ class MDRIE(InfoExtractor): formats.append(f) - self._sort_formats(formats) - description = xpath_text(doc, './broadcast/broadcastDescription', 'description') timestamp = parse_iso8601( xpath_text( diff --git a/yt_dlp/extractor/medaltv.py b/yt_dlp/extractor/medaltv.py index 80efcc764..82be823b8 100644 --- a/yt_dlp/extractor/medaltv.py +++ b/yt_dlp/extractor/medaltv.py @@ -150,8 +150,6 @@ class MedalTVIE(InfoExtractor): 'An unknown error occurred ({0}).'.format(error), video_id=video_id) - self._sort_formats(formats) - # Necessary because the id of the author is not known in advance. # Won't raise an issue if no profile can be found as this is optional. author = traverse_obj(api_response, ('pageProps', 'profile')) or {} diff --git a/yt_dlp/extractor/mediaklikk.py b/yt_dlp/extractor/mediaklikk.py index f9a449377..46365081b 100644 --- a/yt_dlp/extractor/mediaklikk.py +++ b/yt_dlp/extractor/mediaklikk.py @@ -89,7 +89,6 @@ class MediaKlikkIE(InfoExtractor): formats = self._extract_wowza_formats( playlist_url, video_id, skip_protocols=['f4m', 'smil', 'dash']) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/medialaan.py b/yt_dlp/extractor/medialaan.py index 6daa50846..bce20dcfd 100644 --- a/yt_dlp/extractor/medialaan.py +++ b/yt_dlp/extractor/medialaan.py @@ -100,7 +100,6 @@ class MedialaanIE(InfoExtractor): 'ext': ext, 'url': src, }) - self._sort_formats(formats) return { 'id': production_id, diff --git a/yt_dlp/extractor/mediaset.py b/yt_dlp/extractor/mediaset.py index a3b5491d2..61bdb2a3f 100644 --- a/yt_dlp/extractor/mediaset.py +++ b/yt_dlp/extractor/mediaset.py @@ -247,8 +247,6 @@ class MediasetIE(ThePlatformBaseIE): if (first_e or geo_e) and not formats: raise geo_e or first_e - self._sort_formats(formats) - feed_data = self._download_json( 'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs-v2/guid/-/' + guid, guid, fatal=False) diff --git a/yt_dlp/extractor/mediasite.py b/yt_dlp/extractor/mediasite.py index 0ffd01cd2..fe549c49f 100644 --- a/yt_dlp/extractor/mediasite.py +++ b/yt_dlp/extractor/mediasite.py @@ -264,8 +264,6 @@ class MediasiteIE(InfoExtractor): }) formats.extend(stream_formats) - self._sort_formats(formats) - # XXX: Presentation['Presenters'] # XXX: Presentation['Transcript'] diff --git a/yt_dlp/extractor/mediaworksnz.py b/yt_dlp/extractor/mediaworksnz.py index 651239bd4..62e37d24a 100644 --- a/yt_dlp/extractor/mediaworksnz.py +++ b/yt_dlp/extractor/mediaworksnz.py @@ -90,8 +90,6 @@ class MediaWorksNZVODIE(InfoExtractor): audio_format.setdefault('acodec', 'aac') formats.append(audio_format) - self._sort_formats(formats) - return { 'id': video_id, 'title': asset.get('title'), diff --git a/yt_dlp/extractor/megatvcom.py b/yt_dlp/extractor/megatvcom.py index 54c7b7f9f..2f3f11f51 100644 --- a/yt_dlp/extractor/megatvcom.py +++ b/yt_dlp/extractor/megatvcom.py @@ -87,7 +87,6 @@ class MegaTVComIE(MegaTVComBaseIE): formats, subs = [{'url': source}], {} if player_attrs.get('subs'): self._merge_subtitles({'und': [{'url': player_attrs['subs']}]}, target=subs) - self._sort_formats(formats) return { 'id': video_id, 'display_id': display_id, diff --git a/yt_dlp/extractor/melonvod.py b/yt_dlp/extractor/melonvod.py index 0cbc961c4..1d3fff856 100644 --- a/yt_dlp/extractor/melonvod.py +++ b/yt_dlp/extractor/melonvod.py @@ -44,7 +44,6 @@ class MelonVODIE(InfoExtractor): formats = self._extract_m3u8_formats( stream_info['encUrl'], video_id, 'mp4', m3u8_id='hls') - self._sort_formats(formats) artist_list = play_info.get('artistList') artist = None diff --git a/yt_dlp/extractor/metacafe.py b/yt_dlp/extractor/metacafe.py index 048c74e68..d7f5def0e 100644 --- a/yt_dlp/extractor/metacafe.py +++ b/yt_dlp/extractor/metacafe.py @@ -267,7 +267,6 @@ class MetacafeIE(InfoExtractor): 'url': video_url, 'ext': video_ext, }] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/metacritic.py b/yt_dlp/extractor/metacritic.py index 543bdffad..14410549a 100644 --- a/yt_dlp/extractor/metacritic.py +++ b/yt_dlp/extractor/metacritic.py @@ -49,7 +49,6 @@ class MetacriticIE(InfoExtractor): 'format_id': rate_str, 'tbr': int(rate_str), }) - self._sort_formats(formats) description = self._html_search_regex(r'<b>Description:</b>(.*?)</p>', webpage, 'description', flags=re.DOTALL) diff --git a/yt_dlp/extractor/mgoon.py b/yt_dlp/extractor/mgoon.py index c41c51384..2388a7192 100644 --- a/yt_dlp/extractor/mgoon.py +++ b/yt_dlp/extractor/mgoon.py @@ -68,7 +68,6 @@ class MgoonIE(InfoExtractor): 'ext': fmt['format'], }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/mgtv.py b/yt_dlp/extractor/mgtv.py index 37594d12d..edc92b371 100644 --- a/yt_dlp/extractor/mgtv.py +++ b/yt_dlp/extractor/mgtv.py @@ -117,7 +117,6 @@ class MGTVIE(InfoExtractor): }, 'format_note': stream.get('name'), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/microsoftembed.py b/yt_dlp/extractor/microsoftembed.py index 1425a0159..f71ab3e92 100644 --- a/yt_dlp/extractor/microsoftembed.py +++ b/yt_dlp/extractor/microsoftembed.py @@ -39,7 +39,6 @@ class MicrosoftEmbedIE(InfoExtractor): 'height': source.get('heightPixels'), 'width': source.get('widthPixels'), }) - self._sort_formats(formats) subtitles = { lang: [{ diff --git a/yt_dlp/extractor/microsoftstream.py b/yt_dlp/extractor/microsoftstream.py index 2dde82a75..9b50996b7 100644 --- a/yt_dlp/extractor/microsoftstream.py +++ b/yt_dlp/extractor/microsoftstream.py @@ -101,7 +101,6 @@ class MicrosoftStreamIE(InfoExtractor): playlist['playbackUrl'], video_id, ism_id='mss', fatal=False, headers=headers)) formats = [merge_dicts(f, {'language': language}) for f in formats] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/microsoftvirtualacademy.py b/yt_dlp/extractor/microsoftvirtualacademy.py index f15f00ee5..b759b1860 100644 --- a/yt_dlp/extractor/microsoftvirtualacademy.py +++ b/yt_dlp/extractor/microsoftvirtualacademy.py @@ -93,7 +93,6 @@ class MicrosoftVirtualAcademyIE(MicrosoftVirtualAcademyBaseIE): 'acodec': acodec, 'vcodec': vcodec, }) - self._sort_formats(formats) subtitles = {} for source in settings.findall('.//MarkerResourceSource'): diff --git a/yt_dlp/extractor/mildom.py b/yt_dlp/extractor/mildom.py index c7a61dfa0..f64d575dc 100644 --- a/yt_dlp/extractor/mildom.py +++ b/yt_dlp/extractor/mildom.py @@ -74,8 +74,6 @@ class MildomIE(MildomBaseIE): for fmt in formats: fmt.setdefault('http_headers', {})['Referer'] = 'https://www.mildom.com/' - self._sort_formats(formats) - return { 'id': result_video_id, 'title': self._html_search_meta('twitter:description', webpage, default=None) or traverse_obj(enterstudio, 'anchor_intro'), @@ -166,8 +164,6 @@ class MildomVodIE(MildomBaseIE): 'ext': 'mp4' }) - self._sort_formats(formats) - return { 'id': video_id, 'title': self._html_search_meta(('og:description', 'description'), webpage, default=None) or autoplay.get('title'), diff --git a/yt_dlp/extractor/minds.py b/yt_dlp/extractor/minds.py index 85dd5fd79..2fb17920c 100644 --- a/yt_dlp/extractor/minds.py +++ b/yt_dlp/extractor/minds.py @@ -92,7 +92,6 @@ class MindsIE(MindsBaseIE): 'height': int_or_none(source.get('size')), 'url': src, }) - self._sort_formats(formats) entity = video.get('entity') or entity owner = entity.get('ownerObj') or {} diff --git a/yt_dlp/extractor/minoto.py b/yt_dlp/extractor/minoto.py index e799cd3bc..8d18179c7 100644 --- a/yt_dlp/extractor/minoto.py +++ b/yt_dlp/extractor/minoto.py @@ -35,7 +35,6 @@ class MinotoIE(InfoExtractor): 'height': int_or_none(fmt.get('height')), **parse_codecs(fmt.get('codecs')), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/mirrativ.py b/yt_dlp/extractor/mirrativ.py index 8192f2b46..0a8ee0c3a 100644 --- a/yt_dlp/extractor/mirrativ.py +++ b/yt_dlp/extractor/mirrativ.py @@ -55,7 +55,6 @@ class MirrativIE(MirrativBaseIE): hls_url, video_id, ext='mp4', entry_protocol='m3u8_native', m3u8_id='hls', live=is_live) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/mixcloud.py b/yt_dlp/extractor/mixcloud.py index becc56a2b..fb5a08ca2 100644 --- a/yt_dlp/extractor/mixcloud.py +++ b/yt_dlp/extractor/mixcloud.py @@ -169,8 +169,6 @@ class MixcloudIE(MixcloudBaseIE): if not formats and cloudcast.get('isExclusive'): self.raise_login_required(metadata_available=True) - self._sort_formats(formats) - comments = [] for edge in (try_get(cloudcast, lambda x: x['comments']['edges']) or []): node = edge.get('node') or {} diff --git a/yt_dlp/extractor/mlb.py b/yt_dlp/extractor/mlb.py index 2f0f2deab..72057dc97 100644 --- a/yt_dlp/extractor/mlb.py +++ b/yt_dlp/extractor/mlb.py @@ -54,7 +54,6 @@ class MLBBaseIE(InfoExtractor): 'width': int(mobj.group(1)), }) formats.append(f) - self._sort_formats(formats) thumbnails = [] for cut in (try_get(feed, lambda x: x['image']['cuts'], list) or []): @@ -339,7 +338,6 @@ class MLBTVIE(InfoExtractor): formats.extend(f) self._merge_subtitles(s, target=subtitles) - self._sort_formats(formats) return { 'id': video_id, 'title': traverse_obj(airings, (..., 'titles', 0, 'episodeName'), get_all=False), diff --git a/yt_dlp/extractor/mnet.py b/yt_dlp/extractor/mnet.py index 65e3d476a..98bab2e10 100644 --- a/yt_dlp/extractor/mnet.py +++ b/yt_dlp/extractor/mnet.py @@ -59,7 +59,6 @@ class MnetIE(InfoExtractor): m3u8_url += '?' + token formats = self._extract_wowza_formats( m3u8_url, video_id, skip_protocols=['rtmp', 'rtsp', 'f4m']) - self._sort_formats(formats) description = info.get('ment') duration = parse_duration(info.get('time')) diff --git a/yt_dlp/extractor/mocha.py b/yt_dlp/extractor/mocha.py index 27d2d9c2c..5f72b810b 100644 --- a/yt_dlp/extractor/mocha.py +++ b/yt_dlp/extractor/mocha.py @@ -42,8 +42,6 @@ class MochaVideoIE(InfoExtractor): formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) - self._sort_formats(formats) - return { 'id': video_id, 'display_id': json_data.get('slug') or video_slug, diff --git a/yt_dlp/extractor/moviezine.py b/yt_dlp/extractor/moviezine.py index 5757322d6..cffcdcfb5 100644 --- a/yt_dlp/extractor/moviezine.py +++ b/yt_dlp/extractor/moviezine.py @@ -29,8 +29,6 @@ class MoviezineIE(InfoExtractor): 'ext': 'mp4', }] - self._sort_formats(formats) - return { 'id': video_id, 'title': self._search_regex(r'title: "(.+?)",', jsplayer, 'title'), diff --git a/yt_dlp/extractor/msn.py b/yt_dlp/extractor/msn.py index 6f4935e51..f91c53eba 100644 --- a/yt_dlp/extractor/msn.py +++ b/yt_dlp/extractor/msn.py @@ -131,7 +131,6 @@ class MSNIE(InfoExtractor): 'vbr': int_or_none(self._search_regex(r'_(\d+)\.mp4', format_url, 'vbr', default=None)), 'quality': 1 if format_id == '1001' else None, }) - self._sort_formats(formats) subtitles = {} for file_ in video.get('files', []): diff --git a/yt_dlp/extractor/mtv.py b/yt_dlp/extractor/mtv.py index b2009dc5b..d91be6270 100644 --- a/yt_dlp/extractor/mtv.py +++ b/yt_dlp/extractor/mtv.py @@ -102,8 +102,6 @@ class MTVServicesInfoExtractor(InfoExtractor): }]) except (KeyError, TypeError): raise ExtractorError('Invalid rendition field.') - if formats: - self._sort_formats(formats) return formats def _extract_subtitles(self, mdoc, mtvn_id): @@ -202,8 +200,6 @@ class MTVServicesInfoExtractor(InfoExtractor): if not formats: return None - self._sort_formats(formats) - return { 'title': title, 'formats': formats, diff --git a/yt_dlp/extractor/muenchentv.py b/yt_dlp/extractor/muenchentv.py index b9681d1bd..36a2d4688 100644 --- a/yt_dlp/extractor/muenchentv.py +++ b/yt_dlp/extractor/muenchentv.py @@ -60,7 +60,6 @@ class MuenchenTVIE(InfoExtractor): 'format_id': format_id, 'preference': -100 if '.smil' in s['file'] else 0, # Strictly inferior than all other formats? }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/mwave.py b/yt_dlp/extractor/mwave.py index 0cbb16736..efbfd9d43 100644 --- a/yt_dlp/extractor/mwave.py +++ b/yt_dlp/extractor/mwave.py @@ -47,7 +47,6 @@ class MwaveIE(InfoExtractor): continue formats.extend( self._extract_f4m_formats(f4m_url + '&hdcore=3.0.3', video_id, f4m_id=stream_name)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/myspace.py b/yt_dlp/extractor/myspace.py index 63d36c30a..345109837 100644 --- a/yt_dlp/extractor/myspace.py +++ b/yt_dlp/extractor/myspace.py @@ -122,7 +122,6 @@ class MySpaceIE(InfoExtractor): else: raise ExtractorError( 'Found song but don\'t know how to download it') - self._sort_formats(formats) return { 'id': video_id, 'title': self._og_search_title(webpage), @@ -140,7 +139,6 @@ class MySpaceIE(InfoExtractor): video.get('streamUrl'), video.get('hlsStreamUrl'), video.get('mp4StreamUrl'), int_or_none(video.get('width')), int_or_none(video.get('height'))) - self._sort_formats(formats) return { 'id': video_id, 'title': video['title'], diff --git a/yt_dlp/extractor/n1.py b/yt_dlp/extractor/n1.py index cc0ff533e..55345f398 100644 --- a/yt_dlp/extractor/n1.py +++ b/yt_dlp/extractor/n1.py @@ -24,8 +24,6 @@ class N1InfoAssetIE(InfoExtractor): formats = self._extract_m3u8_formats( url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False) - self._sort_formats(formats) - return { 'id': video_id, 'title': video_id, diff --git a/yt_dlp/extractor/nate.py b/yt_dlp/extractor/nate.py index c83b2acbd..5e74caa7f 100644 --- a/yt_dlp/extractor/nate.py +++ b/yt_dlp/extractor/nate.py @@ -68,7 +68,6 @@ class NateIE(InfoExtractor): 'height': self._QUALITY.get(f_url[-2:]), 'quality': int_or_none(f_url[-2:]), } for f_url in video_data.get('smcUriList') or []] - self._sort_formats(formats) return { 'id': id, 'title': video_data.get('clipTitle'), diff --git a/yt_dlp/extractor/naver.py b/yt_dlp/extractor/naver.py index 3c4e73535..b5425c744 100644 --- a/yt_dlp/extractor/naver.py +++ b/yt_dlp/extractor/naver.py @@ -67,7 +67,6 @@ class NaverBaseIE(InfoExtractor): formats.extend(self._extract_m3u8_formats( update_url_query(stream_url, query), video_id, 'mp4', 'm3u8_native', m3u8_id=stream_type, fatal=False)) - self._sort_formats(formats) replace_ext = lambda x, y: re.sub(self._CAPTION_EXT_RE, '.' + y, x) @@ -239,7 +238,6 @@ class NaverLiveIE(InfoExtractor): quality.get('url'), video_id, 'mp4', m3u8_id=quality.get('qualityId'), live=True )) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/nba.py b/yt_dlp/extractor/nba.py index e95c1b795..d8fc82488 100644 --- a/yt_dlp/extractor/nba.py +++ b/yt_dlp/extractor/nba.py @@ -92,7 +92,6 @@ class NBAWatchBaseIE(NBACVPBaseIE): formats.extend(cvp_info['formats']) info = merge_dicts(info, cvp_info) - self._sort_formats(formats) info['formats'] = formats return info @@ -318,7 +317,6 @@ class NBABaseIE(NBACVPBaseIE): subtitles = self._merge_subtitles(subtitles, cvp_info['subtitles']) info = merge_dicts(info, cvp_info) - self._sort_formats(formats) else: info.update(self._embed_url_result(team, video['videoId'])) diff --git a/yt_dlp/extractor/nbc.py b/yt_dlp/extractor/nbc.py index dbc82de9f..1ea6355b5 100644 --- a/yt_dlp/extractor/nbc.py +++ b/yt_dlp/extractor/nbc.py @@ -305,7 +305,6 @@ class NBCSportsStreamIE(AdobePassIE): 'resourceId': base64.b64encode(resource.encode()).decode(), }).encode())['tokenizedUrl'] formats = self._extract_m3u8_formats(tokenized_url, video_id, 'mp4') - self._sort_formats(formats) return { 'id': video_id, 'title': title, @@ -437,7 +436,6 @@ class NBCNewsIE(ThePlatformIE): # XXX: Do not subclass from concrete IE 'tbr': tbr, 'ext': 'mp4', }) - self._sort_formats(formats) subtitles = {} closed_captioning = video_data.get('closedCaptioning') @@ -581,7 +579,6 @@ class NBCOlympicsStreamIE(AdobePassIE): # -http_seekable requires ffmpeg 4.3+ but it doesnt seem possible to # download with ffmpeg without this option f['downloader_options'] = {'ffmpeg_args': ['-seekable', '0', '-http_seekable', '0', '-icy', '0']} - self._sort_formats(formats) return { 'id': pid, @@ -745,7 +742,6 @@ class NBCStationsIE(InfoExtractor): formats.extend(self._extract_m3u8_formats( manifest_url, video_id, 'mp4', headers=headers, m3u8_id='hls', fatal=live, live=live, errnote='No HLS formats found')) - self._sort_formats(formats) return { 'id': str_or_none(video_id), diff --git a/yt_dlp/extractor/ndr.py b/yt_dlp/extractor/ndr.py index 90a658cd8..41ea3629a 100644 --- a/yt_dlp/extractor/ndr.py +++ b/yt_dlp/extractor/ndr.py @@ -266,7 +266,6 @@ class NDREmbedBaseIE(InfoExtractor): # XXX: Conventionally, Concrete class name ff['vcodec'] = 'none' ff['ext'] = ext or 'mp3' formats.append(ff) - self._sort_formats(formats) config = playlist['config'] diff --git a/yt_dlp/extractor/neteasemusic.py b/yt_dlp/extractor/neteasemusic.py index 5cf96ad7e..595709899 100644 --- a/yt_dlp/extractor/neteasemusic.py +++ b/yt_dlp/extractor/neteasemusic.py @@ -236,7 +236,6 @@ class NetEaseMusicIE(NetEaseMusicBaseIE): song_id, 'Downloading song info')['songs'][0] formats = self.extract_formats(info) - self._sort_formats(formats) lyrics_info = self.query_api( 'song/lyric?id=%s&lv=-1&tv=-1' % song_id, @@ -412,7 +411,6 @@ class NetEaseMusicMvIE(NetEaseMusicBaseIE): {'url': mv_url, 'ext': 'mp4', 'format_id': '%sp' % brs, 'height': int(brs)} for brs, mv_url in info['brs'].items() ] - self._sort_formats(formats) return { 'id': mv_id, @@ -482,7 +480,6 @@ class NetEaseMusicProgramIE(NetEaseMusicBaseIE): if not self._yes_playlist(info['songs'] and program_id, info['mainSong']['id']): formats = self.extract_formats(info['mainSong']) - self._sort_formats(formats) return { 'id': info['mainSong']['id'], diff --git a/yt_dlp/extractor/netzkino.py b/yt_dlp/extractor/netzkino.py index 49b29b67c..9c314e223 100644 --- a/yt_dlp/extractor/netzkino.py +++ b/yt_dlp/extractor/netzkino.py @@ -72,7 +72,6 @@ class NetzkinoIE(InfoExtractor): 'ext': 'mp4', 'url': tpl.replace('{}', film_fn) + suffix[key], } for key, tpl in templates.items()] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/newgrounds.py b/yt_dlp/extractor/newgrounds.py index ba24720e3..9e3286dfe 100644 --- a/yt_dlp/extractor/newgrounds.py +++ b/yt_dlp/extractor/newgrounds.py @@ -172,7 +172,6 @@ class NewgroundsIE(InfoExtractor): if video_type_description == 'Audio File': formats[0]['vcodec'] = 'none' self._check_formats(formats, media_id) - self._sort_formats(formats) return { 'id': media_id, diff --git a/yt_dlp/extractor/newspicks.py b/yt_dlp/extractor/newspicks.py index a368ce4e0..b6334dcba 100644 --- a/yt_dlp/extractor/newspicks.py +++ b/yt_dlp/extractor/newspicks.py @@ -29,7 +29,6 @@ class NewsPicksIE(InfoExtractor): if not entries: raise ExtractorError('No HTML5 media elements found') info = entries[0] - self._sort_formats(info['formats']) title = self._html_search_meta('og:title', webpage, fatal=False) description = self._html_search_meta( diff --git a/yt_dlp/extractor/newstube.py b/yt_dlp/extractor/newstube.py index 20db46057..820eb4ba7 100644 --- a/yt_dlp/extractor/newstube.py +++ b/yt_dlp/extractor/newstube.py @@ -64,7 +64,6 @@ class NewstubeIE(InfoExtractor): formats.append(f) self._check_formats(formats, video_guid) - self._sort_formats(formats) return { 'id': video_guid, diff --git a/yt_dlp/extractor/newsy.py b/yt_dlp/extractor/newsy.py index 9fde6c079..a5a7b168c 100644 --- a/yt_dlp/extractor/newsy.py +++ b/yt_dlp/extractor/newsy.py @@ -36,7 +36,6 @@ class NewsyIE(InfoExtractor): fmts, subs = self._extract_m3u8_formats_and_subtitles(data_json['stream'], display_id) formats.extend(fmts) subtitles = self._merge_subtitles(subtitles, subs) - self._sort_formats(formats) return merge_dicts(ld_json, { 'id': data_json['id'], 'display_id': display_id, diff --git a/yt_dlp/extractor/nexx.py b/yt_dlp/extractor/nexx.py index 69c48652c..b4874c8f3 100644 --- a/yt_dlp/extractor/nexx.py +++ b/yt_dlp/extractor/nexx.py @@ -452,8 +452,6 @@ class NexxIE(InfoExtractor): else: self.raise_no_formats(f'{cdn} formats are currently not supported', video_id) - self._sort_formats(formats) - subtitles = {} for sub in video.get('captiondata') or []: if sub.get('data'): diff --git a/yt_dlp/extractor/nfb.py b/yt_dlp/extractor/nfb.py index 79c6aaf0c..38e068af4 100644 --- a/yt_dlp/extractor/nfb.py +++ b/yt_dlp/extractor/nfb.py @@ -35,7 +35,6 @@ class NFBIE(InfoExtractor): player, 'source', default=None, fatal=True) formats, subtitles = self._extract_m3u8_formats_and_subtitles(source, video_id, ext='mp4') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/nfhsnetwork.py b/yt_dlp/extractor/nfhsnetwork.py index e6f98b036..febad8fdf 100644 --- a/yt_dlp/extractor/nfhsnetwork.py +++ b/yt_dlp/extractor/nfhsnetwork.py @@ -124,7 +124,6 @@ class NFHSNetworkIE(InfoExtractor): video_id).get('video_url') formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', live=isLive) - self._sort_formats(formats, ['res', 'tbr']) return { 'id': video_id, @@ -137,5 +136,6 @@ class NFHSNetworkIE(InfoExtractor): 'uploader_url': uploaderPage, 'location': location, 'upload_date': upload_date, - 'is_live': isLive + 'is_live': isLive, + '_format_sort_fields': ('res', 'tbr'), } diff --git a/yt_dlp/extractor/nfl.py b/yt_dlp/extractor/nfl.py index 106566611..29c53d5a5 100644 --- a/yt_dlp/extractor/nfl.py +++ b/yt_dlp/extractor/nfl.py @@ -71,7 +71,6 @@ class NFLBaseIE(InfoExtractor): ext = determine_ext(item_url) if ext == 'm3u8': info['formats'] = self._extract_m3u8_formats(item_url, media_id, 'mp4') - self._sort_formats(info['formats']) else: info['url'] = item_url if item.get('audio') is True: diff --git a/yt_dlp/extractor/nhk.py b/yt_dlp/extractor/nhk.py index 517660ef1..59702b247 100644 --- a/yt_dlp/extractor/nhk.py +++ b/yt_dlp/extractor/nhk.py @@ -78,7 +78,6 @@ class NhkBaseIE(InfoExtractor): m3u8_id='hls', fatal=False) for f in info['formats']: f['language'] = lang - self._sort_formats(info['formats']) else: info.update({ '_type': 'url_transparent', @@ -240,7 +239,6 @@ class NhkForSchoolBangumiIE(InfoExtractor): formats = self._extract_m3u8_formats( f'https://nhks-vh.akamaihd.net/i/das/{video_id[0:8]}/{video_id}_V_000.f4v/master.m3u8', video_id, ext='mp4', m3u8_id='hls') - self._sort_formats(formats) duration = parse_duration(base_values.get('r_duration')) diff --git a/yt_dlp/extractor/nhl.py b/yt_dlp/extractor/nhl.py index 884f9e2ae..2521c40e0 100644 --- a/yt_dlp/extractor/nhl.py +++ b/yt_dlp/extractor/nhl.py @@ -48,7 +48,6 @@ class NHLBaseIE(InfoExtractor): 'height': height, 'tbr': int_or_none(self._search_regex(r'_(\d+)[kK]', playback_url, 'bitrate', default=None)), }) - self._sort_formats(formats) thumbnails = [] cuts = video_data.get('image', {}).get('cuts') or [] diff --git a/yt_dlp/extractor/niconico.py b/yt_dlp/extractor/niconico.py index e131b044a..210303759 100644 --- a/yt_dlp/extractor/niconico.py +++ b/yt_dlp/extractor/niconico.py @@ -425,8 +425,6 @@ class NiconicoIE(InfoExtractor): if fmt: formats.append(fmt) - self._sort_formats(formats) - # Start extracting information tags = None if webpage: diff --git a/yt_dlp/extractor/ninecninemedia.py b/yt_dlp/extractor/ninecninemedia.py index 462caf466..31df42f4f 100644 --- a/yt_dlp/extractor/ninecninemedia.py +++ b/yt_dlp/extractor/ninecninemedia.py @@ -43,7 +43,6 @@ class NineCNineMediaIE(InfoExtractor): formats.extend(self._extract_mpd_formats( manifest_base_url + 'mpd', content_id, mpd_id='dash', fatal=False)) - self._sort_formats(formats) thumbnails = [] for image in (content.get('Images') or []): diff --git a/yt_dlp/extractor/ninegag.py b/yt_dlp/extractor/ninegag.py index 86e710f2b..865ad99ac 100644 --- a/yt_dlp/extractor/ninegag.py +++ b/yt_dlp/extractor/ninegag.py @@ -116,7 +116,6 @@ class NineGagIE(InfoExtractor): 'format_id': image_id, }) formats.append(common) - self._sort_formats(formats) section = traverse_obj(post, ('postSection', 'name')) diff --git a/yt_dlp/extractor/njpwworld.py b/yt_dlp/extractor/njpwworld.py index e761cf257..7b8a526f0 100644 --- a/yt_dlp/extractor/njpwworld.py +++ b/yt_dlp/extractor/njpwworld.py @@ -69,8 +69,6 @@ class NJPWWorldIE(InfoExtractor): formats += self._extract_m3u8_formats( player_url, video_id, 'mp4', 'm3u8_native', m3u8_id=kind, fatal=False, quality=int(kind == 'high')) - self._sort_formats(formats) - tag_block = get_element_by_class('tag-block', webpage) tags = re.findall( r'<a[^>]+class="tag-[^"]+"[^>]*>([^<]+)</a>', tag_block diff --git a/yt_dlp/extractor/nobelprize.py b/yt_dlp/extractor/nobelprize.py index 35b64530f..1aa9705be 100644 --- a/yt_dlp/extractor/nobelprize.py +++ b/yt_dlp/extractor/nobelprize.py @@ -48,7 +48,6 @@ class NobelPrizeIE(InfoExtractor): formats.append({ 'url': source_src, }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/noodlemagazine.py b/yt_dlp/extractor/noodlemagazine.py index 3e04da67e..e6208956f 100644 --- a/yt_dlp/extractor/noodlemagazine.py +++ b/yt_dlp/extractor/noodlemagazine.py @@ -47,8 +47,6 @@ class NoodleMagazineIE(InfoExtractor): 'ext': source.get('type'), } for source in playlist_info.get('sources')] - self._sort_formats(formats) - return { 'id': video_id, 'formats': formats, diff --git a/yt_dlp/extractor/nova.py b/yt_dlp/extractor/nova.py index 6875d26ba..8bd3fd472 100644 --- a/yt_dlp/extractor/nova.py +++ b/yt_dlp/extractor/nova.py @@ -123,7 +123,6 @@ class NovaEmbedIE(InfoExtractor): if not formats and has_drm: self.report_drm(video_id) - self._sort_formats(formats) title = self._og_search_title( webpage, default=None) or self._search_regex( @@ -308,7 +307,6 @@ class NovaIE(InfoExtractor): formats = [{ 'url': video_url, }] - self._sort_formats(formats) title = mediafile.get('meta', {}).get('title') or self._og_search_title(webpage) thumbnail = config.get('poster') diff --git a/yt_dlp/extractor/novaplay.py b/yt_dlp/extractor/novaplay.py index 152b93bd4..92d1d136c 100644 --- a/yt_dlp/extractor/novaplay.py +++ b/yt_dlp/extractor/novaplay.py @@ -55,7 +55,6 @@ class NovaPlayIE(InfoExtractor): 'Authorization': f'Bearer {self._access_token}' })[0]['links']['play']['href'] formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', m3u8_id='hls') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/noz.py b/yt_dlp/extractor/noz.py index b42a56f7e..59d259f9d 100644 --- a/yt_dlp/extractor/noz.py +++ b/yt_dlp/extractor/noz.py @@ -71,7 +71,6 @@ class NozIE(InfoExtractor): formats.extend(self._extract_m3u8_formats( m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/npo.py b/yt_dlp/extractor/npo.py index b307e6a78..f18cb9e28 100644 --- a/yt_dlp/extractor/npo.py +++ b/yt_dlp/extractor/npo.py @@ -247,8 +247,6 @@ class NPOIE(NPOBaseIE): if not self.get_param('allow_unplayable_formats') and drm: self.report_drm(video_id) - self._sort_formats(formats) - info = { 'id': video_id, 'title': video_id, @@ -454,8 +452,6 @@ class NPOIE(NPOBaseIE): 'quality': stream.get('kwaliteit'), }) - self._sort_formats(formats) - subtitles = {} if metadata.get('tt888') == 'ja': subtitles['nl'] = [{ diff --git a/yt_dlp/extractor/npr.py b/yt_dlp/extractor/npr.py index e677e862d..4b6855c93 100644 --- a/yt_dlp/extractor/npr.py +++ b/yt_dlp/extractor/npr.py @@ -121,8 +121,6 @@ class NprIE(InfoExtractor): m3u8_url = traverse_obj(list(raw_json_ld), (..., 'subjectOf', ..., 'embedUrl'), get_all=False) formats = self._extract_m3u8_formats(m3u8_url, media_id, 'mp4', m3u8_id='hls', fatal=False) - self._sort_formats(formats) - entries.append({ 'id': media_id, 'title': media.get('title', {}).get('$text') or playlist_title, diff --git a/yt_dlp/extractor/nrk.py b/yt_dlp/extractor/nrk.py index 14951f8e1..88d08e5e3 100644 --- a/yt_dlp/extractor/nrk.py +++ b/yt_dlp/extractor/nrk.py @@ -180,7 +180,6 @@ class NRKIE(NRKBaseIE): 'format_id': asset_format, 'vcodec': 'none', }) - self._sort_formats(formats) data = call_playback_api('metadata') diff --git a/yt_dlp/extractor/ntvde.py b/yt_dlp/extractor/ntvde.py index d252ced86..6d7ea3d18 100644 --- a/yt_dlp/extractor/ntvde.py +++ b/yt_dlp/extractor/ntvde.py @@ -60,7 +60,6 @@ class NTVDeIE(InfoExtractor): formats.extend(self._extract_m3u8_formats( m3u8_url, video_id, ext='mp4', entry_protocol='m3u8_native', quality=1, m3u8_id='hls', fatal=False)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/ntvru.py b/yt_dlp/extractor/ntvru.py index c8df110e8..8d5877daa 100644 --- a/yt_dlp/extractor/ntvru.py +++ b/yt_dlp/extractor/ntvru.py @@ -115,7 +115,6 @@ class NTVRuIE(InfoExtractor): 'url': file_, 'filesize': int_or_none(xpath_text(video, './%ssize' % format_id)), }) - self._sort_formats(formats) return { 'id': xpath_text(video, './id'), diff --git a/yt_dlp/extractor/nuvid.py b/yt_dlp/extractor/nuvid.py index fafcc8f4b..6ac351cb0 100644 --- a/yt_dlp/extractor/nuvid.py +++ b/yt_dlp/extractor/nuvid.py @@ -80,7 +80,6 @@ class NuvidIE(InfoExtractor): } for quality, source in video_data.get('files').items() if source] self._check_formats(formats, video_id) - self._sort_formats(formats) duration = parse_duration(traverse_obj(video_data, 'duration', 'duration_format')) thumbnails = [ diff --git a/yt_dlp/extractor/nytimes.py b/yt_dlp/extractor/nytimes.py index fe6986a82..2e21edbb4 100644 --- a/yt_dlp/extractor/nytimes.py +++ b/yt_dlp/extractor/nytimes.py @@ -72,7 +72,6 @@ class NYTimesBaseIE(InfoExtractor): 'tbr': int_or_none(video.get('bitrate'), 1000) or None, 'ext': ext, }) - self._sort_formats(formats) thumbnails = [] for image in video_data.get('images', []): diff --git a/yt_dlp/extractor/odnoklassniki.py b/yt_dlp/extractor/odnoklassniki.py index 195563bbb..4f325f087 100644 --- a/yt_dlp/extractor/odnoklassniki.py +++ b/yt_dlp/extractor/odnoklassniki.py @@ -370,8 +370,6 @@ class OdnoklassnikiIE(InfoExtractor): if payment_info: self.raise_no_formats('This video is paid, subscribe to download it', expected=True) - self._sort_formats(formats) - info['formats'] = formats return info diff --git a/yt_dlp/extractor/olympics.py b/yt_dlp/extractor/olympics.py index 42ea94905..61d1f4048 100644 --- a/yt_dlp/extractor/olympics.py +++ b/yt_dlp/extractor/olympics.py @@ -54,7 +54,6 @@ class OlympicsReplayIE(InfoExtractor): m3u8_url = self._download_json( f'https://olympics.com/tokenGenerator?url={m3u8_url}', uuid, note='Downloading m3u8 url') formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, uuid, 'mp4', m3u8_id='hls') - self._sort_formats(formats) return { 'id': uuid, diff --git a/yt_dlp/extractor/on24.py b/yt_dlp/extractor/on24.py index 779becc70..9a4abc98d 100644 --- a/yt_dlp/extractor/on24.py +++ b/yt_dlp/extractor/on24.py @@ -76,7 +76,6 @@ class On24IE(InfoExtractor): 'vcodec': 'none', 'acodec': 'wav' }) - self._sort_formats(formats) return { 'id': event_id, diff --git a/yt_dlp/extractor/onefootball.py b/yt_dlp/extractor/onefootball.py index 41815bef1..591d15732 100644 --- a/yt_dlp/extractor/onefootball.py +++ b/yt_dlp/extractor/onefootball.py @@ -36,7 +36,6 @@ class OneFootballIE(InfoExtractor): data_json = self._search_json_ld(webpage, id) m3u8_url = self._html_search_regex(r'(https://cdn\.jwplayer\.com/manifests/.+\.m3u8)', webpage, 'm3u8_url') formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, id) - self._sort_formats(formats) return { 'id': id, 'title': data_json.get('title'), diff --git a/yt_dlp/extractor/onet.py b/yt_dlp/extractor/onet.py index ea46d7def..0d59e8cb4 100644 --- a/yt_dlp/extractor/onet.py +++ b/yt_dlp/extractor/onet.py @@ -80,7 +80,6 @@ class OnetBaseIE(InfoExtractor): 'vbr': float_or_none(f.get('video_bitrate')), }) formats.append(http_f) - self._sort_formats(formats) meta = video.get('meta', {}) diff --git a/yt_dlp/extractor/ooyala.py b/yt_dlp/extractor/ooyala.py index 146c1f981..65afccdb1 100644 --- a/yt_dlp/extractor/ooyala.py +++ b/yt_dlp/extractor/ooyala.py @@ -85,7 +85,6 @@ class OoyalaBaseIE(InfoExtractor): if not formats and not auth_data.get('authorized'): self.raise_no_formats('%s said: %s' % ( self.IE_NAME, auth_data['message']), expected=True) - self._sort_formats(formats) subtitles = {} for lang, sub in metadata.get('closed_captions_vtt', {}).get('captions', {}).items(): diff --git a/yt_dlp/extractor/opencast.py b/yt_dlp/extractor/opencast.py index c640224dd..fa46757f7 100644 --- a/yt_dlp/extractor/opencast.py +++ b/yt_dlp/extractor/opencast.py @@ -92,8 +92,6 @@ class OpencastBaseIE(InfoExtractor): }) formats.append(track_obj) - self._sort_formats(formats) - return { 'id': video_id, 'formats': formats, diff --git a/yt_dlp/extractor/openrec.py b/yt_dlp/extractor/openrec.py index 6c1eb8f3a..86dc9bb89 100644 --- a/yt_dlp/extractor/openrec.py +++ b/yt_dlp/extractor/openrec.py @@ -50,8 +50,6 @@ class OpenRecBaseIE(InfoExtractor): formats = list(self._expand_media(video_id, new_media)) is_live = False - self._sort_formats(formats) - return { 'id': video_id, 'title': get_first(movie_stores, 'title'), @@ -113,7 +111,6 @@ class OpenRecCaptureIE(OpenRecBaseIE): formats = self._extract_m3u8_formats( capture_data.get('source'), video_id, ext='mp4') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/ora.py b/yt_dlp/extractor/ora.py index 09b121422..d49909d52 100644 --- a/yt_dlp/extractor/ora.py +++ b/yt_dlp/extractor/ora.py @@ -54,7 +54,6 @@ class OraTVIE(InfoExtractor): 'format_id': q, 'quality': preference(q), }) - self._sort_formats(formats) else: return self.url_result(self._search_regex( r'"youtube_id"\s*:\s*"([^"]+)', webpage, 'youtube id'), 'Youtube') diff --git a/yt_dlp/extractor/orf.py b/yt_dlp/extractor/orf.py index 24abf7f26..e9d23a4d1 100644 --- a/yt_dlp/extractor/orf.py +++ b/yt_dlp/extractor/orf.py @@ -134,8 +134,6 @@ class ORFTVthekIE(InfoExtractor): HEADRequest(http_url), video_id, fatal=False, note='Testing for geoblocking', errnote=f'This video seems to be blocked outside of {geo_str}. You may want to try the streaming-* formats') - self._sort_formats(formats) - subtitles = {} for sub in sd.get('subtitles', []): sub_src = sub.get('src') @@ -407,7 +405,6 @@ class ORFIPTVIE(InfoExtractor): format_url, video_id, 'mp4', m3u8_id=format_id)) else: continue - self._sort_formats(formats) title = remove_end(self._og_search_title(webpage), ' - iptv.ORF.at') description = self._og_search_description(webpage) @@ -507,7 +504,6 @@ class ORFFM4StoryIE(InfoExtractor): format_url, video_id, 'mp4', m3u8_id=format_id)) else: continue - self._sort_formats(formats) title = remove_end(self._og_search_title(webpage), ' - fm4.ORF.at') if idx >= 1: diff --git a/yt_dlp/extractor/pandoratv.py b/yt_dlp/extractor/pandoratv.py index 3747f31d2..ccc78da57 100644 --- a/yt_dlp/extractor/pandoratv.py +++ b/yt_dlp/extractor/pandoratv.py @@ -112,7 +112,6 @@ class PandoraTVIE(InfoExtractor): 'url': format_url, 'height': int(height), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/panopto.py b/yt_dlp/extractor/panopto.py index 5f5edb26b..32c103bc1 100644 --- a/yt_dlp/extractor/panopto.py +++ b/yt_dlp/extractor/panopto.py @@ -407,7 +407,6 @@ class PanoptoIE(PanoptoBaseIE): subtitles = self._merge_subtitles( podcast_subtitles, streams_subtitles, self.extract_subtitles(base_url, video_id, delivery)) - self._sort_formats(formats) self.mark_watched(base_url, video_id, delivery_info) return { diff --git a/yt_dlp/extractor/parlview.py b/yt_dlp/extractor/parlview.py index f31ae576c..0b547917c 100644 --- a/yt_dlp/extractor/parlview.py +++ b/yt_dlp/extractor/parlview.py @@ -44,7 +44,6 @@ class ParlviewIE(InfoExtractor): elif stream.get('streamType') != 'VOD': self.raise_no_formats('Unknown type of stream was detected: "%s"' % str(stream.get('streamType'))) formats = self._extract_m3u8_formats(stream['url'], video_id, 'mp4', 'm3u8_native') - self._sort_formats(formats) media_info = self._download_webpage( self._MEDIA_INFO_URL % video_id, video_id, note='Downloading media info', fatal=False) diff --git a/yt_dlp/extractor/patreon.py b/yt_dlp/extractor/patreon.py index 43c90c8f1..529aba178 100644 --- a/yt_dlp/extractor/patreon.py +++ b/yt_dlp/extractor/patreon.py @@ -277,7 +277,6 @@ class PatreonIE(PatreonBaseIE): } elif name == 'video': formats, subtitles = self._extract_m3u8_formats_and_subtitles(post_file['url'], video_id) - self._sort_formats(formats) return { **info, 'formats': formats, diff --git a/yt_dlp/extractor/pbs.py b/yt_dlp/extractor/pbs.py index 4e6674e85..5bdf561db 100644 --- a/yt_dlp/extractor/pbs.py +++ b/yt_dlp/extractor/pbs.py @@ -660,7 +660,6 @@ class PBSIE(InfoExtractor): for f in formats: if (f.get('format_note') or '').endswith(' AD'): # Audio description f['language_preference'] = -10 - self._sort_formats(formats) rating_str = info.get('rating') if rating_str is not None: diff --git a/yt_dlp/extractor/pearvideo.py b/yt_dlp/extractor/pearvideo.py index e76305acd..e27e5a7ba 100644 --- a/yt_dlp/extractor/pearvideo.py +++ b/yt_dlp/extractor/pearvideo.py @@ -45,7 +45,6 @@ class PearVideoIE(InfoExtractor): 'format_id': k, 'url': v.replace(info['systemTime'], f'cont-{video_id}') if k == 'srcUrl' else v } for k, v in traverse_obj(info, ('videoInfo', 'videos'), default={}).items() if v] - self._sort_formats(formats) title = self._search_regex( (r'<h1[^>]+\bclass=(["\'])video-tt\1[^>]*>(?P<value>[^<]+)', diff --git a/yt_dlp/extractor/peekvids.py b/yt_dlp/extractor/peekvids.py index fd25b5adb..2d9b9a742 100644 --- a/yt_dlp/extractor/peekvids.py +++ b/yt_dlp/extractor/peekvids.py @@ -40,7 +40,6 @@ class PeekVidsIE(InfoExtractor): } for name, url in srcs.items() if len(name) > 8 and name.startswith('data-src')] if not formats: formats = [{'url': url} for url in srcs.values()] - self._sort_formats(formats) info = self._search_json_ld(webpage, video_id, expected_type='VideoObject') info.update({ diff --git a/yt_dlp/extractor/peertube.py b/yt_dlp/extractor/peertube.py index 6d280e41c..68e15737b 100644 --- a/yt_dlp/extractor/peertube.py +++ b/yt_dlp/extractor/peertube.py @@ -1233,7 +1233,6 @@ class PeerTubeIE(InfoExtractor): else: f['fps'] = int_or_none(file_.get('fps')) formats.append(f) - self._sort_formats(formats) description = video.get('description') if description and len(description) >= 250: diff --git a/yt_dlp/extractor/peertv.py b/yt_dlp/extractor/peertv.py index 821abe496..a709e21b4 100644 --- a/yt_dlp/extractor/peertv.py +++ b/yt_dlp/extractor/peertv.py @@ -43,8 +43,6 @@ class PeerTVIE(InfoExtractor): formats = self._extract_m3u8_formats(m3u8_url, video_id, m3u8_id='hls') - self._sort_formats(formats) - return { 'id': video_id, 'title': self._html_search_regex(r'<h1>(.+?)</h1>', webpage, 'title').replace('\xa0', ' '), diff --git a/yt_dlp/extractor/peloton.py b/yt_dlp/extractor/peloton.py index 3fc05d1f2..4835822cf 100644 --- a/yt_dlp/extractor/peloton.py +++ b/yt_dlp/extractor/peloton.py @@ -157,7 +157,6 @@ class PelotonIE(InfoExtractor): 'title': segment.get('name') } for segment in traverse_obj(metadata, ('segments', 'segment_list'))] - self._sort_formats(formats) return { 'id': video_id, 'title': ride_data.get('title'), diff --git a/yt_dlp/extractor/performgroup.py b/yt_dlp/extractor/performgroup.py index 824495f40..f4d7f22d0 100644 --- a/yt_dlp/extractor/performgroup.py +++ b/yt_dlp/extractor/performgroup.py @@ -65,7 +65,6 @@ class PerformGroupIE(InfoExtractor): 'vbr': int_or_none(c.get('videoRate'), 1000), 'abr': int_or_none(c.get('audioRate'), 1000), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/periscope.py b/yt_dlp/extractor/periscope.py index 2ff6589d5..84bcf1573 100644 --- a/yt_dlp/extractor/periscope.py +++ b/yt_dlp/extractor/periscope.py @@ -127,7 +127,6 @@ class PeriscopeIE(PeriscopeBaseIE): } self._add_width_and_height(rtmp_format) formats.append(rtmp_format) - self._sort_formats(formats) info['formats'] = formats return info diff --git a/yt_dlp/extractor/philharmoniedeparis.py b/yt_dlp/extractor/philharmoniedeparis.py index 5ea2b6393..e8494a084 100644 --- a/yt_dlp/extractor/philharmoniedeparis.py +++ b/yt_dlp/extractor/philharmoniedeparis.py @@ -75,7 +75,6 @@ class PhilharmonieDeParisIE(InfoExtractor): m3u8_id='hls', fatal=False)) if not formats and not self.get_param('ignore_no_formats'): return - self._sort_formats(formats) return { 'title': title, 'formats': formats, diff --git a/yt_dlp/extractor/picarto.py b/yt_dlp/extractor/picarto.py index 54999a832..36a062def 100644 --- a/yt_dlp/extractor/picarto.py +++ b/yt_dlp/extractor/picarto.py @@ -64,7 +64,6 @@ class PicartoIE(InfoExtractor): formats.append({ 'url': source_url, }) - self._sort_formats(formats) mature = metadata.get('adult') if mature is None: @@ -114,7 +113,6 @@ class PicartoVodIE(InfoExtractor): formats = self._extract_m3u8_formats( vod_info['vod'], video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/piksel.py b/yt_dlp/extractor/piksel.py index fba7242f5..cc60b304e 100644 --- a/yt_dlp/extractor/piksel.py +++ b/yt_dlp/extractor/piksel.py @@ -153,8 +153,6 @@ class PikselIE(InfoExtractor): re.sub(r'/od/[^/]+/', '/od/http/', smil_url), video_id, transform_source=transform_source, fatal=False)) - self._sort_formats(formats, ('tbr', )) # Incomplete resolution information - subtitles = {} for caption in video_data.get('captions', []): caption_url = caption.get('url') @@ -170,4 +168,5 @@ class PikselIE(InfoExtractor): 'timestamp': parse_iso8601(video_data.get('dateadd')), 'formats': formats, 'subtitles': subtitles, + '_format_sort_fields': ('tbr', ), # Incomplete resolution information } diff --git a/yt_dlp/extractor/pinkbike.py b/yt_dlp/extractor/pinkbike.py index 313b5cce0..e4e1caaa2 100644 --- a/yt_dlp/extractor/pinkbike.py +++ b/yt_dlp/extractor/pinkbike.py @@ -49,7 +49,6 @@ class PinkbikeIE(InfoExtractor): 'format_id': format_id, 'height': height, }) - self._sort_formats(formats) title = remove_end(self._og_search_title(webpage), ' Video - Pinkbike') description = self._html_search_regex( diff --git a/yt_dlp/extractor/pinterest.py b/yt_dlp/extractor/pinterest.py index 171f9e4eb..2c6cd6d4b 100644 --- a/yt_dlp/extractor/pinterest.py +++ b/yt_dlp/extractor/pinterest.py @@ -52,7 +52,6 @@ class PinterestBaseIE(InfoExtractor): 'height': int_or_none(format_dict.get('height')), 'duration': duration, }) - self._sort_formats(formats) description = data.get('description') or data.get('description_html') or data.get('seo_description') timestamp = unified_timestamp(data.get('created_at')) diff --git a/yt_dlp/extractor/pixivsketch.py b/yt_dlp/extractor/pixivsketch.py index bfdb8b24e..850c6f23d 100644 --- a/yt_dlp/extractor/pixivsketch.py +++ b/yt_dlp/extractor/pixivsketch.py @@ -71,7 +71,6 @@ class PixivSketchIE(PixivSketchBaseIE): formats = self._extract_m3u8_formats( m3u8_url, video_id, ext='mp4', entry_protocol='m3u8_native', m3u8_id='hls') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/pladform.py b/yt_dlp/extractor/pladform.py index 8be08a5bc..dcf18e1f3 100644 --- a/yt_dlp/extractor/pladform.py +++ b/yt_dlp/extractor/pladform.py @@ -111,8 +111,6 @@ class PladformIE(InfoExtractor): if error: fail(error) - self._sort_formats(formats) - webpage = self._download_webpage( 'http://video.pladform.ru/catalog/video/videoid/%s' % video_id, video_id) diff --git a/yt_dlp/extractor/planetmarathi.py b/yt_dlp/extractor/planetmarathi.py index 03b9d6aaa..25753fe7e 100644 --- a/yt_dlp/extractor/planetmarathi.py +++ b/yt_dlp/extractor/planetmarathi.py @@ -57,7 +57,6 @@ class PlanetMarathiIE(InfoExtractor): asset_title = id.replace('-', ' ') asset_id = f'{asset["sk"]}_{id}'.replace('#', '-') formats, subtitles = self._extract_m3u8_formats_and_subtitles(asset['mediaAssetURL'], asset_id) - self._sort_formats(formats) entries.append({ 'id': asset_id, 'title': asset_title, diff --git a/yt_dlp/extractor/platzi.py b/yt_dlp/extractor/platzi.py index 29d3210ac..b8a441494 100644 --- a/yt_dlp/extractor/platzi.py +++ b/yt_dlp/extractor/platzi.py @@ -127,7 +127,6 @@ class PlatziIE(PlatziBaseIE): format_url, lecture_id, mpd_id=format_id, note='Downloading %s MPD manifest' % server_id, fatal=False)) - self._sort_formats(formats) content = str_or_none(desc.get('content')) description = (clean_html(compat_b64decode(content).decode('utf-8')) diff --git a/yt_dlp/extractor/playplustv.py b/yt_dlp/extractor/playplustv.py index 05dbaf066..316f220f7 100644 --- a/yt_dlp/extractor/playplustv.py +++ b/yt_dlp/extractor/playplustv.py @@ -79,7 +79,6 @@ class PlayPlusTVIE(InfoExtractor): 'width': int_or_none(file_info.get('width')), 'height': int_or_none(file_info.get('height')), }) - self._sort_formats(formats) thumbnails = [] for thumb in media.get('thumbs', []): diff --git a/yt_dlp/extractor/plays.py b/yt_dlp/extractor/plays.py index 700dfe407..9371f7b23 100644 --- a/yt_dlp/extractor/plays.py +++ b/yt_dlp/extractor/plays.py @@ -38,7 +38,6 @@ class PlaysTVIE(InfoExtractor): 'format_id': 'http-' + format_id, 'height': int_or_none(height), }) - self._sort_formats(formats) info.update({ 'id': video_id, diff --git a/yt_dlp/extractor/playtvak.py b/yt_dlp/extractor/playtvak.py index f7e5ddbe7..c418f88cb 100644 --- a/yt_dlp/extractor/playtvak.py +++ b/yt_dlp/extractor/playtvak.py @@ -160,7 +160,6 @@ class PlaytvakIE(InfoExtractor): 'quality': quality(fmt.get('quality')), 'preference': preference, }) - self._sort_formats(formats) title = item['title'] is_live = item['type'] == 'stream' diff --git a/yt_dlp/extractor/playvid.py b/yt_dlp/extractor/playvid.py index 18aeda7de..1e0989d0a 100644 --- a/yt_dlp/extractor/playvid.py +++ b/yt_dlp/extractor/playvid.py @@ -74,7 +74,6 @@ class PlayvidIE(InfoExtractor): 'height': height, 'url': val, }) - self._sort_formats(formats) # Extract title - should be in the flashvars; if not, look elsewhere if video_title is None: diff --git a/yt_dlp/extractor/playwire.py b/yt_dlp/extractor/playwire.py index 683dbf4a5..1057bff3a 100644 --- a/yt_dlp/extractor/playwire.py +++ b/yt_dlp/extractor/playwire.py @@ -62,7 +62,6 @@ class PlaywireIE(InfoExtractor): for a_format in formats: if not dict_get(a_format, ['tbr', 'width', 'height']): a_format['quality'] = 1 if '-hd.' in a_format['url'] else 0 - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/pluralsight.py b/yt_dlp/extractor/pluralsight.py index b50152ad8..809b65608 100644 --- a/yt_dlp/extractor/pluralsight.py +++ b/yt_dlp/extractor/pluralsight.py @@ -410,8 +410,6 @@ query viewClip { }) formats.append(clip_f) - self._sort_formats(formats) - duration = int_or_none( clip.get('duration')) or parse_duration(clip.get('formattedDuration')) diff --git a/yt_dlp/extractor/plutotv.py b/yt_dlp/extractor/plutotv.py index 6e8f46fa3..71a05cc7a 100644 --- a/yt_dlp/extractor/plutotv.py +++ b/yt_dlp/extractor/plutotv.py @@ -135,7 +135,6 @@ class PlutoTVIE(InfoExtractor): subtitles = self._merge_subtitles(subtitles, subs) formats, subtitles = self._to_ad_free_formats(video_id, formats, subtitles) - self._sort_formats(formats) info = { 'id': video_id, diff --git a/yt_dlp/extractor/polsatgo.py b/yt_dlp/extractor/polsatgo.py index e44d951e6..1524a1fb9 100644 --- a/yt_dlp/extractor/polsatgo.py +++ b/yt_dlp/extractor/polsatgo.py @@ -42,7 +42,6 @@ class PolsatGoIE(InfoExtractor): formats = list(self._extract_formats( try_get(media, lambda x: x['playback']['mediaSources']), video_id)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/polskieradio.py b/yt_dlp/extractor/polskieradio.py index 514753b64..99244f6b4 100644 --- a/yt_dlp/extractor/polskieradio.py +++ b/yt_dlp/extractor/polskieradio.py @@ -295,8 +295,6 @@ class PolskieRadioPlayerIE(InfoExtractor): 'url': stream_url, }) - self._sort_formats(formats) - return { 'id': compat_str(channel['id']), 'formats': formats, diff --git a/yt_dlp/extractor/porncom.py b/yt_dlp/extractor/porncom.py index 2ebd3fa09..c8ef240d7 100644 --- a/yt_dlp/extractor/porncom.py +++ b/yt_dlp/extractor/porncom.py @@ -73,8 +73,6 @@ class PornComIE(InfoExtractor): thumbnail = None duration = None - self._sort_formats(formats) - view_count = str_to_int(self._search_regex( (r'Views:\s*</span>\s*<span>\s*([\d,.]+)', r'class=["\']views["\'][^>]*><p>([\d,.]+)'), webpage, diff --git a/yt_dlp/extractor/pornflip.py b/yt_dlp/extractor/pornflip.py index 26536bc65..51a9cf38f 100644 --- a/yt_dlp/extractor/pornflip.py +++ b/yt_dlp/extractor/pornflip.py @@ -60,7 +60,6 @@ class PornFlipIE(InfoExtractor): r'class="btn btn-down-rating[^>]*>[^<]*<i[^>]*>[^<]*</i>[^>]*<span[^>]*>[^0-9]*([0-9]+)[^<0-9]*<', webpage, 'dislike_count', fatal=False) mpd_url = self._search_regex(r'"([^"]+userscontent.net/dash/[0-9]+/manifest.mpd[^"]*)"', webpage, 'mpd_url').replace('&', '&') formats = self._extract_mpd_formats(mpd_url, video_id, mpd_id='dash') - self._sort_formats(formats) return { 'age_limit': 18, diff --git a/yt_dlp/extractor/pornhd.py b/yt_dlp/extractor/pornhd.py index 06a44ddd1..c8a1ec80b 100644 --- a/yt_dlp/extractor/pornhd.py +++ b/yt_dlp/extractor/pornhd.py @@ -84,7 +84,6 @@ class PornHdIE(InfoExtractor): }) if formats: info['formats'] = formats - self._sort_formats(info['formats']) description = self._html_search_regex( (r'(?s)<section[^>]+class=["\']video-description[^>]+>(?P<value>.+?)</section>', diff --git a/yt_dlp/extractor/pornhub.py b/yt_dlp/extractor/pornhub.py index 6afaf5e6e..5d8d7c100 100644 --- a/yt_dlp/extractor/pornhub.py +++ b/yt_dlp/extractor/pornhub.py @@ -456,10 +456,6 @@ class PornHubIE(PornHubBaseIE): continue add_format(video_url) - # field_preference is unnecessary here, but kept for code-similarity with youtube-dl - self._sort_formats( - formats, field_preference=('height', 'width', 'fps', 'format_id')) - model_profile = self._search_json( r'var\s+MODEL_PROFILE\s*=', webpage, 'model profile', video_id, fatal=False) video_uploader = self._html_search_regex( diff --git a/yt_dlp/extractor/pornovoisines.py b/yt_dlp/extractor/pornovoisines.py index 96d2da7c7..aa48da06b 100644 --- a/yt_dlp/extractor/pornovoisines.py +++ b/yt_dlp/extractor/pornovoisines.py @@ -55,7 +55,6 @@ class PornoVoisinesIE(InfoExtractor): 'height': item.get('height'), 'bitrate': item.get('bitrate'), }) - self._sort_formats(formats) webpage = self._download_webpage(url, video_id) diff --git a/yt_dlp/extractor/projectveritas.py b/yt_dlp/extractor/projectveritas.py index e4aa4bd35..0e029ce8c 100644 --- a/yt_dlp/extractor/projectveritas.py +++ b/yt_dlp/extractor/projectveritas.py @@ -42,7 +42,6 @@ class ProjectVeritasIE(InfoExtractor): raise ExtractorError('No video on the provided url.', expected=True) playback_id = traverse_obj(mux_asset, 'playbackId', ('en-US', 'playbackId')) formats = self._extract_m3u8_formats(f'https://stream.mux.com/{playback_id}.m3u8', video_id) - self._sort_formats(formats) return { 'id': video_id, 'title': main_data['title'], diff --git a/yt_dlp/extractor/prosiebensat1.py b/yt_dlp/extractor/prosiebensat1.py index cb5ada1b9..46e2e8a8f 100644 --- a/yt_dlp/extractor/prosiebensat1.py +++ b/yt_dlp/extractor/prosiebensat1.py @@ -156,7 +156,6 @@ class ProSiebenSat1BaseIE(InfoExtractor): 'tbr': tbr, 'format_id': 'http%s' % ('-%d' % tbr if tbr else ''), }) - self._sort_formats(formats) return { 'duration': float_or_none(video.get('duration')), diff --git a/yt_dlp/extractor/puhutv.py b/yt_dlp/extractor/puhutv.py index a5dac1dff..482e5705f 100644 --- a/yt_dlp/extractor/puhutv.py +++ b/yt_dlp/extractor/puhutv.py @@ -111,7 +111,6 @@ class PuhuTVIE(InfoExtractor): format_id += '-%sp' % quality f['format_id'] = format_id formats.append(f) - self._sort_formats(formats) creator = try_get( show, lambda x: x['producer']['name'], compat_str) diff --git a/yt_dlp/extractor/qqmusic.py b/yt_dlp/extractor/qqmusic.py index fa2454df4..92858259a 100644 --- a/yt_dlp/extractor/qqmusic.py +++ b/yt_dlp/extractor/qqmusic.py @@ -122,7 +122,6 @@ class QQMusicIE(InfoExtractor): 'abr': details.get('abr'), }) self._check_formats(formats, mid) - self._sort_formats(formats) actual_lrc_lyrics = ''.join( line + '\n' for line in re.findall( diff --git a/yt_dlp/extractor/r7.py b/yt_dlp/extractor/r7.py index b459efceb..f067a0571 100644 --- a/yt_dlp/extractor/r7.py +++ b/yt_dlp/extractor/r7.py @@ -66,7 +66,6 @@ class R7IE(InfoExtractor): f_copy['protocol'] = 'http' f = f_copy formats.append(f) - self._sort_formats(formats) description = video.get('description') thumbnail = video.get('thumb') diff --git a/yt_dlp/extractor/radiko.py b/yt_dlp/extractor/radiko.py index 498cc6be9..f10292203 100644 --- a/yt_dlp/extractor/radiko.py +++ b/yt_dlp/extractor/radiko.py @@ -125,7 +125,6 @@ class RadikoBaseIE(InfoExtractor): sf['downloader_options'] = {'ffmpeg_args': ['-ss', time_to_skip]} formats.extend(subformats) - self._sort_formats(formats) return formats diff --git a/yt_dlp/extractor/radiocanada.py b/yt_dlp/extractor/radiocanada.py index dd6f899a4..72c21d502 100644 --- a/yt_dlp/extractor/radiocanada.py +++ b/yt_dlp/extractor/radiocanada.py @@ -113,7 +113,6 @@ class RadioCanadaIE(InfoExtractor): raise ExtractorError( '%s said: %s' % (self.IE_NAME, error), expected=True) formats = self._extract_m3u8_formats(v_url, video_id, 'mp4') - self._sort_formats(formats) subtitles = {} closed_caption_url = get_meta('closedCaption') or get_meta('closedCaptionHTML5') diff --git a/yt_dlp/extractor/radiode.py b/yt_dlp/extractor/radiode.py index befb0b72b..32c36d557 100644 --- a/yt_dlp/extractor/radiode.py +++ b/yt_dlp/extractor/radiode.py @@ -38,7 +38,6 @@ class RadioDeIE(InfoExtractor): 'abr': stream['bitRate'], 'asr': stream['sampleRate'] } for stream in broadcast['streamUrls']] - self._sort_formats(formats) return { 'id': radio_id, diff --git a/yt_dlp/extractor/radiofrance.py b/yt_dlp/extractor/radiofrance.py index 38420a15d..92e51b7f4 100644 --- a/yt_dlp/extractor/radiofrance.py +++ b/yt_dlp/extractor/radiofrance.py @@ -46,7 +46,6 @@ class RadioFranceIE(InfoExtractor): for i, fm in enumerate(re.findall(r"([a-z0-9]+)\s*:\s*'([^']+)'", formats_str)) ] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/radiojavan.py b/yt_dlp/extractor/radiojavan.py index 6a6118899..6a9139466 100644 --- a/yt_dlp/extractor/radiojavan.py +++ b/yt_dlp/extractor/radiojavan.py @@ -50,7 +50,6 @@ class RadioJavanIE(InfoExtractor): 'format_id': format_id, }) formats.append(f) - self._sort_formats(formats) title = self._og_search_title(webpage) thumbnail = self._og_search_thumbnail(webpage) diff --git a/yt_dlp/extractor/radlive.py b/yt_dlp/extractor/radlive.py index ed38a07f0..9bcbb11d5 100644 --- a/yt_dlp/extractor/radlive.py +++ b/yt_dlp/extractor/radlive.py @@ -62,7 +62,6 @@ class RadLiveIE(InfoExtractor): raise ExtractorError('Unable to extract video info, make sure the URL is valid') formats = self._extract_m3u8_formats(video_info['assets']['videos'][0]['url'], video_id) - self._sort_formats(formats) data = video_info.get('structured_data', {}) diff --git a/yt_dlp/extractor/rai.py b/yt_dlp/extractor/rai.py index cd19ec07b..cab12cc21 100644 --- a/yt_dlp/extractor/rai.py +++ b/yt_dlp/extractor/rai.py @@ -313,7 +313,6 @@ class RaiPlayIE(RaiBaseIE): video = media['video'] relinker_info = self._extract_relinker_info(video['content_url'], video_id) - self._sort_formats(relinker_info['formats']) thumbnails = [] for _, value in media.get('images', {}).items(): @@ -621,8 +620,6 @@ class RaiIE(RaiBaseIE): else: raise ExtractorError('not a media file') - self._sort_formats(relinker_info['formats']) - thumbnails = [] for image_type in ('image', 'image_medium', 'image_300'): thumbnail_url = media.get(image_type) @@ -703,7 +700,6 @@ class RaiIE(RaiBaseIE): relinker_info = self._extract_relinker_info( urljoin(url, relinker_url), video_id) - self._sort_formats(relinker_info['formats']) title = self._search_regex( r'var\s+videoTitolo\s*=\s*([\'"])(?P<title>[^\'"]+)\1', @@ -772,8 +768,6 @@ class RaiNewsIE(RaiIE): # XXX: Do not subclass from concrete IE relinker_info = self._extract_relinker_info(urljoin(url, relinker_url), video_id) - self._sort_formats(relinker_info['formats']) - return { 'id': video_id, 'title': track_info.get('title') or self._og_search_title(webpage), diff --git a/yt_dlp/extractor/rcs.py b/yt_dlp/extractor/rcs.py index d69a1a216..b905f8d2e 100644 --- a/yt_dlp/extractor/rcs.py +++ b/yt_dlp/extractor/rcs.py @@ -196,7 +196,6 @@ class RCSBaseIE(InfoExtractor): 'format_id': 'http-mp4', 'url': urls['mp4'] }) - self._sort_formats(formats) return formats def _real_extract(self, url): diff --git a/yt_dlp/extractor/rcti.py b/yt_dlp/extractor/rcti.py index 0cfecbc9a..27b4ad7bb 100644 --- a/yt_dlp/extractor/rcti.py +++ b/yt_dlp/extractor/rcti.py @@ -194,8 +194,6 @@ class RCTIPlusIE(RCTIPlusBaseIE): if 'akamaized' in f['url'] or 'cloudfront' in f['url']: f.setdefault('http_headers', {})['Referer'] = 'https://www.rctiplus.com/' # Referer header is required for akamai/cloudfront CDNs - self._sort_formats(formats) - return { 'id': video_meta.get('product_id') or video_json.get('product_id'), 'title': dict_get(video_meta, ('title', 'name')) or dict_get(video_json, ('content_name', 'assets_name')), diff --git a/yt_dlp/extractor/redbee.py b/yt_dlp/extractor/redbee.py index ee510eb40..b59b518b1 100644 --- a/yt_dlp/extractor/redbee.py +++ b/yt_dlp/extractor/redbee.py @@ -117,13 +117,10 @@ class ParliamentLiveUKIE(RedBeeBaseIE): video_id = self._match_id(url) formats, subtitles = self._get_formats_and_subtitles(video_id) - self._sort_formats(formats) video_info = self._download_json( f'https://www.parliamentlive.tv/Event/GetShareVideo/{video_id}', video_id, fatal=False) - self._sort_formats(formats, ['res', 'proto']) - return { 'id': video_id, 'formats': formats, @@ -132,6 +129,7 @@ class ParliamentLiveUKIE(RedBeeBaseIE): 'thumbnail': traverse_obj(video_info, 'thumbnailUrl'), 'timestamp': traverse_obj( video_info, ('event', 'publishedStartTime'), expected_type=unified_timestamp), + '_format_sort_fields': ('res', 'proto'), } @@ -366,7 +364,6 @@ class RTBFIE(RedBeeBaseIE): formats.extend(fmts) self._merge_subtitles(subs, target=subtitles) - self._sort_formats(formats, ['res', 'proto']) return { 'id': media_id, 'formats': formats, @@ -378,4 +375,5 @@ class RTBFIE(RedBeeBaseIE): 'series': data.get('programLabel'), 'subtitles': subtitles, 'is_live': is_live, + '_format_sort_fields': ('res', 'proto'), } diff --git a/yt_dlp/extractor/redbulltv.py b/yt_dlp/extractor/redbulltv.py index 50e61ba6e..a01bc8434 100644 --- a/yt_dlp/extractor/redbulltv.py +++ b/yt_dlp/extractor/redbulltv.py @@ -80,7 +80,6 @@ class RedBullTVIE(InfoExtractor): formats, subtitles = self._extract_m3u8_formats_and_subtitles( 'https://dms.redbull.tv/v3/%s/%s/playlist.m3u8' % (video_id, token), video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') - self._sort_formats(formats) for resource in video.get('resources', []): if resource.startswith('closed_caption_'): diff --git a/yt_dlp/extractor/reddit.py b/yt_dlp/extractor/reddit.py index c713b24fe..cfd79abfd 100644 --- a/yt_dlp/extractor/reddit.py +++ b/yt_dlp/extractor/reddit.py @@ -179,7 +179,6 @@ class RedditIE(InfoExtractor): hls_playlist_url, display_id, 'mp4', m3u8_id='hls', fatal=False)) formats.extend(self._extract_mpd_formats( dash_playlist_url, display_id, mpd_id='dash', fatal=False)) - self._sort_formats(formats) return { **info, diff --git a/yt_dlp/extractor/redgifs.py b/yt_dlp/extractor/redgifs.py index 92d996ca6..f688d1e63 100644 --- a/yt_dlp/extractor/redgifs.py +++ b/yt_dlp/extractor/redgifs.py @@ -45,7 +45,6 @@ class RedGifsBaseInfoExtractor(InfoExtractor): 'height': height, 'quality': quality(format_id), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/redtube.py b/yt_dlp/extractor/redtube.py index 8e767b6e4..49076ccd8 100644 --- a/yt_dlp/extractor/redtube.py +++ b/yt_dlp/extractor/redtube.py @@ -110,7 +110,6 @@ class RedTubeIE(InfoExtractor): video_url = self._html_search_regex( r'<source src="(.+?)" type="video/mp4">', webpage, 'video URL') formats.append({'url': video_url, 'ext': 'mp4'}) - self._sort_formats(formats) thumbnail = self._og_search_thumbnail(webpage) upload_date = unified_strdate(self._search_regex( diff --git a/yt_dlp/extractor/rentv.py b/yt_dlp/extractor/rentv.py index ab47ee552..fdde31704 100644 --- a/yt_dlp/extractor/rentv.py +++ b/yt_dlp/extractor/rentv.py @@ -47,7 +47,6 @@ class RENTVIE(InfoExtractor): formats.append({ 'url': src, }) - self._sort_formats(formats) return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/restudy.py b/yt_dlp/extractor/restudy.py index cd3c20d7a..6d032564d 100644 --- a/yt_dlp/extractor/restudy.py +++ b/yt_dlp/extractor/restudy.py @@ -31,7 +31,6 @@ class RestudyIE(InfoExtractor): formats = self._extract_smil_formats( 'https://cdn.portal.restudy.dk/dynamic/themes/front/awsmedia/SmilDirectory/video_%s.xml' % video_id, video_id) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/reuters.py b/yt_dlp/extractor/reuters.py index 1428b7cc9..6919425f3 100644 --- a/yt_dlp/extractor/reuters.py +++ b/yt_dlp/extractor/reuters.py @@ -55,7 +55,6 @@ class ReutersIE(InfoExtractor): 'ext': ext, 'container': container if method != 'mobile' else None, }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/rice.py b/yt_dlp/extractor/rice.py index 9ca47f3d4..3dd4d31de 100644 --- a/yt_dlp/extractor/rice.py +++ b/yt_dlp/extractor/rice.py @@ -88,7 +88,6 @@ class RICEIE(InfoExtractor): 'ext': 'flv', }) formats.append(fmt) - self._sort_formats(formats) thumbnails = [] for content_asset in content_data.findall('.//contentAssets'): diff --git a/yt_dlp/extractor/rockstargames.py b/yt_dlp/extractor/rockstargames.py index 5f1db0f05..c491aaf53 100644 --- a/yt_dlp/extractor/rockstargames.py +++ b/yt_dlp/extractor/rockstargames.py @@ -54,8 +54,6 @@ class RockstarGamesIE(InfoExtractor): if youtube_id: return self.url_result(youtube_id, 'Youtube') - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/rokfin.py b/yt_dlp/extractor/rokfin.py index fcef325bf..ade3cd0a4 100644 --- a/yt_dlp/extractor/rokfin.py +++ b/yt_dlp/extractor/rokfin.py @@ -112,7 +112,6 @@ class RokfinIE(InfoExtractor): self.raise_no_formats( f'Stream is offline; scheduled for {datetime.fromtimestamp(scheduled).strftime("%Y-%m-%d %H:%M:%S")}', video_id=video_id, expected=True) - self._sort_formats(formats) uploader = traverse_obj(metadata, ('createdBy', 'username'), ('creator', 'username')) timestamp = (scheduled or float_or_none(metadata.get('postedAtMilli'), 1000) diff --git a/yt_dlp/extractor/roosterteeth.py b/yt_dlp/extractor/roosterteeth.py index 011dadfaa..776fbfbc0 100644 --- a/yt_dlp/extractor/roosterteeth.py +++ b/yt_dlp/extractor/roosterteeth.py @@ -146,7 +146,6 @@ class RoosterTeethIE(RoosterTeethBaseIE): formats, subtitles = self._extract_m3u8_formats_and_subtitles( m3u8_url, display_id, 'mp4', 'm3u8_native', m3u8_id='hls') - self._sort_formats(formats) episode = self._download_json( api_episode_url, display_id, diff --git a/yt_dlp/extractor/rte.py b/yt_dlp/extractor/rte.py index 93faf1b32..aedaa5b55 100644 --- a/yt_dlp/extractor/rte.py +++ b/yt_dlp/extractor/rte.py @@ -94,8 +94,6 @@ class RteBaseIE(InfoExtractor): formats.extend(self._extract_f4m_formats( hds_url, item_id, f4m_id='hds', fatal=False)) - self._sort_formats(formats) - info_dict['formats'] = formats return info_dict diff --git a/yt_dlp/extractor/rtl2.py b/yt_dlp/extractor/rtl2.py index afa0d33cf..056cf87d2 100644 --- a/yt_dlp/extractor/rtl2.py +++ b/yt_dlp/extractor/rtl2.py @@ -94,8 +94,6 @@ class RTL2IE(InfoExtractor): if m3u8_url: formats.extend(self._extract_akamai_formats(m3u8_url, display_id)) - self._sort_formats(formats) - return { 'id': display_id, 'title': title, @@ -142,7 +140,6 @@ class RTL2YouIE(RTL2YouBaseIE): raise ExtractorError('video not found', expected=True) formats = self._extract_m3u8_formats(stream_url.decode(), video_id, 'mp4', 'm3u8_native') - self._sort_formats(formats) video_data = self._download_json( self._BACKWERK_BASE_URL + 'video/' + video_id, video_id) diff --git a/yt_dlp/extractor/rtlnl.py b/yt_dlp/extractor/rtlnl.py index 3852a3a13..724cb64e9 100644 --- a/yt_dlp/extractor/rtlnl.py +++ b/yt_dlp/extractor/rtlnl.py @@ -116,7 +116,6 @@ class RtlNlIE(InfoExtractor): formats = self._extract_m3u8_formats( m3u8_url, uuid, 'mp4', m3u8_id='hls', fatal=False) - self._sort_formats(formats) thumbnails = [] @@ -174,7 +173,6 @@ class RTLLuBaseIE(InfoExtractor): webpage = self._download_webpage(url, video_id) formats, subtitles = self.get_formats_and_subtitles(webpage, video_id) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/rts.py b/yt_dlp/extractor/rts.py index 6644538ed..81c4d7cac 100644 --- a/yt_dlp/extractor/rts.py +++ b/yt_dlp/extractor/rts.py @@ -212,7 +212,6 @@ class RTSIE(SRGSSRIE): # XXX: Do not subclass from concrete IE }) self._check_formats(formats, media_id) - self._sort_formats(formats) duration = info.get('duration') or info.get('cutout') or info.get('cutduration') if isinstance(duration, compat_str): diff --git a/yt_dlp/extractor/rtve.py b/yt_dlp/extractor/rtve.py index b9b181feb..a99a266c6 100644 --- a/yt_dlp/extractor/rtve.py +++ b/yt_dlp/extractor/rtve.py @@ -130,7 +130,6 @@ class RTVEALaCartaIE(InfoExtractor): 'quality': q(quality), 'url': video_url, }) - self._sort_formats(formats) return formats def _real_extract(self, url): @@ -238,7 +237,6 @@ class RTVEAudioIE(RTVEALaCartaIE): # XXX: Do not subclass from concrete IE 'quality': q(quality), 'url': audio_url, }) - self._sort_formats(formats) return formats def _real_extract(self, url): diff --git a/yt_dlp/extractor/rtvnh.py b/yt_dlp/extractor/rtvnh.py index 58af3dda2..7c6174494 100644 --- a/yt_dlp/extractor/rtvnh.py +++ b/yt_dlp/extractor/rtvnh.py @@ -49,7 +49,6 @@ class RTVNHIE(InfoExtractor): formats.extend(self._extract_f4m_formats( http_base_url + '/manifest.f4m', video_id, f4m_id='hds', fatal=False)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/rtvs.py b/yt_dlp/extractor/rtvs.py index fb06efa4b..a84a78da8 100644 --- a/yt_dlp/extractor/rtvs.py +++ b/yt_dlp/extractor/rtvs.py @@ -72,7 +72,6 @@ class RTVSIE(InfoExtractor): formats = [{'url': traverse_obj(data, ('playlist', 0, 'sources', 0, 'src'))}] else: formats = self._extract_m3u8_formats(traverse_obj(data, ('playlist', 0, 'sources', 0, 'src')), video_id) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/rtvslo.py b/yt_dlp/extractor/rtvslo.py index b63ccb96f..05942b6b4 100644 --- a/yt_dlp/extractor/rtvslo.py +++ b/yt_dlp/extractor/rtvslo.py @@ -133,7 +133,6 @@ class RTVSLOIE(InfoExtractor): if any('dummy_720p.mp4' in x.get('manifest_url', '') for x in formats) and meta.get('stub') == 'error': raise ExtractorError(f'{self.IE_NAME} said: Clip not available', expected=True) - self._sort_formats(formats) return { 'id': v_id, 'webpage_url': ''.join(traverse_obj(meta, ('canonical', ('domain', 'path')))), diff --git a/yt_dlp/extractor/rule34video.py b/yt_dlp/extractor/rule34video.py index bb113d822..9d15f4d21 100644 --- a/yt_dlp/extractor/rule34video.py +++ b/yt_dlp/extractor/rule34video.py @@ -51,8 +51,6 @@ class Rule34VideoIE(InfoExtractor): thumbnail = self._html_search_regex(r'preview_url:\s+\'([^\']+)\'', webpage, 'thumbnail', default=None) duration = self._html_search_regex(r'"icon-clock"></i>\s+<span>((?:\d+:?)+)', webpage, 'duration', default=None) - self._sort_formats(formats) - return { 'id': video_id, 'formats': formats, diff --git a/yt_dlp/extractor/rumble.py b/yt_dlp/extractor/rumble.py index 27040646b..102615c60 100644 --- a/yt_dlp/extractor/rumble.py +++ b/yt_dlp/extractor/rumble.py @@ -202,7 +202,6 @@ class RumbleEmbedIE(InfoExtractor): 'height': 'h', }, default={}) }) - self._sort_formats(formats) subtitles = { lang: [{ diff --git a/yt_dlp/extractor/rutube.py b/yt_dlp/extractor/rutube.py index cad3caa60..5a4fd975e 100644 --- a/yt_dlp/extractor/rutube.py +++ b/yt_dlp/extractor/rutube.py @@ -81,7 +81,6 @@ class RutubeBaseIE(InfoExtractor): 'url': format_url, 'format_id': format_id, }) - self._sort_formats(formats) return formats def _download_and_extract_formats(self, video_id, query=None): diff --git a/yt_dlp/extractor/rutv.py b/yt_dlp/extractor/rutv.py index 75da01f7d..d7f9a7337 100644 --- a/yt_dlp/extractor/rutv.py +++ b/yt_dlp/extractor/rutv.py @@ -189,8 +189,6 @@ class RUTVIE(InfoExtractor): }) formats.append(fmt) - self._sort_formats(formats, ('source', )) - return { 'id': video_id, 'title': title, @@ -201,4 +199,5 @@ class RUTVIE(InfoExtractor): 'formats': formats, 'subtitles': subtitles, 'is_live': is_live, + '_format_sort_fields': ('source', ), } diff --git a/yt_dlp/extractor/ruutu.py b/yt_dlp/extractor/ruutu.py index 3f6d30d3c..33f6652df 100644 --- a/yt_dlp/extractor/ruutu.py +++ b/yt_dlp/extractor/ruutu.py @@ -244,8 +244,6 @@ class RuutuIE(InfoExtractor): if ns_st_cds != 'free': raise ExtractorError('This video is %s.' % ns_st_cds, expected=True) - self._sort_formats(formats) - themes = pv('themes') return { diff --git a/yt_dlp/extractor/sapo.py b/yt_dlp/extractor/sapo.py index 9a601a01c..beffaee59 100644 --- a/yt_dlp/extractor/sapo.py +++ b/yt_dlp/extractor/sapo.py @@ -98,8 +98,6 @@ class SapoIE(InfoExtractor): 'height': 720, }) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/screen9.py b/yt_dlp/extractor/screen9.py index eae652af7..5ab0b6c60 100644 --- a/yt_dlp/extractor/screen9.py +++ b/yt_dlp/extractor/screen9.py @@ -49,7 +49,6 @@ class Screen9IE(InfoExtractor): 'format': 'mp4', }) - self._sort_formats(formats) return { 'id': video_id, 'title': traverse_obj( diff --git a/yt_dlp/extractor/scrolller.py b/yt_dlp/extractor/scrolller.py index 8469f487a..4f9fa1440 100644 --- a/yt_dlp/extractor/scrolller.py +++ b/yt_dlp/extractor/scrolller.py @@ -93,8 +93,6 @@ class ScrolllerIE(InfoExtractor): if not formats: self.raise_no_formats('There is no video.', expected=True, video_id=video_id) - self._sort_formats(formats) - return { 'id': video_id, 'title': video_data.get('title'), diff --git a/yt_dlp/extractor/senategov.py b/yt_dlp/extractor/senategov.py index 6fec7c0bb..7ff0cf5b7 100644 --- a/yt_dlp/extractor/senategov.py +++ b/yt_dlp/extractor/senategov.py @@ -131,8 +131,6 @@ class SenateISVPIE(InfoExtractor): entry['format_id'] += mobj.group('tag') formats.append(entry) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, @@ -187,7 +185,6 @@ class SenateGovIE(InfoExtractor): formats = self._extract_m3u8_formats( f'{stream_domain}/i/{filename}_1@{stream_num}/master.m3u8', display_id, ext='mp4') - self._sort_formats(formats) title = self._html_search_regex( (*self._og_regexes('title'), r'(?s)<title>([^<]*?)'), webpage, 'video title') diff --git a/yt_dlp/extractor/sendtonews.py b/yt_dlp/extractor/sendtonews.py index 5ff06f19d..3600e2e74 100644 --- a/yt_dlp/extractor/sendtonews.py +++ b/yt_dlp/extractor/sendtonews.py @@ -77,9 +77,6 @@ class SendtoNewsIE(InfoExtractor): 'format_id': '%s-%d' % (determine_protocol(f), tbr), 'tbr': tbr, }) - # 'tbr' was explicitly set to be preferred over 'height' originally, - # So this is being kept unless someone can confirm this is unnecessary - self._sort_formats(info_dict['formats'], ('tbr', 'res')) thumbnails = [] if video.get('thumbnailUrl'): @@ -98,6 +95,9 @@ class SendtoNewsIE(InfoExtractor): 'thumbnails': thumbnails, 'duration': float_or_none(video.get('SM_length')), 'timestamp': parse_iso8601(video.get('S_sysDate'), delimiter=' '), + # 'tbr' was explicitly set to be preferred over 'height' originally, + # So this is being kept unless someone can confirm this is unnecessary + '_format_sort_fields': ('tbr', 'res') }) entries.append(info_dict) diff --git a/yt_dlp/extractor/servus.py b/yt_dlp/extractor/servus.py index ac030ea41..490d56267 100644 --- a/yt_dlp/extractor/servus.py +++ b/yt_dlp/extractor/servus.py @@ -104,7 +104,6 @@ class ServusIE(InfoExtractor): 'width': int_or_none(resource.get('width')), 'height': int_or_none(resource.get('height')), }) - self._sort_formats(formats) attrs = {} for attribute in video['attributes']: diff --git a/yt_dlp/extractor/sexu.py b/yt_dlp/extractor/sexu.py index 000f7e166..3117f81e3 100644 --- a/yt_dlp/extractor/sexu.py +++ b/yt_dlp/extractor/sexu.py @@ -34,7 +34,6 @@ class SexuIE(InfoExtractor): r'^(\d+)[pP]', source.get('label', ''), 'height', default=None)), } for source in sources if source.get('file')] - self._sort_formats(formats) title = self._html_search_regex( r'([^<]+)\s*-\s*Sexu\.Com', webpage, 'title') diff --git a/yt_dlp/extractor/seznamzpravy.py b/yt_dlp/extractor/seznamzpravy.py index 05642a116..79e888583 100644 --- a/yt_dlp/extractor/seznamzpravy.py +++ b/yt_dlp/extractor/seznamzpravy.py @@ -93,7 +93,6 @@ class SeznamZpravyIE(InfoExtractor): urljoin(sdn_url, hls_rel_url), video_id, ext='mp4', m3u8_id='hls', fatal=False)) - self._sort_formats(formats) return formats def _real_extract(self, url): diff --git a/yt_dlp/extractor/shahid.py b/yt_dlp/extractor/shahid.py index 53ca86b73..26a0bff40 100644 --- a/yt_dlp/extractor/shahid.py +++ b/yt_dlp/extractor/shahid.py @@ -118,7 +118,6 @@ class ShahidIE(ShahidBaseIE): # https://docs.aws.amazon.com/mediapackage/latest/ug/manifest-filtering.html r'aws\.manifestfilter=[\w:;,-]+&?', '', playout['url']), video_id, 'mp4') - self._sort_formats(formats) # video = self._call_api( # 'product/id', video_id, { diff --git a/yt_dlp/extractor/shemaroome.py b/yt_dlp/extractor/shemaroome.py index c0780abe2..7a78c6e05 100644 --- a/yt_dlp/extractor/shemaroome.py +++ b/yt_dlp/extractor/shemaroome.py @@ -74,7 +74,6 @@ class ShemarooMeIE(InfoExtractor): iv = [0] * 16 m3u8_url = unpad_pkcs7(intlist_to_bytes(aes_cbc_decrypt(url_data, key, iv))).decode('ascii') formats, m3u8_subs = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, fatal=False, headers={'stream_key': data_json['stream_key']}) - self._sort_formats(formats) release_date = self._html_search_regex( (r'itemprop="uploadDate">\s*([\d-]+)', r'id="release_date" value="([\d-]+)'), diff --git a/yt_dlp/extractor/showroomlive.py b/yt_dlp/extractor/showroomlive.py index cd681a035..ab1895311 100644 --- a/yt_dlp/extractor/showroomlive.py +++ b/yt_dlp/extractor/showroomlive.py @@ -66,7 +66,6 @@ class ShowRoomLiveIE(InfoExtractor): 'format_note': stream.get('label'), 'quality': int_or_none(stream.get('quality', 100)), }) - self._sort_formats(formats) return { 'id': compat_str(room.get('live_id') or broadcaster_id), diff --git a/yt_dlp/extractor/sina.py b/yt_dlp/extractor/sina.py index d30d57d85..aeba4e377 100644 --- a/yt_dlp/extractor/sina.py +++ b/yt_dlp/extractor/sina.py @@ -97,7 +97,6 @@ class SinaIE(InfoExtractor): 'quality': preference(quality_id), 'ext': 'mp4', }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/sixplay.py b/yt_dlp/extractor/sixplay.py index b7b7d7d7f..a6fb6c1f5 100644 --- a/yt_dlp/extractor/sixplay.py +++ b/yt_dlp/extractor/sixplay.py @@ -104,7 +104,6 @@ class SixPlayIE(InfoExtractor): 'quality': quality_key(quality), 'ext': ext, }) - self._sort_formats(formats) def get(getter): for src in (data, clip_data): diff --git a/yt_dlp/extractor/skyit.py b/yt_dlp/extractor/skyit.py index 9e4d7d35d..42d30f7c4 100644 --- a/yt_dlp/extractor/skyit.py +++ b/yt_dlp/extractor/skyit.py @@ -42,7 +42,6 @@ class SkyItPlayerIE(InfoExtractor): self.raise_geo_restricted(countries=['IT']) formats = self._extract_m3u8_formats(hls_url, video_id, 'mp4') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/slideslive.py b/yt_dlp/extractor/slideslive.py index 87d0fec32..9a60a79e7 100644 --- a/yt_dlp/extractor/slideslive.py +++ b/yt_dlp/extractor/slideslive.py @@ -85,7 +85,6 @@ class SlidesLiveIE(InfoExtractor): formats.extend(self._extract_mpd_formats( _MANIFEST_PATTERN % (service_id, 'mpd'), service_id, mpd_id='dash', fatal=False)) - self._sort_formats(formats) info.update({ 'id': service_id, 'formats': formats, diff --git a/yt_dlp/extractor/sohu.py b/yt_dlp/extractor/sohu.py index c3a135955..a8f1e4623 100644 --- a/yt_dlp/extractor/sohu.py +++ b/yt_dlp/extractor/sohu.py @@ -176,7 +176,6 @@ class SohuIE(InfoExtractor): 'height': int_or_none(data.get('height')), 'fps': int_or_none(data.get('fps')), }) - self._sort_formats(formats) playlist.append({ 'id': '%s_part%d' % (video_id, i + 1), diff --git a/yt_dlp/extractor/sonyliv.py b/yt_dlp/extractor/sonyliv.py index 17d28478f..aaad420f1 100644 --- a/yt_dlp/extractor/sonyliv.py +++ b/yt_dlp/extractor/sonyliv.py @@ -150,7 +150,6 @@ class SonyLIVIE(InfoExtractor): video_id, 'mp4', m3u8_id='hls', headers=headers, fatal=False)) for f in formats: f.setdefault('http_headers', {}).update(headers) - self._sort_formats(formats) metadata = self._call_api( '1.6', 'IN/DETAIL/' + video_id, video_id)['containers'][0]['metadata'] diff --git a/yt_dlp/extractor/soundcloud.py b/yt_dlp/extractor/soundcloud.py index 228e19c3e..4879d48c8 100644 --- a/yt_dlp/extractor/soundcloud.py +++ b/yt_dlp/extractor/soundcloud.py @@ -296,7 +296,6 @@ class SoundcloudBaseIE(InfoExtractor): if not formats and info.get('policy') == 'BLOCK': self.raise_geo_restricted(metadata_available=True) - self._sort_formats(formats) user = info.get('user') or {} diff --git a/yt_dlp/extractor/sovietscloset.py b/yt_dlp/extractor/sovietscloset.py index f1243cc49..453016ccb 100644 --- a/yt_dlp/extractor/sovietscloset.py +++ b/yt_dlp/extractor/sovietscloset.py @@ -104,7 +104,6 @@ class SovietsClosetIE(SovietsClosetBaseIE): thumbnail_url = self._search_regex(r'(https?://.*?thumbnail\.jpg)', iframe, 'thumbnail url') m3u8_formats = self._extract_m3u8_formats(m3u8_url, video_id, headers=self.MEDIADELIVERY_REFERER) - self._sort_formats(m3u8_formats) if not m3u8_formats: duration = None diff --git a/yt_dlp/extractor/spankbang.py b/yt_dlp/extractor/spankbang.py index 1aa8eaba1..f242d334c 100644 --- a/yt_dlp/extractor/spankbang.py +++ b/yt_dlp/extractor/spankbang.py @@ -128,8 +128,6 @@ class SpankBangIE(InfoExtractor): format_url = format_url[0] extract_format(format_id, format_url) - self._sort_formats(formats) - info = self._search_json_ld(webpage, video_id, default={}) title = self._html_search_regex( diff --git a/yt_dlp/extractor/spankwire.py b/yt_dlp/extractor/spankwire.py index d1990e4de..334b29773 100644 --- a/yt_dlp/extractor/spankwire.py +++ b/yt_dlp/extractor/spankwire.py @@ -101,7 +101,6 @@ class SpankwireIE(InfoExtractor): formats.extend(self._extract_m3u8_formats( m3u8_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)) - self._sort_formats(formats) view_count = str_to_int(video.get('viewed')) diff --git a/yt_dlp/extractor/sport5.py b/yt_dlp/extractor/sport5.py index f4ac98b6e..44b4067de 100644 --- a/yt_dlp/extractor/sport5.py +++ b/yt_dlp/extractor/sport5.py @@ -74,7 +74,6 @@ class Sport5IE(InfoExtractor): 'width': int(fmt.get('width')), 'height': int(fmt.get('height')), } for fmt in metadata.findall('./PlaybackLinks/FileURL')] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/sportbox.py b/yt_dlp/extractor/sportbox.py index 622a81b47..ccbb0e8cc 100644 --- a/yt_dlp/extractor/sportbox.py +++ b/yt_dlp/extractor/sportbox.py @@ -65,7 +65,6 @@ class SportBoxIE(InfoExtractor): formats.append({ 'url': src, }) - self._sort_formats(formats) player = self._parse_json( self._search_regex( diff --git a/yt_dlp/extractor/springboardplatform.py b/yt_dlp/extractor/springboardplatform.py index 539a64209..a98584a27 100644 --- a/yt_dlp/extractor/springboardplatform.py +++ b/yt_dlp/extractor/springboardplatform.py @@ -102,8 +102,6 @@ class SpringboardPlatformIE(InfoExtractor): }) formats.append(m3u8_format) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/srgssr.py b/yt_dlp/extractor/srgssr.py index 6dd312985..145f25e9f 100644 --- a/yt_dlp/extractor/srgssr.py +++ b/yt_dlp/extractor/srgssr.py @@ -128,7 +128,6 @@ class SRGSSRIE(InfoExtractor): 'url': podcast_url, 'quality': q(quality), }) - self._sort_formats(formats) if media_type == 'video': for sub in (media_data.get('subtitleList') or []): diff --git a/yt_dlp/extractor/startrek.py b/yt_dlp/extractor/startrek.py index ee03f7837..e92122f9b 100644 --- a/yt_dlp/extractor/startrek.py +++ b/yt_dlp/extractor/startrek.py @@ -49,7 +49,6 @@ class StarTrekIE(InfoExtractor): hls = self._html_search_regex(r'\bdata-hls\s*=\s*"([^"]+)"', player, 'HLS URL') formats, subtitles = self._extract_m3u8_formats_and_subtitles(hls, video_id, 'mp4') - self._sort_formats(formats) captions = self._html_search_regex( r'\bdata-captions-url\s*=\s*"([^"]+)"', player, 'captions URL', fatal=False) diff --git a/yt_dlp/extractor/steam.py b/yt_dlp/extractor/steam.py index eea20ff85..7daee2fe0 100644 --- a/yt_dlp/extractor/steam.py +++ b/yt_dlp/extractor/steam.py @@ -109,7 +109,6 @@ class SteamIE(InfoExtractor): 'format_id': ext + quality, 'url': video_url, }) - self._sort_formats(formats) entry['formats'] = formats entries.append(entry) embedded_videos = re.findall(r'(]+>)', webpage) @@ -163,7 +162,6 @@ class SteamCommunityBroadcastIE(InfoExtractor): 'https://steamcommunity.com/actions/ajaxresolveusers', video_id, query={'steamids': video_id})[0] - self._sort_formats(formats) return { 'id': video_id, 'title': self._generic_title('', webpage), diff --git a/yt_dlp/extractor/streamable.py b/yt_dlp/extractor/streamable.py index 3e60479ad..462861e0e 100644 --- a/yt_dlp/extractor/streamable.py +++ b/yt_dlp/extractor/streamable.py @@ -89,7 +89,6 @@ class StreamableIE(InfoExtractor): 'vcodec': parse_codecs(try_get(info, lambda x: x['input_metadata']['video_codec_name'])).get('vcodec'), 'acodec': parse_codecs(try_get(info, lambda x: x['input_metadata']['audio_codec_name'])).get('acodec'), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/streamanity.py b/yt_dlp/extractor/streamanity.py index f8c37c0dd..6eaee52d9 100644 --- a/yt_dlp/extractor/streamanity.py +++ b/yt_dlp/extractor/streamanity.py @@ -35,7 +35,6 @@ class StreamanityIE(InfoExtractor): formats = self._extract_m3u8_formats( f'https://stream.mux.com/{video_info["play_id"]}.m3u8?token={video_info["token"]}', video_id, ext='mp4', m3u8_id='hls') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/streamcz.py b/yt_dlp/extractor/streamcz.py index 849a9882d..c4537ba8d 100644 --- a/yt_dlp/extractor/streamcz.py +++ b/yt_dlp/extractor/streamcz.py @@ -109,7 +109,6 @@ class StreamCZIE(InfoExtractor): }) formats = list(self._extract_formats(spl_url, video)) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/stripchat.py b/yt_dlp/extractor/stripchat.py index d04aa1db0..4229a0bf1 100644 --- a/yt_dlp/extractor/stripchat.py +++ b/yt_dlp/extractor/stripchat.py @@ -51,8 +51,6 @@ class StripchatIE(InfoExtractor): if not formats: self.raise_no_formats('No active streams found', expected=True) - self._sort_formats(formats) - return { 'id': video_id, 'title': video_id, diff --git a/yt_dlp/extractor/substack.py b/yt_dlp/extractor/substack.py index 787b9f70d..fa3826388 100644 --- a/yt_dlp/extractor/substack.py +++ b/yt_dlp/extractor/substack.py @@ -88,7 +88,6 @@ class SubstackIE(InfoExtractor): else: self.raise_no_formats(f'Page type "{post_type}" is not supported') - self._sort_formats(formats) return { 'id': str(webpage_info['post']['id']), 'formats': formats, diff --git a/yt_dlp/extractor/sunporno.py b/yt_dlp/extractor/sunporno.py index 19498701c..708873a95 100644 --- a/yt_dlp/extractor/sunporno.py +++ b/yt_dlp/extractor/sunporno.py @@ -61,7 +61,6 @@ class SunPornoIE(InfoExtractor): 'format_id': video_ext, 'quality': quality(video_ext), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/sverigesradio.py b/yt_dlp/extractor/sverigesradio.py index 4a4b5cf7e..65da615d0 100644 --- a/yt_dlp/extractor/sverigesradio.py +++ b/yt_dlp/extractor/sverigesradio.py @@ -58,7 +58,6 @@ class SverigesRadioBaseIE(InfoExtractor): 'vcodec': 'none', 'url': audio_url, }) - self._sort_formats(formats) return { 'id': audio_id, diff --git a/yt_dlp/extractor/svt.py b/yt_dlp/extractor/svt.py index b422b6d93..31bf7f97e 100644 --- a/yt_dlp/extractor/svt.py +++ b/yt_dlp/extractor/svt.py @@ -51,7 +51,6 @@ class SVTBaseIE(InfoExtractor): self.raise_geo_restricted( 'This video is only available in Sweden', countries=self._GEO_COUNTRIES, metadata_available=True) - self._sort_formats(formats) subtitle_references = dict_get(video_info, ('subtitles', 'subtitleReferences')) if isinstance(subtitle_references, list): diff --git a/yt_dlp/extractor/swrmediathek.py b/yt_dlp/extractor/swrmediathek.py index deebdd1a4..38bdfced7 100644 --- a/yt_dlp/extractor/swrmediathek.py +++ b/yt_dlp/extractor/swrmediathek.py @@ -92,7 +92,6 @@ class SWRMediathekIE(InfoExtractor): 'vcodec': codec if media_type == 'Video' else 'none', 'acodec': codec if media_type == 'Audio' else None, }) - self._sort_formats(formats) upload_date = None entry_pdatet = attr.get('entry_pdatet') diff --git a/yt_dlp/extractor/tagesschau.py b/yt_dlp/extractor/tagesschau.py index 9b9513f07..ea0532c24 100644 --- a/yt_dlp/extractor/tagesschau.py +++ b/yt_dlp/extractor/tagesschau.py @@ -139,8 +139,6 @@ class TagesschauIE(InfoExtractor): timestamp = video_info.get('timestamp') title = title or video_info.get('description') - self._sort_formats(formats) - return { 'id': display_id, 'title': title, diff --git a/yt_dlp/extractor/tass.py b/yt_dlp/extractor/tass.py index d20dacfc1..67e544a6a 100644 --- a/yt_dlp/extractor/tass.py +++ b/yt_dlp/extractor/tass.py @@ -48,7 +48,6 @@ class TassIE(InfoExtractor): 'format_id': label, 'quality': quality(label), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/teachertube.py b/yt_dlp/extractor/teachertube.py index 2bf836abd..c3eec2784 100644 --- a/yt_dlp/extractor/teachertube.py +++ b/yt_dlp/extractor/teachertube.py @@ -73,8 +73,6 @@ class TeacherTubeIE(InfoExtractor): } for media_url in set(media_urls) ] - self._sort_formats(formats) - thumbnail = self._og_search_thumbnail( webpage, default=None) or self._html_search_meta( 'thumbnail', webpage) diff --git a/yt_dlp/extractor/teamcoco.py b/yt_dlp/extractor/teamcoco.py index 840702ed9..a822b676f 100644 --- a/yt_dlp/extractor/teamcoco.py +++ b/yt_dlp/extractor/teamcoco.py @@ -196,7 +196,6 @@ class TeamcocoIE(TurnerBaseIE): 'format_id': format_id, 'quality': get_quality(format_id), }) - self._sort_formats(formats) info['formats'] = formats return info diff --git a/yt_dlp/extractor/ted.py b/yt_dlp/extractor/ted.py index 0e09ec757..c28a15498 100644 --- a/yt_dlp/extractor/ted.py +++ b/yt_dlp/extractor/ted.py @@ -125,8 +125,6 @@ class TedTalkIE(TedBaseIE): ext_url = external.get('code') if service.lower() == 'youtube' else None return self.url_result(ext_url or external['uri']) - self._sort_formats(formats) - thumbnail = playerData.get('thumb') or self._og_search_property('image', webpage) if thumbnail: # trim thumbnail resize parameters diff --git a/yt_dlp/extractor/tele13.py b/yt_dlp/extractor/tele13.py index 8e35bc85f..212af3785 100644 --- a/yt_dlp/extractor/tele13.py +++ b/yt_dlp/extractor/tele13.py @@ -71,7 +71,6 @@ class Tele13IE(InfoExtractor): 'ext': ext, }) urls.append(format_url) - self._sort_formats(formats) return { 'id': display_id, diff --git a/yt_dlp/extractor/telebruxelles.py b/yt_dlp/extractor/telebruxelles.py index 8d87b6ec1..2c50a67e9 100644 --- a/yt_dlp/extractor/telebruxelles.py +++ b/yt_dlp/extractor/telebruxelles.py @@ -59,7 +59,6 @@ class TeleBruxellesIE(InfoExtractor): rtmp_url = re.sub(r'^rmtp', 'rtmp', rtmp_url) rtmp_url = re.sub(r'"\s*\+\s*"', '', rtmp_url) formats = self._extract_wowza_formats(rtmp_url, article_id or display_id) - self._sort_formats(formats) is_live = 'stream/live' in rtmp_url diff --git a/yt_dlp/extractor/telecinco.py b/yt_dlp/extractor/telecinco.py index a9c0755f4..20bb82420 100644 --- a/yt_dlp/extractor/telecinco.py +++ b/yt_dlp/extractor/telecinco.py @@ -102,7 +102,6 @@ class TelecincoIE(InfoExtractor): }).encode(), headers=headers)['tokens']['1']['cdn'] formats = self._extract_m3u8_formats( stream + '?' + cdn, video_id, 'mp4', 'm3u8_native', m3u8_id='hls') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/telegraaf.py b/yt_dlp/extractor/telegraaf.py index 6562d122c..13e9515f8 100644 --- a/yt_dlp/extractor/telegraaf.py +++ b/yt_dlp/extractor/telegraaf.py @@ -75,8 +75,6 @@ class TelegraafIE(InfoExtractor): 'format_id': 'http' + ('-%s' % label if label else ''), }) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/telegram.py b/yt_dlp/extractor/telegram.py index 39f1a628a..5ec54857d 100644 --- a/yt_dlp/extractor/telegram.py +++ b/yt_dlp/extractor/telegram.py @@ -113,7 +113,6 @@ class TelegramEmbedIE(InfoExtractor): 'url': video_url, 'ext': 'mp4', }] - self._sort_formats(formats) videos.append({ 'id': url_basename(webpage_url), 'webpage_url': update_url_query(webpage_url, {'single': True}), diff --git a/yt_dlp/extractor/telemb.py b/yt_dlp/extractor/telemb.py index 7e444c0d0..3d29dace3 100644 --- a/yt_dlp/extractor/telemb.py +++ b/yt_dlp/extractor/telemb.py @@ -57,7 +57,6 @@ class TeleMBIE(InfoExtractor): 'preference': -10, }) formats.append(fmt) - self._sort_formats(formats) title = remove_start(self._og_search_title(webpage), 'TéléMB : ') description = self._html_search_regex( diff --git a/yt_dlp/extractor/telemundo.py b/yt_dlp/extractor/telemundo.py index 64954b8f1..88f29cb83 100644 --- a/yt_dlp/extractor/telemundo.py +++ b/yt_dlp/extractor/telemundo.py @@ -40,7 +40,6 @@ class TelemundoIE(InfoExtractor): redirect_url + '?format=redirect&manifest=m3u&format=redirect&Tracking=true&Embedded=true&formats=MPEG4'), video_id, 'Processing m3u8').geturl() formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4') - self._sort_formats(formats) date = unified_timestamp(try_get( metadata, lambda x: x['props']['initialState']['video']['associatedPlaylists'][0]['videos'][0]['datePublished'].split(' ', 1)[1])) return { diff --git a/yt_dlp/extractor/tencent.py b/yt_dlp/extractor/tencent.py index 61f300fa4..ff8bf991e 100644 --- a/yt_dlp/extractor/tencent.py +++ b/yt_dlp/extractor/tencent.py @@ -116,7 +116,6 @@ class TencentBaseIE(InfoExtractor): formats.extend(fmts) self._merge_subtitles(subs, native_subtitles, target=subtitles) - self._sort_formats(formats) return formats, subtitles def _get_clean_title(self, title): diff --git a/yt_dlp/extractor/tennistv.py b/yt_dlp/extractor/tennistv.py index 47cb0965e..bc64226bf 100644 --- a/yt_dlp/extractor/tennistv.py +++ b/yt_dlp/extractor/tennistv.py @@ -138,8 +138,6 @@ class TennisTVIE(InfoExtractor): formats, subtitles = self._extract_m3u8_formats_and_subtitles( self._FORMAT_URL.format(partner=self._PARTNER_ID, entry=entryid, session=k_session), video_id) - self._sort_formats(formats) - return { 'id': video_id, 'title': self._generic_title('', webpage), diff --git a/yt_dlp/extractor/tenplay.py b/yt_dlp/extractor/tenplay.py index fc4781447..633032e31 100644 --- a/yt_dlp/extractor/tenplay.py +++ b/yt_dlp/extractor/tenplay.py @@ -98,7 +98,6 @@ class TenPlayIE(InfoExtractor): if '10play-not-in-oz' in m3u8_url: self.raise_geo_restricted(countries=['AU']) formats = self._extract_m3u8_formats(m3u8_url, content_id, 'mp4') - self._sort_formats(formats) return { 'formats': formats, diff --git a/yt_dlp/extractor/theholetv.py b/yt_dlp/extractor/theholetv.py index f0a096d41..a13f83bff 100644 --- a/yt_dlp/extractor/theholetv.py +++ b/yt_dlp/extractor/theholetv.py @@ -24,7 +24,6 @@ class TheHoleTvIE(InfoExtractor): r'(]*\bdata-controller="player"[^>]*>)', webpage, 'video player')) formats, subtitles = self._extract_m3u8_formats_and_subtitles( player_attrs['data-player-source-value'], video_id, 'mp4') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/theplatform.py b/yt_dlp/extractor/theplatform.py index c8026d294..e659b8ee1 100644 --- a/yt_dlp/extractor/theplatform.py +++ b/yt_dlp/extractor/theplatform.py @@ -296,7 +296,6 @@ class ThePlatformIE(ThePlatformBaseIE, AdobePassIE): smil_url = self._sign_url(smil_url, sig['key'], sig['secret']) formats, subtitles = self._extract_theplatform_smil(smil_url, video_id) - self._sort_formats(formats) ret = self._extract_theplatform_metadata(path, video_id) combined_subtitles = self._merge_subtitles(ret.get('subtitles', {}), subtitles) @@ -366,8 +365,6 @@ class ThePlatformFeedIE(ThePlatformBaseIE): formats.extend(cur_formats) subtitles = self._merge_subtitles(subtitles, cur_subtitles) - self._sort_formats(formats) - thumbnails = [{ 'url': thumbnail['plfile$url'], 'width': int_or_none(thumbnail.get('plfile$width')), diff --git a/yt_dlp/extractor/theta.py b/yt_dlp/extractor/theta.py index 3ec6b9711..ecf0ea091 100644 --- a/yt_dlp/extractor/theta.py +++ b/yt_dlp/extractor/theta.py @@ -41,7 +41,6 @@ class ThetaStreamIE(InfoExtractor): if data.get('type') != 'embed' and data.get('resolution') in ('master', 'source')) formats = self._extract_m3u8_formats(m3u8_playlist, channel_id, 'mp4', m3u8_id='hls', live=True) - self._sort_formats(formats) channel = try_get(info, lambda x: x['user']['username']) # using this field instead of channel_id due to capitalization @@ -78,7 +77,6 @@ class ThetaVideoIE(InfoExtractor): m3u8_playlist = try_get(info, lambda x: x['video_urls'][0]['url']) formats = self._extract_m3u8_formats(m3u8_playlist, video_id, 'mp4', m3u8_id='hls') - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/theweatherchannel.py b/yt_dlp/extractor/theweatherchannel.py index 4f6d2ecba..682e4335d 100644 --- a/yt_dlp/extractor/theweatherchannel.py +++ b/yt_dlp/extractor/theweatherchannel.py @@ -79,7 +79,6 @@ class TheWeatherChannelIE(ThePlatformIE): # XXX: Do not subclass from concrete 'url': variant_url, 'format_id': variant_id, }) - self._sort_formats(formats) cc_url = video_data.get('cc_url') diff --git a/yt_dlp/extractor/threeqsdn.py b/yt_dlp/extractor/threeqsdn.py index a313a8dfb..b1041902b 100644 --- a/yt_dlp/extractor/threeqsdn.py +++ b/yt_dlp/extractor/threeqsdn.py @@ -128,10 +128,6 @@ class ThreeQSDNIE(InfoExtractor): 'vcodec': 'none' if height == 0 else None, 'width': int(height * aspect) if height and aspect else None, }) - # It seems like this would be correctly handled by default - # However, unless someone can confirm this, the old - # behaviour is being kept as-is - self._sort_formats(formats, ('res', 'source_preference')) for subtitle in (config.get('subtitles') or []): src = subtitle.get('src') @@ -153,4 +149,8 @@ class ThreeQSDNIE(InfoExtractor): 'is_live': live, 'formats': formats, 'subtitles': subtitles, + # It seems like this would be correctly handled by default + # However, unless someone can confirm this, the old + # behaviour is being kept as-is + '_format_sort_fields': ('res', 'source_preference') } diff --git a/yt_dlp/extractor/threespeak.py b/yt_dlp/extractor/threespeak.py index ce28a37c0..dbd509087 100644 --- a/yt_dlp/extractor/threespeak.py +++ b/yt_dlp/extractor/threespeak.py @@ -57,7 +57,6 @@ class ThreeSpeakIE(InfoExtractor): 'quality': 11, 'format_note': 'Original file', }) - self._sort_formats(formats) return { 'id': id, 'title': data_json.get('title') or data_json.get('root_title'), diff --git a/yt_dlp/extractor/tiktok.py b/yt_dlp/extractor/tiktok.py index 79a223861..0ca6f5afd 100644 --- a/yt_dlp/extractor/tiktok.py +++ b/yt_dlp/extractor/tiktok.py @@ -233,7 +233,6 @@ class TikTokBaseIE(InfoExtractor): if auth_cookie: for f in formats: self._set_cookie(compat_urllib_parse_urlparse(f['url']).hostname, 'sid_tt', auth_cookie.value) - self._sort_formats(formats, ('quality', 'codec', 'size', 'br')) thumbnails = [] for cover_id in ('cover', 'ai_dynamic_cover', 'animated_cover', 'ai_dynamic_cover_bak', @@ -291,7 +290,8 @@ class TikTokBaseIE(InfoExtractor): 'availability': self._availability( is_private='Private' in labels, needs_subscription='Friends only' in labels, - is_unlisted='Followers only' in labels) + is_unlisted='Followers only' in labels), + '_format_sort_fields': ('quality', 'codec', 'size', 'br'), } def _parse_aweme_video_web(self, aweme_detail, webpage_url): @@ -333,7 +333,6 @@ class TikTokBaseIE(InfoExtractor): 'height': height, }) self._remove_duplicate_formats(formats) - self._sort_formats(formats) thumbnails = [] for thumbnail_name in ('thumbnail', 'cover', 'dynamicCover', 'originCover'): diff --git a/yt_dlp/extractor/tnaflix.py b/yt_dlp/extractor/tnaflix.py index eceaadb30..4482c8474 100644 --- a/yt_dlp/extractor/tnaflix.py +++ b/yt_dlp/extractor/tnaflix.py @@ -162,7 +162,6 @@ class TNAFlixNetworkBaseIE(InfoExtractor): def extract_field(pattern, name): return self._html_search_regex(pattern, webpage, name, default=None) if pattern else None - self._sort_formats(formats) return { 'id': video_id, 'display_id': display_id, diff --git a/yt_dlp/extractor/toggle.py b/yt_dlp/extractor/toggle.py index 51a51d84b..70737337c 100644 --- a/yt_dlp/extractor/toggle.py +++ b/yt_dlp/extractor/toggle.py @@ -154,7 +154,6 @@ class ToggleIE(InfoExtractor): and meta.get('Key') == 'Encryption' and meta.get('Value') == '1'): self.report_drm(video_id) # Most likely because geo-blocked if no formats and no DRM - self._sort_formats(formats) thumbnails = [] for picture in info.get('Pictures', []): diff --git a/yt_dlp/extractor/tokentube.py b/yt_dlp/extractor/tokentube.py index a30cabb3c..d022e2753 100644 --- a/yt_dlp/extractor/tokentube.py +++ b/yt_dlp/extractor/tokentube.py @@ -95,8 +95,6 @@ class TokentubeIE(InfoExtractor): description = remove_end(description, 'Category') - self._sort_formats(formats) - return { 'id': video_id, 'formats': formats, diff --git a/yt_dlp/extractor/triller.py b/yt_dlp/extractor/triller.py index 2d633ca67..acd9e68d2 100644 --- a/yt_dlp/extractor/triller.py +++ b/yt_dlp/extractor/triller.py @@ -114,7 +114,6 @@ class TrillerBaseIE(InfoExtractor): formats.extend(self._extract_m3u8_formats( manifest_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)) - self._sort_formats(formats) comment_count = int_or_none(video_info.get('comment_count')) diff --git a/yt_dlp/extractor/trovo.py b/yt_dlp/extractor/trovo.py index b7aa74060..545a67275 100644 --- a/yt_dlp/extractor/trovo.py +++ b/yt_dlp/extractor/trovo.py @@ -95,7 +95,6 @@ class TrovoIE(TrovoBaseIE): 'tbr': stream_info.get('bitrate'), 'http_headers': self._HEADERS, }) - self._sort_formats(formats) info = { 'id': program_id, @@ -222,7 +221,6 @@ class TrovoVodIE(TrovoBaseIE): 'url': play_url, 'http_headers': self._HEADERS, }) - self._sort_formats(formats) category = vod_info.get('categoryName') get_count = lambda x: int_or_none(vod_info.get(x + 'Num')) diff --git a/yt_dlp/extractor/tubetugraz.py b/yt_dlp/extractor/tubetugraz.py index 89371b6eb..ebabedc9c 100644 --- a/yt_dlp/extractor/tubetugraz.py +++ b/yt_dlp/extractor/tubetugraz.py @@ -37,7 +37,6 @@ class TubeTuGrazBaseIE(InfoExtractor): id = episode_info.get('id') formats = list(self._extract_formats( traverse_obj(episode_info, ('mediapackage', 'media', 'track')), id)) - self._sort_formats(formats) title = traverse_obj(episode_info, ('mediapackage', 'title'), 'dcTitle') series_title = traverse_obj(episode_info, ('mediapackage', 'seriestitle')) diff --git a/yt_dlp/extractor/tubitv.py b/yt_dlp/extractor/tubitv.py index f5ed950be..de8b5da69 100644 --- a/yt_dlp/extractor/tubitv.py +++ b/yt_dlp/extractor/tubitv.py @@ -103,8 +103,6 @@ class TubiTvIE(InfoExtractor): elif not formats and not video_data.get('policy_match'): # policy_match is False if content was removed raise ExtractorError('This content is currently unavailable', expected=True) - self._sort_formats(formats) - thumbnails = [] for thumbnail_url in video_data.get('thumbnails', []): if not thumbnail_url: diff --git a/yt_dlp/extractor/tumblr.py b/yt_dlp/extractor/tumblr.py index 5d6615100..88d4ae32d 100644 --- a/yt_dlp/extractor/tumblr.py +++ b/yt_dlp/extractor/tumblr.py @@ -358,7 +358,6 @@ class TumblrIE(InfoExtractor): 'height': int_or_none( media_json.get('height') or self._og_search_property('video:height', webpage, default=None)), }] - self._sort_formats(formats) # the url we're extracting from might be an original post or it might be a reblog. # if it's a reblog, og:description will be the reblogger's comment, not the uploader's. diff --git a/yt_dlp/extractor/tunein.py b/yt_dlp/extractor/tunein.py index f163eaf09..43b4f673c 100644 --- a/yt_dlp/extractor/tunein.py +++ b/yt_dlp/extractor/tunein.py @@ -49,7 +49,6 @@ class TuneInBaseIE(InfoExtractor): 'source_preference': reliability, 'format_note': format_note, }) - self._sort_formats(formats) return { 'id': content_id, diff --git a/yt_dlp/extractor/tunepk.py b/yt_dlp/extractor/tunepk.py index 2973d15ec..e4e507b00 100644 --- a/yt_dlp/extractor/tunepk.py +++ b/yt_dlp/extractor/tunepk.py @@ -57,7 +57,6 @@ class TunePkIE(InfoExtractor): formats = self._parse_jwplayer_formats( details['player']['sources'], video_id) - self._sort_formats(formats) description = self._og_search_description( webpage, default=None) or self._html_search_meta( diff --git a/yt_dlp/extractor/turbo.py b/yt_dlp/extractor/turbo.py index e3f8941c4..cdb7dcff8 100644 --- a/yt_dlp/extractor/turbo.py +++ b/yt_dlp/extractor/turbo.py @@ -53,7 +53,6 @@ class TurboIE(InfoExtractor): 'url': child.text, 'quality': get_quality(quality), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/turner.py b/yt_dlp/extractor/turner.py index fae8b51e7..630d84bdc 100644 --- a/yt_dlp/extractor/turner.py +++ b/yt_dlp/extractor/turner.py @@ -174,7 +174,6 @@ class TurnerBaseIE(AdobePassIE): else: f['tbr'] = int(mobj.group(1)) formats.append(f) - self._sort_formats(formats) for source in video_data.findall('closedCaptions/source'): for track in source.findall('track'): @@ -249,7 +248,6 @@ class TurnerBaseIE(AdobePassIE): 'start_time': start_time, 'end_time': start_time + chapter_duration, }) - self._sort_formats(formats) return { 'formats': formats, diff --git a/yt_dlp/extractor/tv2.py b/yt_dlp/extractor/tv2.py index 0024f7241..c51e63371 100644 --- a/yt_dlp/extractor/tv2.py +++ b/yt_dlp/extractor/tv2.py @@ -95,7 +95,6 @@ class TV2IE(InfoExtractor): }) if not formats and data.get('drmProtected'): self.report_drm(video_id) - self._sort_formats(formats) thumbnails = [{ 'id': type, @@ -258,7 +257,6 @@ class KatsomoIE(InfoExtractor): }) if not formats and data.get('drmProtected'): self.report_drm(video_id) - self._sort_formats(formats) thumbnails = [{ 'id': thumbnail.get('@type'), diff --git a/yt_dlp/extractor/tv24ua.py b/yt_dlp/extractor/tv24ua.py index 8d2475296..89905acdb 100644 --- a/yt_dlp/extractor/tv24ua.py +++ b/yt_dlp/extractor/tv24ua.py @@ -68,7 +68,6 @@ class TV24UAVideoIE(InfoExtractor): self._search_json( r'var\s*vPlayConfig\s*=\s*', webpage, 'thumbnail', video_id, default=None, transform_source=js_to_json), 'poster') - self._sort_formats(formats) return { 'id': video_id, 'formats': formats, diff --git a/yt_dlp/extractor/tv2dk.py b/yt_dlp/extractor/tv2dk.py index 0af286312..35e92f10c 100644 --- a/yt_dlp/extractor/tv2dk.py +++ b/yt_dlp/extractor/tv2dk.py @@ -164,7 +164,6 @@ class TV2DKBornholmPlayIE(InfoExtractor): formats.append({ 'url': src, }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/tv2hu.py b/yt_dlp/extractor/tv2hu.py index 6ac07716b..d4c21c046 100644 --- a/yt_dlp/extractor/tv2hu.py +++ b/yt_dlp/extractor/tv2hu.py @@ -66,7 +66,6 @@ class TV2HuIE(InfoExtractor): video_json = self._download_json(video_json_url, video_id) m3u8_url = self._proto_relative_url(traverse_obj(video_json, ('bitrates', 'hls'))) formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/tv4.py b/yt_dlp/extractor/tv4.py index e8cdd5c8c..1378a6f57 100644 --- a/yt_dlp/extractor/tv4.py +++ b/yt_dlp/extractor/tv4.py @@ -119,8 +119,6 @@ class TV4IE(InfoExtractor): if not formats and info.get('is_geo_restricted'): self.raise_geo_restricted(countries=self._GEO_COUNTRIES, metadata_available=True) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/tv5mondeplus.py b/yt_dlp/extractor/tv5mondeplus.py index d449cdc04..bd0be784d 100644 --- a/yt_dlp/extractor/tv5mondeplus.py +++ b/yt_dlp/extractor/tv5mondeplus.py @@ -77,7 +77,6 @@ class TV5MondePlusIE(InfoExtractor): 'url': v_url, 'format_id': video_format, }) - self._sort_formats(formats) metadata = self._parse_json( vpl_data['data-metadata'], display_id) diff --git a/yt_dlp/extractor/tvc.py b/yt_dlp/extractor/tvc.py index 1ef64caf9..caa76ab6f 100644 --- a/yt_dlp/extractor/tvc.py +++ b/yt_dlp/extractor/tvc.py @@ -41,7 +41,6 @@ class TVCIE(InfoExtractor): 'height': int_or_none(info.get('height')), 'tbr': int_or_none(info.get('bitrate')), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/tvigle.py b/yt_dlp/extractor/tvigle.py index 9a7cb7214..6c982193d 100644 --- a/yt_dlp/extractor/tvigle.py +++ b/yt_dlp/extractor/tvigle.py @@ -120,7 +120,6 @@ class TvigleIE(InfoExtractor): 'height': int_or_none(height), 'filesize': filesize, }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/tvn24.py b/yt_dlp/extractor/tvn24.py index 22b605823..9c777c17d 100644 --- a/yt_dlp/extractor/tvn24.py +++ b/yt_dlp/extractor/tvn24.py @@ -70,7 +70,6 @@ class TVN24IE(InfoExtractor): 'format_id': format_id, 'height': int_or_none(format_id.rstrip('p')), }) - self._sort_formats(formats) description = self._og_search_description(webpage, default=None) thumbnail = self._og_search_thumbnail( diff --git a/yt_dlp/extractor/tvnet.py b/yt_dlp/extractor/tvnet.py index 5820bb4a7..77426f7e6 100644 --- a/yt_dlp/extractor/tvnet.py +++ b/yt_dlp/extractor/tvnet.py @@ -109,7 +109,6 @@ class TVNetIE(InfoExtractor): stream_urls.add(stream_url) formats.extend(self._extract_m3u8_formats( stream_url, video_id, 'mp4', live=is_live, m3u8_id='hls', fatal=False)) - self._sort_formats(formats) # better support for radio streams if title.startswith('VOV'): diff --git a/yt_dlp/extractor/tvnow.py b/yt_dlp/extractor/tvnow.py index 24add5260..0acc306df 100644 --- a/yt_dlp/extractor/tvnow.py +++ b/yt_dlp/extractor/tvnow.py @@ -74,7 +74,6 @@ class TVNowBaseIE(InfoExtractor): if not info.get('free', True): raise ExtractorError( 'Video %s is not available for free' % video_id, expected=True) - self._sort_formats(formats) description = info.get('articleLong') or info.get('articleShort') timestamp = parse_iso8601(info.get('broadcastStartDate'), ' ') @@ -392,7 +391,6 @@ class TVNowIE(TVNowNewBaseIE): if not info.get('free', True): raise ExtractorError( 'Video %s is not available for free' % video_id, expected=True) - self._sort_formats(formats) description = source.get('description') thumbnail = url_or_none(source.get('poster')) diff --git a/yt_dlp/extractor/tvopengr.py b/yt_dlp/extractor/tvopengr.py index d8be12c96..e208e57f2 100644 --- a/yt_dlp/extractor/tvopengr.py +++ b/yt_dlp/extractor/tvopengr.py @@ -69,7 +69,6 @@ class TVOpenGrWatchIE(TVOpenGrBaseIE): continue formats.extend(formats_) self._merge_subtitles(subs_, target=subs) - self._sort_formats(formats) return formats, subs def _real_extract(self, url): diff --git a/yt_dlp/extractor/tvp.py b/yt_dlp/extractor/tvp.py index c83b99762..8483564f7 100644 --- a/yt_dlp/extractor/tvp.py +++ b/yt_dlp/extractor/tvp.py @@ -433,8 +433,6 @@ class TVPEmbedIE(InfoExtractor): 'height': int_or_none(traverse_obj(file, ('quality', 'height'))), }) - self._sort_formats(formats) - title = dict_get(info, ('subtitle', 'title', 'seoTitle')) description = dict_get(info, ('description', 'seoDescription')) thumbnails = [] diff --git a/yt_dlp/extractor/tvplay.py b/yt_dlp/extractor/tvplay.py index f815b5137..9ef4f962c 100644 --- a/yt_dlp/extractor/tvplay.py +++ b/yt_dlp/extractor/tvplay.py @@ -294,8 +294,6 @@ class TVPlayIE(InfoExtractor): 'This content might not be available in your country due to copyright reasons', metadata_available=True) - self._sort_formats(formats) - # TODO: webvtt in m3u8 subtitles = {} sami_path = video.get('sami_path') @@ -410,7 +408,6 @@ class ViafreeIE(InfoExtractor): raise formats, subtitles = self._extract_m3u8_formats_and_subtitles(stream_href, guid, 'mp4') - self._sort_formats(formats) episode = program.get('episode') or {} return { 'id': guid, @@ -495,7 +492,6 @@ class TVPlayHomeIE(InfoExtractor): urljoin(url, f'/api/products/{stream_id}/videos/playlist?videoType={video_type}&platform=BROWSER'), video_id) formats, subtitles = self._extract_m3u8_formats_and_subtitles( stream['sources']['HLS'][0]['src'], video_id, 'mp4', 'm3u8_native', m3u8_id='hls') - self._sort_formats(formats) thumbnails = set(traverse_obj( data, (('galary', 'images', 'artworks'), ..., ..., ('miniUrl', 'mainUrl')), expected_type=url_or_none)) diff --git a/yt_dlp/extractor/tvplayer.py b/yt_dlp/extractor/tvplayer.py index 31d70b6b8..b05355f87 100644 --- a/yt_dlp/extractor/tvplayer.py +++ b/yt_dlp/extractor/tvplayer.py @@ -72,7 +72,6 @@ class TVPlayerIE(InfoExtractor): raise formats = self._extract_m3u8_formats(response['stream'], display_id, 'mp4') - self._sort_formats(formats) return { 'id': resource_id, diff --git a/yt_dlp/extractor/tweakers.py b/yt_dlp/extractor/tweakers.py index 6d1f92bbb..e8e1fc666 100644 --- a/yt_dlp/extractor/tweakers.py +++ b/yt_dlp/extractor/tweakers.py @@ -47,7 +47,6 @@ class TweakersIE(InfoExtractor): 'height': height, 'ext': ext, }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/twentymin.py b/yt_dlp/extractor/twentymin.py index f33f15914..74f90b00b 100644 --- a/yt_dlp/extractor/twentymin.py +++ b/yt_dlp/extractor/twentymin.py @@ -57,7 +57,6 @@ class TwentyMinutenIE(InfoExtractor): 'url': 'http://podcast.20min-tv.ch/podcast/20min/%s%s.mp4' % (video_id, p), 'quality': quality, } for quality, (format_id, p) in enumerate([('sd', ''), ('hd', 'h')])] - self._sort_formats(formats) description = video.get('lead') thumbnail = video.get('thumbnail') diff --git a/yt_dlp/extractor/twitcasting.py b/yt_dlp/extractor/twitcasting.py index 9046f994d..735cb0bb0 100644 --- a/yt_dlp/extractor/twitcasting.py +++ b/yt_dlp/extractor/twitcasting.py @@ -186,15 +186,13 @@ class TwitCastingIE(InfoExtractor): 'protocol': 'websocket_frag', }) - self._sort_formats(formats, ('source',)) - infodict = { - 'formats': formats + 'formats': formats, + '_format_sort_fields': ('source', ), } elif len(m3u8_urls) == 1: formats = self._extract_m3u8_formats( m3u8_urls[0], video_id, 'mp4', headers=self._M3U8_HEADERS) - self._sort_formats(formats) infodict = { # No problem here since there's only one manifest 'formats': formats, diff --git a/yt_dlp/extractor/twitch.py b/yt_dlp/extractor/twitch.py index 975e09c30..c59d1cf17 100644 --- a/yt_dlp/extractor/twitch.py +++ b/yt_dlp/extractor/twitch.py @@ -133,7 +133,6 @@ class TwitchBaseIE(InfoExtractor): 'quality': 10, 'format_note': 'Source', }) - self._sort_formats(formats) def _download_base_gql(self, video_id, ops, note, fatal=True): headers = { @@ -1144,7 +1143,6 @@ class TwitchClipsIE(TwitchBaseIE): 'height': int_or_none(option.get('quality')), 'fps': int_or_none(option.get('frameRate')), }) - self._sort_formats(formats) thumbnails = [] for thumbnail_id in ('tiny', 'small', 'medium'): diff --git a/yt_dlp/extractor/twitter.py b/yt_dlp/extractor/twitter.py index 48c14ddce..3c81473dc 100644 --- a/yt_dlp/extractor/twitter.py +++ b/yt_dlp/extractor/twitter.py @@ -876,7 +876,6 @@ class TwitterIE(TwitterBaseIE): fmts, subs = self._extract_variant_formats(variant, twid) subtitles = self._merge_subtitles(subtitles, subs) formats.extend(fmts) - self._sort_formats(formats, ('res', 'br', 'size', 'proto')) # The codec of http formats are unknown thumbnails = [] media_url = media.get('media_url_https') or media.get('media_url') @@ -898,6 +897,8 @@ class TwitterIE(TwitterBaseIE): 'subtitles': subtitles, 'thumbnails': thumbnails, 'duration': float_or_none(video_info.get('duration_millis'), 1000), + # The codec of http formats are unknown + '_format_sort_fields': ('res', 'br', 'size', 'proto'), } def extract_from_card_info(card): @@ -952,7 +953,6 @@ class TwitterIE(TwitterBaseIE): vmap_url = get_binding_value('amplify_url_vmap') if is_amplify else get_binding_value('player_stream_url') content_id = get_binding_value('%s_content_id' % (card_name if is_amplify else 'player')) formats, subtitles = self._extract_formats_from_vmap_url(vmap_url, content_id or twid) - self._sort_formats(formats) thumbnails = [] for suffix in ('_small', '', '_large', '_x_large', '_original'): diff --git a/yt_dlp/extractor/udemy.py b/yt_dlp/extractor/udemy.py index 2c8a35473..8b99c59cf 100644 --- a/yt_dlp/extractor/udemy.py +++ b/yt_dlp/extractor/udemy.py @@ -391,8 +391,6 @@ class UdemyIE(InfoExtractor): if f.get('url'): formats.append(f) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/udn.py b/yt_dlp/extractor/udn.py index 9fdb46faf..10668ac4b 100644 --- a/yt_dlp/extractor/udn.py +++ b/yt_dlp/extractor/udn.py @@ -90,8 +90,6 @@ class UDNEmbedIE(InfoExtractor): }) formats.append(a_format) - self._sort_formats(formats) - return { 'id': video_id, 'formats': formats, diff --git a/yt_dlp/extractor/umg.py b/yt_dlp/extractor/umg.py index e6ed656b9..3ffcb7364 100644 --- a/yt_dlp/extractor/umg.py +++ b/yt_dlp/extractor/umg.py @@ -86,7 +86,6 @@ class UMGDeIE(InfoExtractor): if not formats: for format_id in (867, 836, 940): add_m3u8_format(format_id) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/unistra.py b/yt_dlp/extractor/unistra.py index 083c87209..6e872cd14 100644 --- a/yt_dlp/extractor/unistra.py +++ b/yt_dlp/extractor/unistra.py @@ -47,7 +47,6 @@ class UnistraIE(InfoExtractor): 'format_id': format_id, 'quality': quality(format_id) }) - self._sort_formats(formats) title = self._html_search_regex( r'UTV - (.*?)</', webpage, 'title') diff --git a/yt_dlp/extractor/uol.py b/yt_dlp/extractor/uol.py index e3d9127d8..068c2b87d 100644 --- a/yt_dlp/extractor/uol.py +++ b/yt_dlp/extractor/uol.py @@ -107,7 +107,6 @@ class UOLIE(InfoExtractor): 'url': f_url, 'quality': quality(format_id), }) - self._sort_formats(formats) tags = [] for tag in video_data.get('tags', []): diff --git a/yt_dlp/extractor/uplynk.py b/yt_dlp/extractor/uplynk.py index 9b560f719..87c427f63 100644 --- a/yt_dlp/extractor/uplynk.py +++ b/yt_dlp/extractor/uplynk.py @@ -33,7 +33,6 @@ class UplynkIE(InfoExtractor): if session_id: for f in formats: f['extra_param_to_segment_url'] = 'pbs=' + session_id - self._sort_formats(formats) asset = self._download_json('http://content.uplynk.com/player/assetinfo/%s.json' % path, display_id) if asset.get('error') == 1: raise ExtractorError('% said: %s' % (self.IE_NAME, asset['msg']), expected=True) diff --git a/yt_dlp/extractor/urort.py b/yt_dlp/extractor/urort.py index 3f687f737..debd2ba9e 100644 --- a/yt_dlp/extractor/urort.py +++ b/yt_dlp/extractor/urort.py @@ -40,7 +40,6 @@ class UrortIE(InfoExtractor): 'url': 'http://p3urort.blob.core.windows.net/tracks/%s' % f['FileRef'], 'quality': 3 if f['FileType'] == 'mp3' else 2, } for f in s['Files']] - self._sort_formats(formats) e = { 'id': '%d-%s' % (s['BandId'], s['$id']), 'title': s['Title'], diff --git a/yt_dlp/extractor/urplay.py b/yt_dlp/extractor/urplay.py index 30bd3dcbf..0f0d6592d 100644 --- a/yt_dlp/extractor/urplay.py +++ b/yt_dlp/extractor/urplay.py @@ -76,7 +76,6 @@ class URPlayIE(InfoExtractor): formats.extend(self._extract_wowza_formats( 'http://%s/%splaylist.m3u8' % (host, file_http), video_id, skip_protocols=['f4m', 'rtmp', 'rtsp'])) - self._sort_formats(formats) subtitles = {} diff --git a/yt_dlp/extractor/ustream.py b/yt_dlp/extractor/ustream.py index cb920bf13..5df241653 100644 --- a/yt_dlp/extractor/ustream.py +++ b/yt_dlp/extractor/ustream.py @@ -210,8 +210,6 @@ class UstreamIE(InfoExtractor): formats.extend(self._parse_segmented_mp4(dash_streams)) ''' - self._sort_formats(formats) - description = video.get('description') timestamp = int_or_none(video.get('created_at')) duration = float_or_none(video.get('length')) diff --git a/yt_dlp/extractor/ustudio.py b/yt_dlp/extractor/ustudio.py index fd5dad0fc..c3aeeb961 100644 --- a/yt_dlp/extractor/ustudio.py +++ b/yt_dlp/extractor/ustudio.py @@ -39,7 +39,6 @@ class UstudioIE(InfoExtractor): } for item in config.findall('./qualities/quality/%s' % kind) if item.get('url')] formats = extract('video') - self._sort_formats(formats) webpage = self._download_webpage(url, display_id) @@ -98,7 +97,6 @@ class UstudioEmbedIE(InfoExtractor): 'width': int_or_none(quality.get('width')), 'height': height, }) - self._sort_formats(formats) thumbnails = [] for image in video_data.get('images', []): diff --git a/yt_dlp/extractor/utreon.py b/yt_dlp/extractor/utreon.py index 1213ae1bf..90c10c051 100644 --- a/yt_dlp/extractor/utreon.py +++ b/yt_dlp/extractor/utreon.py @@ -68,7 +68,6 @@ class UtreonIE(InfoExtractor): 'format_id': format_key.split('_')[1], 'height': int(format_key.split('_')[1][:-1]), } for format_key, format_url in videos_json.items() if url_or_none(format_url)] - self._sort_formats(formats) thumbnail = url_or_none(dict_get(json_data, ('cover_image_url', 'preview_image_url'))) return { 'id': video_id, diff --git a/yt_dlp/extractor/veo.py b/yt_dlp/extractor/veo.py index 25d462a7d..ef44d421e 100644 --- a/yt_dlp/extractor/veo.py +++ b/yt_dlp/extractor/veo.py @@ -65,8 +65,6 @@ class VeoIE(InfoExtractor): 'vbr': int_or_none(fmt.get('bit_rate'), scale=1000), }) - self._sort_formats(formats) - return { 'id': video_id, 'title': str_or_none(metadata.get('title')), diff --git a/yt_dlp/extractor/veoh.py b/yt_dlp/extractor/veoh.py index d9b3ab115..92ff86521 100644 --- a/yt_dlp/extractor/veoh.py +++ b/yt_dlp/extractor/veoh.py @@ -105,7 +105,6 @@ class VeohIE(InfoExtractor): 'quality': q(f_id), 'url': f_url, }) - self._sort_formats(formats) categories = metadata.get('categoryPath') if not categories: diff --git a/yt_dlp/extractor/vevo.py b/yt_dlp/extractor/vevo.py index a146be048..da4ce49ca 100644 --- a/yt_dlp/extractor/vevo.py +++ b/yt_dlp/extractor/vevo.py @@ -274,7 +274,6 @@ class VevoIE(VevoBaseIE): 'width': int(m.group('width')), 'height': int(m.group('height')), }) - self._sort_formats(formats) track = video_info['title'] if featured_artist: diff --git a/yt_dlp/extractor/vgtv.py b/yt_dlp/extractor/vgtv.py index b637afddf..db338fa10 100644 --- a/yt_dlp/extractor/vgtv.py +++ b/yt_dlp/extractor/vgtv.py @@ -238,8 +238,6 @@ class VGTVIE(XstreamIE): # XXX: Do not subclass from concrete IE raise self.raise_geo_restricted( countries=[host.rpartition('.')[-1].partition('/')[0].upper()]) - self._sort_formats(info['formats']) - info.update({ 'id': video_id, 'title': data['title'], diff --git a/yt_dlp/extractor/vice.py b/yt_dlp/extractor/vice.py index f3ad56bf1..d1a3b48aa 100644 --- a/yt_dlp/extractor/vice.py +++ b/yt_dlp/extractor/vice.py @@ -150,7 +150,6 @@ class ViceIE(ViceBaseIE, AdobePassIE): video_data = preplay['video'] formats = self._extract_m3u8_formats( preplay['playURL'], video_id, 'mp4', 'm3u8_native') - self._sort_formats(formats) episode = video_data.get('episode') or {} channel = video_data.get('channel') or {} season = video_data.get('season') or {} diff --git a/yt_dlp/extractor/viddler.py b/yt_dlp/extractor/viddler.py index d81a31375..40914774a 100644 --- a/yt_dlp/extractor/viddler.py +++ b/yt_dlp/extractor/viddler.py @@ -116,7 +116,6 @@ class ViddlerIE(InfoExtractor): f['format_id'] = format_id + '-html5' f['source_preference'] = 0 formats.append(f) - self._sort_formats(formats) categories = [ t.get('text') for t in data.get('tags', []) if 'text' in t] diff --git a/yt_dlp/extractor/videa.py b/yt_dlp/extractor/videa.py index fa16da28b..52fa8fcec 100644 --- a/yt_dlp/extractor/videa.py +++ b/yt_dlp/extractor/videa.py @@ -167,7 +167,6 @@ class VideaIE(InfoExtractor): 'height': int_or_none(source.get('height')), }) formats.append(f) - self._sort_formats(formats) thumbnail = self._proto_relative_url(xpath_text(video, './poster_src')) diff --git a/yt_dlp/extractor/videocampus_sachsen.py b/yt_dlp/extractor/videocampus_sachsen.py index 1aa84ea70..982ab3dd0 100644 --- a/yt_dlp/extractor/videocampus_sachsen.py +++ b/yt_dlp/extractor/videocampus_sachsen.py @@ -173,7 +173,6 @@ class VideocampusSachsenIE(InfoExtractor): raise formats.append({'url': f'https://{host}/getMedium/{video_id}.mp4'}) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/videomore.py b/yt_dlp/extractor/videomore.py index 2f81860bb..ddc33f7d7 100644 --- a/yt_dlp/extractor/videomore.py +++ b/yt_dlp/extractor/videomore.py @@ -181,7 +181,6 @@ class VideomoreIE(InfoExtractor): if error in ('Данное видео недоступно для просмотра на территории этой страны', 'Данное видео доступно для просмотра только на территории России'): self.raise_geo_restricted(countries=['RU'], metadata_available=True) self.raise_no_formats(error, expected=True) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/videopress.py b/yt_dlp/extractor/videopress.py index 16965dfb0..0734aee9c 100644 --- a/yt_dlp/extractor/videopress.py +++ b/yt_dlp/extractor/videopress.py @@ -76,7 +76,6 @@ class VideoPressIE(InfoExtractor): 'width': int_or_none(video.get('width')), 'height': int_or_none(video.get('height')), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/vidio.py b/yt_dlp/extractor/vidio.py index 8d3abceed..770aa284d 100644 --- a/yt_dlp/extractor/vidio.py +++ b/yt_dlp/extractor/vidio.py @@ -156,8 +156,6 @@ class VidioIE(VidioBaseIE): formats, subs = self._extract_m3u8_formats_and_subtitles( hls_url, display_id, 'mp4', 'm3u8_native') - self._sort_formats(formats) - get_first = lambda x: try_get(data, lambda y: y[x + 's'][0], dict) or {} channel = get_first('channel') user = get_first('user') @@ -293,7 +291,6 @@ class VidioLiveIE(VidioBaseIE): if stream_meta.get('stream_url'): formats.extend(self._extract_m3u8_formats( stream_meta['stream_url'], display_id, 'mp4', 'm3u8_native')) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/vidlii.py b/yt_dlp/extractor/vidlii.py index 69a75304e..5933783ae 100644 --- a/yt_dlp/extractor/vidlii.py +++ b/yt_dlp/extractor/vidlii.py @@ -77,7 +77,6 @@ class VidLiiIE(InfoExtractor): 'format_id': f'{height}p', 'height': height, }) - self._sort_formats(formats) title = self._search_regex( (r'<h1>([^<]+)</h1>', r'<title>([^<]+) - VidLii<'), webpage, diff --git a/yt_dlp/extractor/viewlift.py b/yt_dlp/extractor/viewlift.py index b630f9a6d..381260114 100644 --- a/yt_dlp/extractor/viewlift.py +++ b/yt_dlp/extractor/viewlift.py @@ -134,7 +134,6 @@ class ViewLiftEmbedIE(ViewLiftBaseIE): 'url': sub_url, }) - self._sort_formats(formats) return { 'id': film_id, 'title': title, diff --git a/yt_dlp/extractor/viidea.py b/yt_dlp/extractor/viidea.py index 157ce4d8f..4cdf2677b 100644 --- a/yt_dlp/extractor/viidea.py +++ b/yt_dlp/extractor/viidea.py @@ -158,7 +158,6 @@ class ViideaIE(InfoExtractor): smil_url = '%s/%s/video/%s/smil.xml' % (base_url, lecture_slug, part_id) smil = self._download_smil(smil_url, lecture_id) info = self._parse_smil(smil, smil_url, lecture_id) - self._sort_formats(info['formats']) info['id'] = lecture_id if not multipart else '%s_part%s' % (lecture_id, part_id) info['display_id'] = lecture_slug if not multipart else '%s_part%s' % (lecture_slug, part_id) if multipart: diff --git a/yt_dlp/extractor/viki.py b/yt_dlp/extractor/viki.py index a922b195c..3246dab52 100644 --- a/yt_dlp/extractor/viki.py +++ b/yt_dlp/extractor/viki.py @@ -263,7 +263,6 @@ class VikiIE(VikiBaseIE): # Modify the URL to get 1080p mpd_url = mpd_url.replace('mpdhd', 'mpdhd_high') formats = self._extract_mpd_formats(mpd_url, video_id) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/vimeo.py b/yt_dlp/extractor/vimeo.py index 1b21c0050..26fe566b0 100644 --- a/yt_dlp/extractor/vimeo.py +++ b/yt_dlp/extractor/vimeo.py @@ -123,11 +123,6 @@ class VimeoBaseInfoExtractor(InfoExtractor): def _set_vimeo_cookie(self, name, value): self._set_cookie('vimeo.com', name, value) - def _vimeo_sort_formats(self, formats): - # Note: Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps - # at the same time without actual units specified. - self._sort_formats(formats, ('quality', 'res', 'fps', 'hdr:12', 'source')) - def _parse_config(self, config, video_id): video_data = config['video'] video_title = video_data.get('title') @@ -242,6 +237,9 @@ class VimeoBaseInfoExtractor(InfoExtractor): 'formats': formats, 'subtitles': subtitles, 'is_live': is_live, + # Note: Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps + # at the same time without actual units specified. + '_format_sort_fields': ('quality', 'res', 'fps', 'hdr:12', 'source'), } def _extract_original_format(self, url, video_id, unlisted_hash=None): @@ -776,7 +774,6 @@ class VimeoIE(VimeoBaseInfoExtractor): }) info = self._parse_config(self._download_json( video['config_url'], video_id), video_id) - self._vimeo_sort_formats(info['formats']) get_timestamp = lambda x: parse_iso8601(video.get(x + '_time')) info.update({ 'description': video.get('description'), @@ -874,9 +871,7 @@ class VimeoIE(VimeoBaseInfoExtractor): if config.get('view') == 4: config = self._verify_player_video_password( redirect_url, video_id, headers) - info = self._parse_config(config, video_id) - self._vimeo_sort_formats(info['formats']) - return info + return self._parse_config(config, video_id) if re.search(r'<form[^>]+?id="pw_form"', webpage): video_password = self._get_video_password() @@ -981,7 +976,7 @@ class VimeoIE(VimeoBaseInfoExtractor): info_dict_config = self._parse_config(config, video_id) formats.extend(info_dict_config['formats']) - self._vimeo_sort_formats(formats) + info_dict['_format_sort_fields'] = info_dict_config['_format_sort_fields'] json_ld = self._search_json_ld(webpage, video_id, default={}) @@ -1326,7 +1321,6 @@ class VimeoReviewIE(VimeoBaseInfoExtractor): page_url + '/action', video_id) if source_format: info_dict['formats'].append(source_format) - self._vimeo_sort_formats(info_dict['formats']) info_dict['description'] = clean_html(clip_data.get('description')) return info_dict @@ -1398,5 +1392,4 @@ class VHXEmbedIE(VimeoBaseInfoExtractor): config = self._download_json(config_url, video_id) info = self._parse_config(config, video_id) info['id'] = video_id - self._vimeo_sort_formats(info['formats']) return info diff --git a/yt_dlp/extractor/vimm.py b/yt_dlp/extractor/vimm.py index 3522b8e33..7097149a5 100644 --- a/yt_dlp/extractor/vimm.py +++ b/yt_dlp/extractor/vimm.py @@ -23,7 +23,6 @@ class VimmIE(InfoExtractor): formats, subs = self._extract_m3u8_formats_and_subtitles( f'https://www.vimm.tv/hls/{channel_id}.m3u8', channel_id, 'mp4', m3u8_id='hls', live=True) - self._sort_formats(formats) return { 'id': channel_id, @@ -56,7 +55,6 @@ class VimmRecordingIE(InfoExtractor): formats, subs = self._extract_m3u8_formats_and_subtitles( f'https://d211qfrkztakg3.cloudfront.net/{channel_id}/{video_id}/index.m3u8', video_id, 'mp4', m3u8_id='hls', live=False) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/vimple.py b/yt_dlp/extractor/vimple.py index a8b16dd29..fdccf465e 100644 --- a/yt_dlp/extractor/vimple.py +++ b/yt_dlp/extractor/vimple.py @@ -13,7 +13,6 @@ class SprutoBaseIE(InfoExtractor): formats = [{ 'url': f['url'], } for f in playlist['video']] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/vine.py b/yt_dlp/extractor/vine.py index 8e57201f6..1909980f2 100644 --- a/yt_dlp/extractor/vine.py +++ b/yt_dlp/extractor/vine.py @@ -86,7 +86,6 @@ class VineIE(InfoExtractor): 'quality': quality, }) self._check_formats(formats, video_id) - self._sort_formats(formats) username = data.get('username') diff --git a/yt_dlp/extractor/viqeo.py b/yt_dlp/extractor/viqeo.py index 574622fa9..79b9f299a 100644 --- a/yt_dlp/extractor/viqeo.py +++ b/yt_dlp/extractor/viqeo.py @@ -74,7 +74,6 @@ class ViqeoIE(InfoExtractor): 'vcodec': 'none' if is_audio else None, }) formats.append(f) - self._sort_formats(formats) duration = int_or_none(data.get('duration')) diff --git a/yt_dlp/extractor/viu.py b/yt_dlp/extractor/viu.py index d27091c94..19d48234e 100644 --- a/yt_dlp/extractor/viu.py +++ b/yt_dlp/extractor/viu.py @@ -86,7 +86,6 @@ class ViuIE(ViuBaseIE): # r'\1whe\2', video_data['href']) m3u8_url = video_data['href'] formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4') - self._sort_formats(formats) for key, value in video_data.items(): mobj = re.match(r'^subtitle_(?P<lang>[^_]+)_(?P<ext>(vtt|srt))', key) @@ -365,7 +364,6 @@ class ViuOTTIE(InfoExtractor): 'ext': 'mp4', 'filesize': try_get(stream_data, lambda x: x['size'][vid_format], int) }) - self._sort_formats(formats) subtitles = {} for sub in video_data.get('subtitle') or []: diff --git a/yt_dlp/extractor/vk.py b/yt_dlp/extractor/vk.py index 0c856e2b0..347aa381d 100644 --- a/yt_dlp/extractor/vk.py +++ b/yt_dlp/extractor/vk.py @@ -507,7 +507,6 @@ class VKIE(VKBaseIE): 'url': format_url, 'ext': 'flv', }) - self._sort_formats(formats) subtitles = {} for sub in data.get('subs') or {}: diff --git a/yt_dlp/extractor/vlive.py b/yt_dlp/extractor/vlive.py index f4bb079b2..e2fd39315 100644 --- a/yt_dlp/extractor/vlive.py +++ b/yt_dlp/extractor/vlive.py @@ -208,7 +208,6 @@ class VLiveIE(VLiveBaseIE): 'old/v3/live/%s/playInfo', video_id)['result']['adaptiveStreamUrl'] formats = self._extract_m3u8_formats(stream_url, video_id, 'mp4') - self._sort_formats(formats) info = get_common_fields() info.update({ 'title': video['title'], @@ -286,7 +285,6 @@ class VLivePostIE(VLiveBaseIE): 'url': f_url, 'height': int_or_none(f_id[:-1]), }) - self._sort_formats(formats) entry = { 'formats': formats, 'id': video_id, diff --git a/yt_dlp/extractor/vodplatform.py b/yt_dlp/extractor/vodplatform.py index 0d3e7eec2..5ff05004b 100644 --- a/yt_dlp/extractor/vodplatform.py +++ b/yt_dlp/extractor/vodplatform.py @@ -28,7 +28,6 @@ class VODPlatformIE(InfoExtractor): formats = self._extract_wowza_formats( hidden_inputs.get('HiddenmyhHlsLink') or hidden_inputs['HiddenmyDashLink'], video_id, skip_protocols=['f4m', 'smil']) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/voicerepublic.py b/yt_dlp/extractor/voicerepublic.py index e8cbd0e32..47502afb4 100644 --- a/yt_dlp/extractor/voicerepublic.py +++ b/yt_dlp/extractor/voicerepublic.py @@ -46,7 +46,6 @@ class VoiceRepublicIE(InfoExtractor): 'ext': determine_ext(talk_url) or format_id, 'vcodec': 'none', } for format_id, talk_url in talk['media_links'].items()] - self._sort_formats(formats) return { 'id': compat_str(talk.get('id') or display_id), diff --git a/yt_dlp/extractor/voicy.py b/yt_dlp/extractor/voicy.py index feab79138..7438b4956 100644 --- a/yt_dlp/extractor/voicy.py +++ b/yt_dlp/extractor/voicy.py @@ -44,7 +44,6 @@ class VoicyBaseIE(InfoExtractor): 'acodec': 'mp3', 'vcodec': 'none', }] - self._sort_formats(formats) return { 'id': compat_str(entry.get('ArticleId')), 'title': entry.get('ArticleTitle'), diff --git a/yt_dlp/extractor/voot.py b/yt_dlp/extractor/voot.py index 173556e66..b709b74e2 100644 --- a/yt_dlp/extractor/voot.py +++ b/yt_dlp/extractor/voot.py @@ -73,7 +73,6 @@ class VootIE(InfoExtractor): formats = self._extract_m3u8_formats( 'https://cdnapisec.kaltura.com/p/1982551/playManifest/pt/https/f/applehttp/t/web/e/' + entry_id, video_id, 'mp4', m3u8_id='hls') - self._sort_formats(formats) description, series, season_number, episode, episode_number = [None] * 5 diff --git a/yt_dlp/extractor/voxmedia.py b/yt_dlp/extractor/voxmedia.py index 96c782d8b..f9362002f 100644 --- a/yt_dlp/extractor/voxmedia.py +++ b/yt_dlp/extractor/voxmedia.py @@ -47,7 +47,6 @@ class VoxMediaVolumeIE(OnceIE): 'tbr': int_or_none(tbr), }) if formats: - self._sort_formats(formats) info['formats'] = formats info['duration'] = int_or_none(asset.get('duration')) return info @@ -58,7 +57,6 @@ class VoxMediaVolumeIE(OnceIE): continue if provider_video_type == 'brightcove': info['formats'] = self._extract_once_formats(provider_video_id) - self._sort_formats(info['formats']) else: info.update({ '_type': 'url_transparent', diff --git a/yt_dlp/extractor/vrv.py b/yt_dlp/extractor/vrv.py index 0b9bf2903..89fa7affc 100644 --- a/yt_dlp/extractor/vrv.py +++ b/yt_dlp/extractor/vrv.py @@ -192,7 +192,6 @@ class VRVIE(VRVBaseIE): formats.extend(self._extract_vrv_formats( stream.get('url'), video_id, stream_type.split('_')[1], audio_locale, stream.get('hardsub_locale'))) - self._sort_formats(formats) subtitles = {} for k in ('captions', 'subtitles'): diff --git a/yt_dlp/extractor/vshare.py b/yt_dlp/extractor/vshare.py index 93842db79..1bc7ae4ba 100644 --- a/yt_dlp/extractor/vshare.py +++ b/yt_dlp/extractor/vshare.py @@ -49,8 +49,6 @@ class VShareIE(InfoExtractor): url, '<video>%s</video>' % self._extract_packed(webpage), video_id)[0] - self._sort_formats(info['formats']) - info.update({ 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/vvvvid.py b/yt_dlp/extractor/vvvvid.py index 0c3e83a0a..ed725a55d 100644 --- a/yt_dlp/extractor/vvvvid.py +++ b/yt_dlp/extractor/vvvvid.py @@ -223,7 +223,6 @@ class VVVVIDIE(InfoExtractor): metadata_from_url(embed_code) if not is_youtube: - self._sort_formats(formats) info['formats'] = formats metadata_from_url(video_data.get('thumbnail')) diff --git a/yt_dlp/extractor/vzaar.py b/yt_dlp/extractor/vzaar.py index df43caf38..6b9817c9e 100644 --- a/yt_dlp/extractor/vzaar.py +++ b/yt_dlp/extractor/vzaar.py @@ -90,8 +90,6 @@ class VzaarIE(InfoExtractor): f['_decryption_key_url'] = url_templ % ('goose', '') + qs formats.extend(m3u8_formats) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/walla.py b/yt_dlp/extractor/walla.py index 6b954c5cc..a1a9c1708 100644 --- a/yt_dlp/extractor/walla.py +++ b/yt_dlp/extractor/walla.py @@ -69,7 +69,6 @@ class WallaIE(InfoExtractor): if m: fmt['height'] = int(m.group('height')) formats.append(fmt) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/wasdtv.py b/yt_dlp/extractor/wasdtv.py index bad5ccb99..f57c619b5 100644 --- a/yt_dlp/extractor/wasdtv.py +++ b/yt_dlp/extractor/wasdtv.py @@ -37,7 +37,6 @@ class WASDTVBaseIE(InfoExtractor): media_url, is_live = self._get_media_url(media_meta) video_id = media.get('media_id') or container.get('media_container_id') formats, subtitles = self._extract_m3u8_formats_and_subtitles(media_url, video_id, 'mp4') - self._sort_formats(formats) return { 'id': str(video_id), 'title': container.get('media_container_name') or self._og_search_title(self._download_webpage(url, video_id)), @@ -149,7 +148,6 @@ class WASDTVClipIE(WASDTVBaseIE): clip = self._fetch(f'v2/clips/{clip_id}', video_id=clip_id, description='clip') clip_data = clip.get('clip_data') formats, subtitles = self._extract_m3u8_formats_and_subtitles(clip_data.get('url'), video_id=clip_id, ext='mp4') - self._sort_formats(formats) return { 'id': clip_id, 'title': clip.get('clip_title') or self._og_search_title(self._download_webpage(url, clip_id, fatal=False)), diff --git a/yt_dlp/extractor/wat.py b/yt_dlp/extractor/wat.py index e6a89adf6..7c62d2866 100644 --- a/yt_dlp/extractor/wat.py +++ b/yt_dlp/extractor/wat.py @@ -95,8 +95,6 @@ class WatIE(InfoExtractor): if manifest_urls: extract_formats(manifest_urls) - self._sort_formats(formats) - return { 'id': video_id, 'title': title, diff --git a/yt_dlp/extractor/watchbox.py b/yt_dlp/extractor/watchbox.py index e41148d4a..c973ca998 100644 --- a/yt_dlp/extractor/watchbox.py +++ b/yt_dlp/extractor/watchbox.py @@ -109,7 +109,6 @@ class WatchBoxIE(InfoExtractor): 'height': int_or_none(item.get('height')), 'tbr': int_or_none(item.get('bitrate')), }) - self._sort_formats(formats) description = strip_or_none(item.get('descr')) thumbnail = item.get('media_content_thumbnail_large') or source.get('poster') or item.get('media_thumbnail') diff --git a/yt_dlp/extractor/wdr.py b/yt_dlp/extractor/wdr.py index 7b2e7c8e0..de5dc2666 100644 --- a/yt_dlp/extractor/wdr.py +++ b/yt_dlp/extractor/wdr.py @@ -103,8 +103,6 @@ class WDRIE(InfoExtractor): a_format['ext'] = ext formats.append(a_format) - self._sort_formats(formats) - caption_url = media_resource.get('captionURL') if caption_url: subtitles['de'] = [{ diff --git a/yt_dlp/extractor/webcaster.py b/yt_dlp/extractor/webcaster.py index a66a5f8c5..43eeca017 100644 --- a/yt_dlp/extractor/webcaster.py +++ b/yt_dlp/extractor/webcaster.py @@ -50,7 +50,6 @@ class WebcasterIE(InfoExtractor): 'format_note': track.get('title'), }) formats.extend(m3u8_formats) - self._sort_formats(formats) thumbnail = xpath_text(video, './/image', 'thumbnail') diff --git a/yt_dlp/extractor/webofstories.py b/yt_dlp/extractor/webofstories.py index fde9300b0..65f48f3b1 100644 --- a/yt_dlp/extractor/webofstories.py +++ b/yt_dlp/extractor/webofstories.py @@ -104,8 +104,6 @@ class WebOfStoriesIE(InfoExtractor): 'play_path': play_path, }] - self._sort_formats(formats) - return { 'id': story_id, 'title': title, diff --git a/yt_dlp/extractor/weibo.py b/yt_dlp/extractor/weibo.py index d5a52ce20..81a23b9df 100644 --- a/yt_dlp/extractor/weibo.py +++ b/yt_dlp/extractor/weibo.py @@ -88,8 +88,6 @@ class WeiboIE(InfoExtractor): 'height': res, }) - self._sort_formats(formats) - uploader = self._og_search_property( 'nick-name', webpage, 'uploader', default=None) diff --git a/yt_dlp/extractor/whowatch.py b/yt_dlp/extractor/whowatch.py index 21574471c..f2808cd9f 100644 --- a/yt_dlp/extractor/whowatch.py +++ b/yt_dlp/extractor/whowatch.py @@ -70,7 +70,6 @@ class WhoWatchIE(InfoExtractor): formats.extend(self._extract_m3u8_formats( hls_url, video_id, ext='mp4', m3u8_id='hls')) self._remove_duplicate_formats(formats) - self._sort_formats(formats) uploader_url = try_get(metadata, lambda x: x['live']['user']['user_path'], compat_str) if uploader_url: diff --git a/yt_dlp/extractor/willow.py b/yt_dlp/extractor/willow.py index 6c71e9a04..0ec9c9d6e 100644 --- a/yt_dlp/extractor/willow.py +++ b/yt_dlp/extractor/willow.py @@ -41,7 +41,6 @@ class WillowIE(InfoExtractor): raise ExtractorError('No videos found') formats = self._extract_m3u8_formats(video['secureurl'], video_id, 'mp4') - self._sort_formats(formats) return { 'id': str(video.get('content_id')), diff --git a/yt_dlp/extractor/wimtv.py b/yt_dlp/extractor/wimtv.py index d27a348d9..571112390 100644 --- a/yt_dlp/extractor/wimtv.py +++ b/yt_dlp/extractor/wimtv.py @@ -139,7 +139,6 @@ class WimTVIE(InfoExtractor): }) json = json.get('resource') thumb = self._generate_thumbnail(json.get('thumbnailId')) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/wistia.py b/yt_dlp/extractor/wistia.py index e1e5855c2..38dcc2f5b 100644 --- a/yt_dlp/extractor/wistia.py +++ b/yt_dlp/extractor/wistia.py @@ -98,8 +98,6 @@ class WistiaBaseIE(InfoExtractor): }) formats.append(f) - self._sort_formats(formats) - subtitles = {} for caption in data.get('captions', []): language = caption.get('language') diff --git a/yt_dlp/extractor/wppilot.py b/yt_dlp/extractor/wppilot.py index e1062b9b5..5e590e2f4 100644 --- a/yt_dlp/extractor/wppilot.py +++ b/yt_dlp/extractor/wppilot.py @@ -138,8 +138,6 @@ class WPPilotIE(WPPilotBaseIE): random.choice(fmt['url']), video_id, live=True)) - self._sort_formats(formats) - channel['formats'] = formats return channel diff --git a/yt_dlp/extractor/wsj.py b/yt_dlp/extractor/wsj.py index 9eeed104f..86e264679 100644 --- a/yt_dlp/extractor/wsj.py +++ b/yt_dlp/extractor/wsj.py @@ -82,7 +82,6 @@ class WSJIE(InfoExtractor): 'height': int_or_none(v.get('height')), 'fps': float_or_none(v.get('fps')), }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/xfileshare.py b/yt_dlp/extractor/xfileshare.py index e5c479d03..08c6d6c7c 100644 --- a/yt_dlp/extractor/xfileshare.py +++ b/yt_dlp/extractor/xfileshare.py @@ -182,7 +182,6 @@ class XFileShareIE(InfoExtractor): 'url': video_url, 'format_id': 'sd', }) - self._sort_formats(formats) thumbnail = self._search_regex( [ diff --git a/yt_dlp/extractor/xhamster.py b/yt_dlp/extractor/xhamster.py index 688c6b952..59eececb6 100644 --- a/yt_dlp/extractor/xhamster.py +++ b/yt_dlp/extractor/xhamster.py @@ -234,7 +234,6 @@ class XHamsterIE(InfoExtractor): 'Referer': standard_url, }, }) - self._sort_formats(formats) categories_list = video.get('categories') if isinstance(categories_list, list): @@ -311,8 +310,6 @@ class XHamsterIE(InfoExtractor): 'url': video_url, }) - self._sort_formats(formats) - # Only a few videos have an description mobj = re.search(r'<span>Description: </span>([^<]+)', webpage) description = mobj.group(1) if mobj else None diff --git a/yt_dlp/extractor/xinpianchang.py b/yt_dlp/extractor/xinpianchang.py index 96e23bb8d..ddc1d0b5a 100644 --- a/yt_dlp/extractor/xinpianchang.py +++ b/yt_dlp/extractor/xinpianchang.py @@ -72,8 +72,6 @@ class XinpianchangIE(InfoExtractor): 'ext': 'mp4', } for prog in v if prog.get('url') or []]) - self._sort_formats(formats) - return { 'id': video_id, 'title': data.get('title'), diff --git a/yt_dlp/extractor/xnxx.py b/yt_dlp/extractor/xnxx.py index 14beb1347..1452aaec3 100644 --- a/yt_dlp/extractor/xnxx.py +++ b/yt_dlp/extractor/xnxx.py @@ -64,7 +64,6 @@ class XNXXIE(InfoExtractor): 'format_id': format_id, 'quality': -1 if format_id == 'low' else 0, }) - self._sort_formats(formats) thumbnail = self._og_search_thumbnail(webpage, default=None) or get( 'ThumbUrl', fatal=False) or get('ThumbUrl169', fatal=False) diff --git a/yt_dlp/extractor/xstream.py b/yt_dlp/extractor/xstream.py index 42bffb071..8dd1cd9ef 100644 --- a/yt_dlp/extractor/xstream.py +++ b/yt_dlp/extractor/xstream.py @@ -82,7 +82,6 @@ class XstreamIE(InfoExtractor): 'url': media_url, 'tbr': tbr, }) - self._sort_formats(formats) link = find_xpath_attr( entry, xpath_with_ns('./atom:link', NS_MAP), 'rel', 'original') diff --git a/yt_dlp/extractor/xtube.py b/yt_dlp/extractor/xtube.py index 93a6a3f33..ce4480c7d 100644 --- a/yt_dlp/extractor/xtube.py +++ b/yt_dlp/extractor/xtube.py @@ -129,7 +129,6 @@ class XTubeIE(InfoExtractor): }) self._remove_duplicate_formats(formats) - self._sort_formats(formats) if not title: title = self._search_regex( diff --git a/yt_dlp/extractor/xuite.py b/yt_dlp/extractor/xuite.py index 52423a327..71ddadd42 100644 --- a/yt_dlp/extractor/xuite.py +++ b/yt_dlp/extractor/xuite.py @@ -116,7 +116,6 @@ class XuiteIE(InfoExtractor): 'format_id': format_id, 'height': int(format_id) if format_id.isnumeric() else None, }) - self._sort_formats(formats) timestamp = media_info.get('PUBLISH_DATETIME') if timestamp: diff --git a/yt_dlp/extractor/xvideos.py b/yt_dlp/extractor/xvideos.py index 50b939496..5c505c850 100644 --- a/yt_dlp/extractor/xvideos.py +++ b/yt_dlp/extractor/xvideos.py @@ -149,8 +149,6 @@ class XVideosIE(InfoExtractor): 'quality': -2 if format_id.endswith('low') else None, }) - self._sort_formats(formats) - return { 'id': video_id, 'formats': formats, diff --git a/yt_dlp/extractor/yahoo.py b/yt_dlp/extractor/yahoo.py index 01a859556..a69715b7c 100644 --- a/yt_dlp/extractor/yahoo.py +++ b/yt_dlp/extractor/yahoo.py @@ -241,8 +241,6 @@ class YahooIE(InfoExtractor): if not formats and msg == 'geo restricted': self.raise_geo_restricted(metadata_available=True) - self._sort_formats(formats) - thumbnails = [] for thumb in video.get('thumbnails', []): thumb_url = thumb.get('url') @@ -498,7 +496,6 @@ class YahooJapanNewsIE(InfoExtractor): 'tbr': int_or_none(vid.get('bitrate')), }) self._remove_duplicate_formats(formats) - self._sort_formats(formats) return formats diff --git a/yt_dlp/extractor/yandexdisk.py b/yt_dlp/extractor/yandexdisk.py index d87a7f9be..d5eecbd9c 100644 --- a/yt_dlp/extractor/yandexdisk.py +++ b/yt_dlp/extractor/yandexdisk.py @@ -127,7 +127,6 @@ class YandexDiskIE(InfoExtractor): 'url': format_url, 'width': int_or_none(size.get('width')), }) - self._sort_formats(formats) uid = resource.get('uid') display_name = try_get(store, lambda x: x['users'][uid]['displayName']) diff --git a/yt_dlp/extractor/yandexvideo.py b/yt_dlp/extractor/yandexvideo.py index 5e6cf6edd..535b61f65 100644 --- a/yt_dlp/extractor/yandexvideo.py +++ b/yt_dlp/extractor/yandexvideo.py @@ -121,8 +121,6 @@ class YandexVideoIE(InfoExtractor): else: formats.append({'url': content_url}) - self._sort_formats(formats) - timestamp = (int_or_none(content.get('release_date')) or int_or_none(content.get('release_date_ut')) or int_or_none(content.get('start_time'))) @@ -275,7 +273,6 @@ class ZenYandexIE(InfoExtractor): formats.extend(self._extract_mpd_formats(s_url, id, mpd_id='dash')) elif ext == 'm3u8': formats.extend(self._extract_m3u8_formats(s_url, id, 'mp4')) - self._sort_formats(formats) return { 'id': video_id, 'title': video_json.get('title') or self._og_search_title(webpage), diff --git a/yt_dlp/extractor/yapfiles.py b/yt_dlp/extractor/yapfiles.py index 221df842c..19812bae0 100644 --- a/yt_dlp/extractor/yapfiles.py +++ b/yt_dlp/extractor/yapfiles.py @@ -79,7 +79,6 @@ class YapFilesIE(InfoExtractor): 'quality': quality_key(format_id), 'height': hd_height if is_hd else None, }) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/yinyuetai.py b/yt_dlp/extractor/yinyuetai.py index b28c39380..b2e3172f9 100644 --- a/yt_dlp/extractor/yinyuetai.py +++ b/yt_dlp/extractor/yinyuetai.py @@ -41,7 +41,6 @@ class YinYueTaiIE(InfoExtractor): 'ext': 'mp4', 'tbr': format_info.get('bitrate'), } for format_info in info['videoUrlModels']] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/ynet.py b/yt_dlp/extractor/ynet.py index 27eda9721..a7d7371f3 100644 --- a/yt_dlp/extractor/ynet.py +++ b/yt_dlp/extractor/ynet.py @@ -39,7 +39,6 @@ class YnetIE(InfoExtractor): if m: title = m.group('title') formats = self._extract_f4m_formats(f4m_url, video_id) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/youku.py b/yt_dlp/extractor/youku.py index 45856fbbe..624975b98 100644 --- a/yt_dlp/extractor/youku.py +++ b/yt_dlp/extractor/youku.py @@ -198,7 +198,6 @@ class YoukuIE(InfoExtractor): 'width': stream.get('width'), 'height': stream.get('height'), } for stream in data['stream'] if stream.get('channel_type') != 'tail'] - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/youporn.py b/yt_dlp/extractor/youporn.py index 7fdb865f7..2f3f21332 100644 --- a/yt_dlp/extractor/youporn.py +++ b/yt_dlp/extractor/youporn.py @@ -103,7 +103,6 @@ class YouPornIE(InfoExtractor): }) f['height'] = height formats.append(f) - self._sort_formats(formats) webpage = self._download_webpage( 'http://www.youporn.com/watch/%s' % video_id, display_id, diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 7e3530c0f..8a2dd728c 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -4003,10 +4003,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor): formats.extend(self._extract_storyboard(player_responses, duration)) - # source_preference is lower for throttled/potentially damaged formats - self._sort_formats(formats, ( - 'quality', 'res', 'fps', 'hdr:12', 'source', 'vcodec:vp9.2', 'channels', 'acodec', 'lang', 'proto')) - info = { 'id': video_id, 'title': video_title, @@ -4036,6 +4032,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor): 'playable_in_embed': get_first(playability_statuses, 'playableInEmbed'), 'live_status': live_status, 'release_timestamp': live_start_time, + '_format_sort_fields': ( # source_preference is lower for throttled/potentially damaged formats + 'quality', 'res', 'fps', 'hdr:12', 'source', 'vcodec:vp9.2', 'channels', 'acodec', 'lang', 'proto') } subtitles = {} diff --git a/yt_dlp/extractor/zapiks.py b/yt_dlp/extractor/zapiks.py index 4b18cb86c..88f526bbc 100644 --- a/yt_dlp/extractor/zapiks.py +++ b/yt_dlp/extractor/zapiks.py @@ -92,7 +92,6 @@ class ZapiksIE(InfoExtractor): if m: f['height'] = int(m.group('height')) formats.append(f) - self._sort_formats(formats) return { 'id': video_id, diff --git a/yt_dlp/extractor/zattoo.py b/yt_dlp/extractor/zattoo.py index 572a1d0f2..22620c0a3 100644 --- a/yt_dlp/extractor/zattoo.py +++ b/yt_dlp/extractor/zattoo.py @@ -202,7 +202,6 @@ class ZattooPlatformBaseIE(InfoExtractor): for this_format in this_formats: this_format['quality'] = preference formats.extend(this_formats) - self._sort_formats(formats) return formats, subtitles def _extract_video(self, video_id, record_id=None): diff --git a/yt_dlp/extractor/zdf.py b/yt_dlp/extractor/zdf.py index 1eab384b9..fca426a50 100644 --- a/yt_dlp/extractor/zdf.py +++ b/yt_dlp/extractor/zdf.py @@ -110,7 +110,6 @@ class ZDFBaseIE(InfoExtractor): 'class': track.get('class'), 'language': track.get('language'), }) - self._sort_formats(formats, ('tbr', 'res', 'quality', 'language_preference')) duration = float_or_none(try_get( ptmd, lambda x: x['attributes']['duration']['value']), scale=1000) @@ -121,6 +120,7 @@ class ZDFBaseIE(InfoExtractor): 'duration': duration, 'formats': formats, 'subtitles': self._extract_subtitles(ptmd), + '_format_sort_fields': ('tbr', 'res', 'quality', 'language_preference'), } def _extract_player(self, webpage, video_id, fatal=True): @@ -318,7 +318,6 @@ class ZDFIE(ZDFBaseIE): format_urls = set() for f in formitaeten or []: self._extract_format(content_id, formats, format_urls, f) - self._sort_formats(formats) thumbnails = [] teaser_bild = document.get('teaserBild') diff --git a/yt_dlp/extractor/zee5.py b/yt_dlp/extractor/zee5.py index 10dd8fb1c..a64eb9ed0 100644 --- a/yt_dlp/extractor/zee5.py +++ b/yt_dlp/extractor/zee5.py @@ -146,7 +146,6 @@ class Zee5IE(InfoExtractor): if not asset_data.get('hls_url'): self.raise_login_required(self._LOGIN_HINT, metadata_available=True, method=None) formats, m3u8_subs = self._extract_m3u8_formats_and_subtitles(asset_data['hls_url'], video_id, 'mp4', fatal=False) - self._sort_formats(formats) subtitles = {} for sub in asset_data.get('subtitle_url', []): diff --git a/yt_dlp/extractor/zeenews.py b/yt_dlp/extractor/zeenews.py index ae2cc264e..1616dbfbf 100644 --- a/yt_dlp/extractor/zeenews.py +++ b/yt_dlp/extractor/zeenews.py @@ -48,7 +48,6 @@ class ZeeNewsIE(InfoExtractor): raise ExtractorError('No video found', expected=True) formats = self._extract_m3u8_formats(embed_url, content_id, 'mp4') - self._sort_formats(formats) return { **self._json_ld(json_ld_list, display_id), diff --git a/yt_dlp/extractor/zhihu.py b/yt_dlp/extractor/zhihu.py index d8d259dd6..c24b33874 100644 --- a/yt_dlp/extractor/zhihu.py +++ b/yt_dlp/extractor/zhihu.py @@ -45,7 +45,6 @@ class ZhihuIE(InfoExtractor): 'url': play_url, 'width': int_or_none(q.get('width')), }) - self._sort_formats(formats) author = zvideo.get('author') or {} url_token = author.get('url_token') diff --git a/yt_dlp/extractor/zingmp3.py b/yt_dlp/extractor/zingmp3.py index 8b2d842ff..a818c9fa9 100644 --- a/yt_dlp/extractor/zingmp3.py +++ b/yt_dlp/extractor/zingmp3.py @@ -168,7 +168,6 @@ class ZingMp3IE(ZingMp3BaseIE): if not formats and item.get('msg') == 'Sorry, this content is not available in your country.': self.raise_geo_restricted(countries=self._GEO_COUNTRIES, metadata_available=True) - self._sort_formats(formats) lyric = item.get('lyric') or self._call_api('lyric', {'id': item_id}, fatal=False).get('file') diff --git a/yt_dlp/extractor/zoom.py b/yt_dlp/extractor/zoom.py index a455f8c04..ef8b71522 100644 --- a/yt_dlp/extractor/zoom.py +++ b/yt_dlp/extractor/zoom.py @@ -86,8 +86,6 @@ class ZoomIE(InfoExtractor): 'preference': -1 }) - self._sort_formats(formats) - return { 'id': play_id, 'title': data.get('topic'), diff --git a/yt_dlp/extractor/zype.py b/yt_dlp/extractor/zype.py index a705149e6..8cf994505 100644 --- a/yt_dlp/extractor/zype.py +++ b/yt_dlp/extractor/zype.py @@ -97,7 +97,6 @@ class ZypeIE(InfoExtractor): if text_tracks: text_tracks = self._parse_json( text_tracks, video_id, js_to_json, False) - self._sort_formats(formats) if text_tracks: for text_track in text_tracks: