]> jfr.im git - yt-dlp.git/commitdiff
[extractor] Deprecate `_sort_formats`
authorpukkandan <redacted>
Thu, 17 Nov 2022 05:10:03 +0000 (10:40 +0530)
committerpukkandan <redacted>
Thu, 17 Nov 2022 06:10:17 +0000 (11:40 +0530)
579 files changed:
test/test_InfoExtractor.py
test/test_YoutubeDL.py
yt_dlp/extractor/abc.py
yt_dlp/extractor/abcotvs.py
yt_dlp/extractor/acfun.py
yt_dlp/extractor/adn.py
yt_dlp/extractor/adobetv.py
yt_dlp/extractor/adultswim.py
yt_dlp/extractor/aenetworks.py
yt_dlp/extractor/afreecatv.py
yt_dlp/extractor/agora.py
yt_dlp/extractor/allocine.py
yt_dlp/extractor/alsace20tv.py
yt_dlp/extractor/alura.py
yt_dlp/extractor/amcnetworks.py
yt_dlp/extractor/amp.py
yt_dlp/extractor/ant1newsgr.py
yt_dlp/extractor/anvato.py
yt_dlp/extractor/aol.py
yt_dlp/extractor/apa.py
yt_dlp/extractor/aparat.py
yt_dlp/extractor/appletrailers.py
yt_dlp/extractor/archiveorg.py
yt_dlp/extractor/arcpublishing.py
yt_dlp/extractor/ard.py
yt_dlp/extractor/arkena.py
yt_dlp/extractor/arnes.py
yt_dlp/extractor/arte.py
yt_dlp/extractor/atresplayer.py
yt_dlp/extractor/atvat.py
yt_dlp/extractor/audimedia.py
yt_dlp/extractor/banbye.py
yt_dlp/extractor/bandcamp.py
yt_dlp/extractor/bannedvideo.py
yt_dlp/extractor/bbc.py
yt_dlp/extractor/beatport.py
yt_dlp/extractor/beeg.py
yt_dlp/extractor/bigflix.py
yt_dlp/extractor/bilibili.py
yt_dlp/extractor/biqle.py
yt_dlp/extractor/bitchute.py
yt_dlp/extractor/bitwave.py
yt_dlp/extractor/bloomberg.py
yt_dlp/extractor/bokecc.py
yt_dlp/extractor/bongacams.py
yt_dlp/extractor/booyah.py
yt_dlp/extractor/box.py
yt_dlp/extractor/bpb.py
yt_dlp/extractor/br.py
yt_dlp/extractor/breakcom.py
yt_dlp/extractor/breitbart.py
yt_dlp/extractor/brightcove.py
yt_dlp/extractor/byutv.py
yt_dlp/extractor/c56.py
yt_dlp/extractor/cableav.py
yt_dlp/extractor/callin.py
yt_dlp/extractor/caltrans.py
yt_dlp/extractor/cam4.py
yt_dlp/extractor/cammodels.py
yt_dlp/extractor/camsoda.py
yt_dlp/extractor/canalalpha.py
yt_dlp/extractor/canalc2.py
yt_dlp/extractor/canalplus.py
yt_dlp/extractor/canvas.py
yt_dlp/extractor/carambatv.py
yt_dlp/extractor/cbc.py
yt_dlp/extractor/cbs.py
yt_dlp/extractor/cbsnews.py
yt_dlp/extractor/cbssports.py
yt_dlp/extractor/ccc.py
yt_dlp/extractor/ccma.py
yt_dlp/extractor/cctv.py
yt_dlp/extractor/cda.py
yt_dlp/extractor/cellebrite.py
yt_dlp/extractor/ceskatelevize.py
yt_dlp/extractor/channel9.py
yt_dlp/extractor/charlierose.py
yt_dlp/extractor/chaturbate.py
yt_dlp/extractor/chingari.py
yt_dlp/extractor/cinchcast.py
yt_dlp/extractor/ciscowebex.py
yt_dlp/extractor/cliphunter.py
yt_dlp/extractor/cloudflarestream.py
yt_dlp/extractor/clubic.py
yt_dlp/extractor/clyp.py
yt_dlp/extractor/common.py
yt_dlp/extractor/condenast.py
yt_dlp/extractor/contv.py
yt_dlp/extractor/corus.py
yt_dlp/extractor/coub.py
yt_dlp/extractor/cpac.py
yt_dlp/extractor/crackle.py
yt_dlp/extractor/crooksandliars.py
yt_dlp/extractor/crowdbunker.py
yt_dlp/extractor/crunchyroll.py
yt_dlp/extractor/cspan.py
yt_dlp/extractor/curiositystream.py
yt_dlp/extractor/daftsex.py
yt_dlp/extractor/dailymail.py
yt_dlp/extractor/dailymotion.py
yt_dlp/extractor/dailywire.py
yt_dlp/extractor/damtomo.py
yt_dlp/extractor/daystar.py
yt_dlp/extractor/deezer.py
yt_dlp/extractor/democracynow.py
yt_dlp/extractor/detik.py
yt_dlp/extractor/dfb.py
yt_dlp/extractor/digitalconcerthall.py
yt_dlp/extractor/digiteka.py
yt_dlp/extractor/discoverygo.py
yt_dlp/extractor/disney.py
yt_dlp/extractor/dispeak.py
yt_dlp/extractor/dlive.py
yt_dlp/extractor/dplay.py
yt_dlp/extractor/drbonanza.py
yt_dlp/extractor/dropbox.py
yt_dlp/extractor/drtuber.py
yt_dlp/extractor/drtv.py
yt_dlp/extractor/dumpert.py
yt_dlp/extractor/dvtv.py
yt_dlp/extractor/dw.py
yt_dlp/extractor/eagleplatform.py
yt_dlp/extractor/egghead.py
yt_dlp/extractor/einthusan.py
yt_dlp/extractor/eitb.py
yt_dlp/extractor/ellentube.py
yt_dlp/extractor/elonet.py
yt_dlp/extractor/epicon.py
yt_dlp/extractor/eporner.py
yt_dlp/extractor/ertgr.py
yt_dlp/extractor/escapist.py
yt_dlp/extractor/espn.py
yt_dlp/extractor/esri.py
yt_dlp/extractor/europa.py
yt_dlp/extractor/eurosport.py
yt_dlp/extractor/euscreen.py
yt_dlp/extractor/expotv.py
yt_dlp/extractor/expressen.py
yt_dlp/extractor/facebook.py
yt_dlp/extractor/faz.py
yt_dlp/extractor/fc2.py
yt_dlp/extractor/fczenit.py
yt_dlp/extractor/fifa.py
yt_dlp/extractor/filmmodu.py
yt_dlp/extractor/filmon.py
yt_dlp/extractor/firsttv.py
yt_dlp/extractor/flickr.py
yt_dlp/extractor/folketinget.py
yt_dlp/extractor/fourtube.py
yt_dlp/extractor/fourzerostudio.py
yt_dlp/extractor/fox.py
yt_dlp/extractor/foxgay.py
yt_dlp/extractor/fptplay.py
yt_dlp/extractor/francetv.py
yt_dlp/extractor/freesound.py
yt_dlp/extractor/freetv.py
yt_dlp/extractor/frontendmasters.py
yt_dlp/extractor/fujitv.py
yt_dlp/extractor/funimation.py
yt_dlp/extractor/fusion.py
yt_dlp/extractor/gab.py
yt_dlp/extractor/gaia.py
yt_dlp/extractor/gamespot.py
yt_dlp/extractor/gaskrank.py
yt_dlp/extractor/gedidigital.py
yt_dlp/extractor/generic.py
yt_dlp/extractor/genericembeds.py
yt_dlp/extractor/gettr.py
yt_dlp/extractor/gfycat.py
yt_dlp/extractor/giantbomb.py
yt_dlp/extractor/giga.py
yt_dlp/extractor/globo.py
yt_dlp/extractor/glomex.py
yt_dlp/extractor/go.py
yt_dlp/extractor/golem.py
yt_dlp/extractor/goodgame.py
yt_dlp/extractor/googledrive.py
yt_dlp/extractor/goplay.py
yt_dlp/extractor/gopro.py
yt_dlp/extractor/gronkh.py
yt_dlp/extractor/hbo.py
yt_dlp/extractor/hearthisat.py
yt_dlp/extractor/heise.py
yt_dlp/extractor/hellporno.py
yt_dlp/extractor/helsinki.py
yt_dlp/extractor/hidive.py
yt_dlp/extractor/hitbox.py
yt_dlp/extractor/hketv.py
yt_dlp/extractor/hotstar.py
yt_dlp/extractor/howstuffworks.py
yt_dlp/extractor/hrfensehen.py
yt_dlp/extractor/hrti.py
yt_dlp/extractor/hse.py
yt_dlp/extractor/huffpost.py
yt_dlp/extractor/hungama.py
yt_dlp/extractor/huya.py
yt_dlp/extractor/icareus.py
yt_dlp/extractor/ichinanalive.py
yt_dlp/extractor/ign.py
yt_dlp/extractor/imdb.py
yt_dlp/extractor/imggaming.py
yt_dlp/extractor/imgur.py
yt_dlp/extractor/indavideo.py
yt_dlp/extractor/infoq.py
yt_dlp/extractor/instagram.py
yt_dlp/extractor/internazionale.py
yt_dlp/extractor/internetvideoarchive.py
yt_dlp/extractor/iprima.py
yt_dlp/extractor/iqiyi.py
yt_dlp/extractor/islamchannel.py
yt_dlp/extractor/itv.py
yt_dlp/extractor/ivi.py
yt_dlp/extractor/ivideon.py
yt_dlp/extractor/iwara.py
yt_dlp/extractor/ixigua.py
yt_dlp/extractor/izlesene.py
yt_dlp/extractor/jable.py
yt_dlp/extractor/jamendo.py
yt_dlp/extractor/japandiet.py
yt_dlp/extractor/jixie.py
yt_dlp/extractor/joj.py
yt_dlp/extractor/kakao.py
yt_dlp/extractor/kaltura.py
yt_dlp/extractor/keezmovies.py
yt_dlp/extractor/kelbyone.py
yt_dlp/extractor/kinja.py
yt_dlp/extractor/kinopoisk.py
yt_dlp/extractor/konserthusetplay.py
yt_dlp/extractor/koo.py
yt_dlp/extractor/kusi.py
yt_dlp/extractor/kuwo.py
yt_dlp/extractor/la7.py
yt_dlp/extractor/laola1tv.py
yt_dlp/extractor/lbry.py
yt_dlp/extractor/lecture2go.py
yt_dlp/extractor/lecturio.py
yt_dlp/extractor/leeco.py
yt_dlp/extractor/lego.py
yt_dlp/extractor/libraryofcongress.py
yt_dlp/extractor/lifenews.py
yt_dlp/extractor/likee.py
yt_dlp/extractor/limelight.py
yt_dlp/extractor/line.py
yt_dlp/extractor/linkedin.py
yt_dlp/extractor/linuxacademy.py
yt_dlp/extractor/livestream.py
yt_dlp/extractor/lnkgo.py
yt_dlp/extractor/lrt.py
yt_dlp/extractor/lynda.py
yt_dlp/extractor/mailru.py
yt_dlp/extractor/mainstreaming.py
yt_dlp/extractor/malltv.py
yt_dlp/extractor/mangomolo.py
yt_dlp/extractor/manoto.py
yt_dlp/extractor/manyvids.py
yt_dlp/extractor/massengeschmacktv.py
yt_dlp/extractor/masters.py
yt_dlp/extractor/matchtv.py
yt_dlp/extractor/mdr.py
yt_dlp/extractor/medaltv.py
yt_dlp/extractor/mediaklikk.py
yt_dlp/extractor/medialaan.py
yt_dlp/extractor/mediaset.py
yt_dlp/extractor/mediasite.py
yt_dlp/extractor/mediaworksnz.py
yt_dlp/extractor/megatvcom.py
yt_dlp/extractor/melonvod.py
yt_dlp/extractor/metacafe.py
yt_dlp/extractor/metacritic.py
yt_dlp/extractor/mgoon.py
yt_dlp/extractor/mgtv.py
yt_dlp/extractor/microsoftembed.py
yt_dlp/extractor/microsoftstream.py
yt_dlp/extractor/microsoftvirtualacademy.py
yt_dlp/extractor/mildom.py
yt_dlp/extractor/minds.py
yt_dlp/extractor/minoto.py
yt_dlp/extractor/mirrativ.py
yt_dlp/extractor/mixcloud.py
yt_dlp/extractor/mlb.py
yt_dlp/extractor/mnet.py
yt_dlp/extractor/mocha.py
yt_dlp/extractor/moviezine.py
yt_dlp/extractor/msn.py
yt_dlp/extractor/mtv.py
yt_dlp/extractor/muenchentv.py
yt_dlp/extractor/mwave.py
yt_dlp/extractor/myspace.py
yt_dlp/extractor/n1.py
yt_dlp/extractor/nate.py
yt_dlp/extractor/naver.py
yt_dlp/extractor/nba.py
yt_dlp/extractor/nbc.py
yt_dlp/extractor/ndr.py
yt_dlp/extractor/neteasemusic.py
yt_dlp/extractor/netzkino.py
yt_dlp/extractor/newgrounds.py
yt_dlp/extractor/newspicks.py
yt_dlp/extractor/newstube.py
yt_dlp/extractor/newsy.py
yt_dlp/extractor/nexx.py
yt_dlp/extractor/nfb.py
yt_dlp/extractor/nfhsnetwork.py
yt_dlp/extractor/nfl.py
yt_dlp/extractor/nhk.py
yt_dlp/extractor/nhl.py
yt_dlp/extractor/niconico.py
yt_dlp/extractor/ninecninemedia.py
yt_dlp/extractor/ninegag.py
yt_dlp/extractor/njpwworld.py
yt_dlp/extractor/nobelprize.py
yt_dlp/extractor/noodlemagazine.py
yt_dlp/extractor/nova.py
yt_dlp/extractor/novaplay.py
yt_dlp/extractor/noz.py
yt_dlp/extractor/npo.py
yt_dlp/extractor/npr.py
yt_dlp/extractor/nrk.py
yt_dlp/extractor/ntvde.py
yt_dlp/extractor/ntvru.py
yt_dlp/extractor/nuvid.py
yt_dlp/extractor/nytimes.py
yt_dlp/extractor/odnoklassniki.py
yt_dlp/extractor/olympics.py
yt_dlp/extractor/on24.py
yt_dlp/extractor/onefootball.py
yt_dlp/extractor/onet.py
yt_dlp/extractor/ooyala.py
yt_dlp/extractor/opencast.py
yt_dlp/extractor/openrec.py
yt_dlp/extractor/ora.py
yt_dlp/extractor/orf.py
yt_dlp/extractor/pandoratv.py
yt_dlp/extractor/panopto.py
yt_dlp/extractor/parlview.py
yt_dlp/extractor/patreon.py
yt_dlp/extractor/pbs.py
yt_dlp/extractor/pearvideo.py
yt_dlp/extractor/peekvids.py
yt_dlp/extractor/peertube.py
yt_dlp/extractor/peertv.py
yt_dlp/extractor/peloton.py
yt_dlp/extractor/performgroup.py
yt_dlp/extractor/periscope.py
yt_dlp/extractor/philharmoniedeparis.py
yt_dlp/extractor/picarto.py
yt_dlp/extractor/piksel.py
yt_dlp/extractor/pinkbike.py
yt_dlp/extractor/pinterest.py
yt_dlp/extractor/pixivsketch.py
yt_dlp/extractor/pladform.py
yt_dlp/extractor/planetmarathi.py
yt_dlp/extractor/platzi.py
yt_dlp/extractor/playplustv.py
yt_dlp/extractor/plays.py
yt_dlp/extractor/playtvak.py
yt_dlp/extractor/playvid.py
yt_dlp/extractor/playwire.py
yt_dlp/extractor/pluralsight.py
yt_dlp/extractor/plutotv.py
yt_dlp/extractor/polsatgo.py
yt_dlp/extractor/polskieradio.py
yt_dlp/extractor/porncom.py
yt_dlp/extractor/pornflip.py
yt_dlp/extractor/pornhd.py
yt_dlp/extractor/pornhub.py
yt_dlp/extractor/pornovoisines.py
yt_dlp/extractor/projectveritas.py
yt_dlp/extractor/prosiebensat1.py
yt_dlp/extractor/puhutv.py
yt_dlp/extractor/qqmusic.py
yt_dlp/extractor/r7.py
yt_dlp/extractor/radiko.py
yt_dlp/extractor/radiocanada.py
yt_dlp/extractor/radiode.py
yt_dlp/extractor/radiofrance.py
yt_dlp/extractor/radiojavan.py
yt_dlp/extractor/radlive.py
yt_dlp/extractor/rai.py
yt_dlp/extractor/rcs.py
yt_dlp/extractor/rcti.py
yt_dlp/extractor/redbee.py
yt_dlp/extractor/redbulltv.py
yt_dlp/extractor/reddit.py
yt_dlp/extractor/redgifs.py
yt_dlp/extractor/redtube.py
yt_dlp/extractor/rentv.py
yt_dlp/extractor/restudy.py
yt_dlp/extractor/reuters.py
yt_dlp/extractor/rice.py
yt_dlp/extractor/rockstargames.py
yt_dlp/extractor/rokfin.py
yt_dlp/extractor/roosterteeth.py
yt_dlp/extractor/rte.py
yt_dlp/extractor/rtl2.py
yt_dlp/extractor/rtlnl.py
yt_dlp/extractor/rts.py
yt_dlp/extractor/rtve.py
yt_dlp/extractor/rtvnh.py
yt_dlp/extractor/rtvs.py
yt_dlp/extractor/rtvslo.py
yt_dlp/extractor/rule34video.py
yt_dlp/extractor/rumble.py
yt_dlp/extractor/rutube.py
yt_dlp/extractor/rutv.py
yt_dlp/extractor/ruutu.py
yt_dlp/extractor/sapo.py
yt_dlp/extractor/screen9.py
yt_dlp/extractor/scrolller.py
yt_dlp/extractor/senategov.py
yt_dlp/extractor/sendtonews.py
yt_dlp/extractor/servus.py
yt_dlp/extractor/sexu.py
yt_dlp/extractor/seznamzpravy.py
yt_dlp/extractor/shahid.py
yt_dlp/extractor/shemaroome.py
yt_dlp/extractor/showroomlive.py
yt_dlp/extractor/sina.py
yt_dlp/extractor/sixplay.py
yt_dlp/extractor/skyit.py
yt_dlp/extractor/slideslive.py
yt_dlp/extractor/sohu.py
yt_dlp/extractor/sonyliv.py
yt_dlp/extractor/soundcloud.py
yt_dlp/extractor/sovietscloset.py
yt_dlp/extractor/spankbang.py
yt_dlp/extractor/spankwire.py
yt_dlp/extractor/sport5.py
yt_dlp/extractor/sportbox.py
yt_dlp/extractor/springboardplatform.py
yt_dlp/extractor/srgssr.py
yt_dlp/extractor/startrek.py
yt_dlp/extractor/steam.py
yt_dlp/extractor/streamable.py
yt_dlp/extractor/streamanity.py
yt_dlp/extractor/streamcz.py
yt_dlp/extractor/stripchat.py
yt_dlp/extractor/substack.py
yt_dlp/extractor/sunporno.py
yt_dlp/extractor/sverigesradio.py
yt_dlp/extractor/svt.py
yt_dlp/extractor/swrmediathek.py
yt_dlp/extractor/tagesschau.py
yt_dlp/extractor/tass.py
yt_dlp/extractor/teachertube.py
yt_dlp/extractor/teamcoco.py
yt_dlp/extractor/ted.py
yt_dlp/extractor/tele13.py
yt_dlp/extractor/telebruxelles.py
yt_dlp/extractor/telecinco.py
yt_dlp/extractor/telegraaf.py
yt_dlp/extractor/telegram.py
yt_dlp/extractor/telemb.py
yt_dlp/extractor/telemundo.py
yt_dlp/extractor/tencent.py
yt_dlp/extractor/tennistv.py
yt_dlp/extractor/tenplay.py
yt_dlp/extractor/theholetv.py
yt_dlp/extractor/theplatform.py
yt_dlp/extractor/theta.py
yt_dlp/extractor/theweatherchannel.py
yt_dlp/extractor/threeqsdn.py
yt_dlp/extractor/threespeak.py
yt_dlp/extractor/tiktok.py
yt_dlp/extractor/tnaflix.py
yt_dlp/extractor/toggle.py
yt_dlp/extractor/tokentube.py
yt_dlp/extractor/triller.py
yt_dlp/extractor/trovo.py
yt_dlp/extractor/tubetugraz.py
yt_dlp/extractor/tubitv.py
yt_dlp/extractor/tumblr.py
yt_dlp/extractor/tunein.py
yt_dlp/extractor/tunepk.py
yt_dlp/extractor/turbo.py
yt_dlp/extractor/turner.py
yt_dlp/extractor/tv2.py
yt_dlp/extractor/tv24ua.py
yt_dlp/extractor/tv2dk.py
yt_dlp/extractor/tv2hu.py
yt_dlp/extractor/tv4.py
yt_dlp/extractor/tv5mondeplus.py
yt_dlp/extractor/tvc.py
yt_dlp/extractor/tvigle.py
yt_dlp/extractor/tvn24.py
yt_dlp/extractor/tvnet.py
yt_dlp/extractor/tvnow.py
yt_dlp/extractor/tvopengr.py
yt_dlp/extractor/tvp.py
yt_dlp/extractor/tvplay.py
yt_dlp/extractor/tvplayer.py
yt_dlp/extractor/tweakers.py
yt_dlp/extractor/twentymin.py
yt_dlp/extractor/twitcasting.py
yt_dlp/extractor/twitch.py
yt_dlp/extractor/twitter.py
yt_dlp/extractor/udemy.py
yt_dlp/extractor/udn.py
yt_dlp/extractor/umg.py
yt_dlp/extractor/unistra.py
yt_dlp/extractor/uol.py
yt_dlp/extractor/uplynk.py
yt_dlp/extractor/urort.py
yt_dlp/extractor/urplay.py
yt_dlp/extractor/ustream.py
yt_dlp/extractor/ustudio.py
yt_dlp/extractor/utreon.py
yt_dlp/extractor/veo.py
yt_dlp/extractor/veoh.py
yt_dlp/extractor/vevo.py
yt_dlp/extractor/vgtv.py
yt_dlp/extractor/vice.py
yt_dlp/extractor/viddler.py
yt_dlp/extractor/videa.py
yt_dlp/extractor/videocampus_sachsen.py
yt_dlp/extractor/videomore.py
yt_dlp/extractor/videopress.py
yt_dlp/extractor/vidio.py
yt_dlp/extractor/vidlii.py
yt_dlp/extractor/viewlift.py
yt_dlp/extractor/viidea.py
yt_dlp/extractor/viki.py
yt_dlp/extractor/vimeo.py
yt_dlp/extractor/vimm.py
yt_dlp/extractor/vimple.py
yt_dlp/extractor/vine.py
yt_dlp/extractor/viqeo.py
yt_dlp/extractor/viu.py
yt_dlp/extractor/vk.py
yt_dlp/extractor/vlive.py
yt_dlp/extractor/vodplatform.py
yt_dlp/extractor/voicerepublic.py
yt_dlp/extractor/voicy.py
yt_dlp/extractor/voot.py
yt_dlp/extractor/voxmedia.py
yt_dlp/extractor/vrv.py
yt_dlp/extractor/vshare.py
yt_dlp/extractor/vvvvid.py
yt_dlp/extractor/vzaar.py
yt_dlp/extractor/walla.py
yt_dlp/extractor/wasdtv.py
yt_dlp/extractor/wat.py
yt_dlp/extractor/watchbox.py
yt_dlp/extractor/wdr.py
yt_dlp/extractor/webcaster.py
yt_dlp/extractor/webofstories.py
yt_dlp/extractor/weibo.py
yt_dlp/extractor/whowatch.py
yt_dlp/extractor/willow.py
yt_dlp/extractor/wimtv.py
yt_dlp/extractor/wistia.py
yt_dlp/extractor/wppilot.py
yt_dlp/extractor/wsj.py
yt_dlp/extractor/xfileshare.py
yt_dlp/extractor/xhamster.py
yt_dlp/extractor/xinpianchang.py
yt_dlp/extractor/xnxx.py
yt_dlp/extractor/xstream.py
yt_dlp/extractor/xtube.py
yt_dlp/extractor/xuite.py
yt_dlp/extractor/xvideos.py
yt_dlp/extractor/yahoo.py
yt_dlp/extractor/yandexdisk.py
yt_dlp/extractor/yandexvideo.py
yt_dlp/extractor/yapfiles.py
yt_dlp/extractor/yinyuetai.py
yt_dlp/extractor/ynet.py
yt_dlp/extractor/youku.py
yt_dlp/extractor/youporn.py
yt_dlp/extractor/youtube.py
yt_dlp/extractor/zapiks.py
yt_dlp/extractor/zattoo.py
yt_dlp/extractor/zdf.py
yt_dlp/extractor/zee5.py
yt_dlp/extractor/zeenews.py
yt_dlp/extractor/zhihu.py
yt_dlp/extractor/zingmp3.py
yt_dlp/extractor/zoom.py
yt_dlp/extractor/zype.py

index 016a2ac7f86a44551dddd22c83c4b006292a877f..683ead315dc14d482928f85cf4c3eda42878502f 100644 (file)
@@ -41,7 +41,9 @@ def do_GET(self):
 
 
 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):
index 60e457108433faf63d71186dda821c420520f2f4..8da1e5e4b27ce4cdbc9e7d6b7d4fc6073ac0c3b2 100644 (file)
@@ -68,8 +68,7 @@ def test_prefer_free_formats(self):
             {'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 @@ def test_prefer_free_formats(self):
             {'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 @@ def test_prefer_free_formats(self):
             {'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 @@ def test_prefer_free_formats(self):
             {'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 @@ def test_format_selection_audio_exts(self):
 
         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 @@ def format_info(f_id):
 
         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 @@ def format_info(f_id):
 
         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 @@ def format_info(f_id):
         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 @@ def test_format_filtering(self):
         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)
index 03f10ab23d6c218a6ba256772bb076c1a8855742..0ca76b85a8d4ff3cbb85ba3994f270f967c441e6 100644 (file)
@@ -155,8 +155,6 @@ def _real_extract(self, url):
                 'format_id': format_id
             })
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': self._og_search_title(webpage),
@@ -221,7 +219,6 @@ def tokenize_url(url, token):
                 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')
index 44a9f8ca5e0db545accc65458170b3b099d8cdbb..6dca19de418029a7dae9db20066e620e5bddacf3 100644 (file)
@@ -78,7 +78,6 @@ def _real_extract(self, url):
                 'url': mp4_url,
                 'width': 640,
             })
-        self._sort_formats(formats)
 
         image = video.get('image') or {}
 
@@ -119,7 +118,6 @@ def _real_extract(self, url):
         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,
index 9ec259a75fb2747718b6f61317deaeab81ff9527..dc5792944559f5096c9a3116d0e2022bb43955e7 100644 (file)
@@ -27,7 +27,6 @@ def _extract_metadata(self, video_id, video_info):
                     **parse_codecs(video.get('codecs', ''))
                 })
 
-        self._sort_formats(formats)
         return {
             'id': video_id,
             'formats': formats,
index 16f648de3eb51c7916f454603abe422be934ff75..e0c18c8773604560cfefcd08b0f69144bd154fce 100644 (file)
@@ -235,7 +235,6 @@ def _real_extract(self, url):
                     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,
index d8e07b3a176c4d6d5dd63bac0e09ed2b730d0268..d1525a1af2d5e82d44bace8ab9ed29e57610951b 100644 (file)
@@ -70,7 +70,6 @@ def _parse_video_data(self, video_data):
                     })
                     s3_extracted = True
             formats.append(f)
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
@@ -269,7 +268,6 @@ def _real_extract(self, url):
                 '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
index 1368954bc60e065630359696cf32a7b91d3495c4..bd29eb43e5985665b4406f26b09e7b956d6c4176 100644 (file)
@@ -180,7 +180,6 @@ def _real_extract(self, url):
                         info['subtitles'].setdefault('en', []).append({
                             'url': asset_url,
                         })
-            self._sort_formats(info['formats'])
 
             return info
         else:
index 094c57bf928e4993a8c52dc21dc42fceaa91887c..d7c401016c271dc60220c75a08e4bc04eca898ef 100644 (file)
@@ -62,7 +62,6 @@ def _extract_aen_smil(self, smil_url, video_id, auth=None):
             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,
index bfcc0803080fc67b87abcee0e50dcf17e85f91a9..9276fe7997828f2f3f3f1e85110e9ad351ee5c3a 100644 (file)
@@ -338,7 +338,6 @@ def _real_extract(self, url):
                     }]
                 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 @@ def _real_extract(self, url):
                     '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,
index 714414bd4137427472c0dbfee5914142b3d10f92..abb2d3ff27e3fd1b15cdca3517a11baf25637b60 100644 (file)
@@ -55,7 +55,6 @@ def _real_extract(self, url):
         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 @@ def _real_extract(self, url):
                     'acodec': ext,
                 })
 
-        self._sort_formats(formats)
         return {
             'id': media_id,
             'formats': formats,
index 1f881e2a098a7e051d99aaffd7e2c4a0948869cc..2d342cf03909fa7692b74b9b23f4e0027d05387f 100644 (file)
@@ -112,8 +112,6 @@ def _real_extract(self, url):
                 })
             duration, view_count, timestamp = [None] * 3
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'display_id': display_id,
index d16ab496e9518263af978b9e973c6108cc789c83..ea3332e3d5cc0aa640ce47fb9de7786b3750db3e 100644 (file)
@@ -22,7 +22,6 @@ def _extract_video(self, video_id, url=None):
                 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))
index ae7115f9f1a54a5bbfd51bc4c4c01e07fe056704..bfe066bc68515cf1b6c4ec0a72a973e77bc378d2 100644 (file)
@@ -63,8 +63,6 @@ def _real_extract(self, url):
                             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,
index 9369a66f7a9d4cb55100cdd751707f7af8425077..c58bc7bfbf8ffbfe5e362e27d43a90e0a712f645 100644 (file)
@@ -106,7 +106,6 @@ def _real_extract(self, url):
         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')]
index 6015baad55e5b1dc6542fd29a840d547354ad8e6..b0cbd775c02a6274c3866ee0405569472951b802 100644 (file)
@@ -84,8 +84,6 @@ def get_media_node(name, default=None):
                     'ext': ext,
                 })
 
-        self._sort_formats(formats)
-
         timestamp = unified_timestamp(item.get('pubDate'), ' ') or parse_iso8601(item.get('dc-date'))
 
         return {
index fac476e21a4ba7a222b5ef0d536558139df5853a..7b384b22d07b372029c9cd4dc01e0d0992cf5f67 100644 (file)
@@ -19,7 +19,6 @@ def _download_and_extract_api_data(self, video_id, netloc, cid=None):
             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 {
index 0d7575a1f52e49df452f01a5aba5b52043c0b704..79bfe412b2254fc17ef0ced3889e4974d6a8d780 100644 (file)
@@ -354,8 +354,6 @@ def _get_anvato_videos(self, access_key, video_id, token):
                 })
             formats.append(a_format)
 
-        self._sort_formats(formats)
-
         subtitles = {}
         for caption in video_data.get('captions', []):
             a_caption = {
index 5200f9d9d235d3df80fccfc93580de86835aba7d..6949ca9740349d76f57f2675d0662835c4981ba4 100644 (file)
@@ -119,7 +119,6 @@ def _real_extract(self, url):
                         'height': int_or_none(qs.get('h', [None])[0]),
                     })
                 formats.append(f)
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index c9147e855a365840e814b9779da22f5e5affd7cb..1ea0b1de45c9b0978a628815a4579998e0aa3036 100644 (file)
@@ -72,7 +72,6 @@ def extract(field, name=None):
                     'format_id': format_id,
                     'height': height,
                 })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 90464556dbb41757649de545828c479de6b25063..4a989d837b86da097e059ba6c3797cb354ece0dd 100644 (file)
@@ -73,7 +73,6 @@ def _real_extract(self, url):
                             r'(\d+)[pP]', label or '', 'height',
                             default=None)),
                     })
-        self._sort_formats(formats)
 
         info = self._search_json_ld(webpage, video_id, default={})
 
index 6b63f070d6ac23b1406072934230136eb27cd3e2..2e0b0a8c932b5690ea12e13249febd9251e729fd 100644 (file)
@@ -120,7 +120,6 @@ def _real_extract(self, url):
                             '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 @@ def _clean_json(m):
                     'height': int_or_none(format['height']),
                 })
 
-            self._sort_formats(formats)
-
             playlist.append({
                 '_type': 'video',
                 'id': video_id,
index 4218f52d68169641d350997b2ab6bf3271dc545c..90dda9f53f99533944c8a54b224d98466ea3d0eb 100644 (file)
@@ -312,7 +312,7 @@ def _real_extract(self, url):
                 })
 
         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
index de9ccc538304ed52c122b09e386e4c81ede9c3f5..febd3d28a5850fe899fe951661edd6242ec7968d 100644 (file)
@@ -144,7 +144,6 @@ def _real_extract(self, url):
                     'url': s_url,
                     'quality': -10,
                 })
-        self._sort_formats(formats)
 
         subtitles = {}
         for subtitle in (try_get(video, lambda x: x['subtitles']['urls'], list) or []):
index f294679effbe0321d455ab0ee0e45eaae171235c..0a8a8746abcdec300bd6e719a62f0b688f03340f 100644 (file)
@@ -40,8 +40,6 @@ def _parse_media_info(self, media_info, video_id, fsk):
                     '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 @@ def _real_extract(self, url):
                     'format_id': fid,
                     'url': furl,
                 })
-            self._sort_formats(formats)
             info = {
                 'formats': formats,
             }
@@ -371,7 +368,6 @@ def _real_extract(self, url):
                     continue
                 f['url'] = format_url
             formats.append(f)
-        self._sort_formats(formats)
 
         _SUB_FORMATS = (
             ('./dataTimedText', 'ttml'),
index 9a0273e2c32d79d06fa036332c43d80e259e49e4..de36ec8868bbd6614af9cd6328508376e7064663 100644 (file)
@@ -136,7 +136,6 @@ def _real_extract(self, url):
                         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,
index c80ce223377810053c8792f937720035dc22acd0..a493714d1fb2f3108255a7629d49ce5d4c6e36a5 100644 (file)
@@ -73,7 +73,6 @@ def _real_extract(self, url):
                 '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')
index b60fa0233e0ae319ba62b842ee769442e7c921b1..54e4d2d0ced9bd231dfe6820632e63071595305d 100644 (file)
@@ -186,7 +186,6 @@ def _real_extract(self, url):
 
         formats.extend(secondary_formats)
         self._remove_duplicate_formats(formats)
-        self._sort_formats(formats)
 
         metadata = config['data']['attributes']['metadata']
 
index 39d1f1cc5656ebb586d4526e441f43aa400068e3..a20e7f9889d4925b80cefd014fb9091e8940709e 100644 (file)
@@ -84,7 +84,6 @@ def _real_extract(self, url):
             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 {}
index 2311837e91036f5524410ffca9a59b3faf45c458..d6ed9e49586f5f02e64b0c20cdd5596b9a6a007d 100644 (file)
@@ -49,7 +49,6 @@ def _extract_video_info(self, url, content, video):
                     'url': source_url,
                     'format_id': protocol,
                 })
-        self._sort_formats(formats)
 
         return {
             'id': clip_id,
index c1c4f67d0a903e4229fae9ace831ba19b7da0f8a..35114e54556896041697b9b519b28071db22ff0f 100644 (file)
@@ -76,7 +76,6 @@ def _real_extract(self, url):
                         'format_id': 'http-%s' % bitrate,
                     })
                 formats.append(f)
-            self._sort_formats(formats)
 
             return {
                 'id': video_id,
index 92f567c5db0f9a1de086441d51bf6723cfa54f4a..c87342565600456f80c33b13dddd43fcffde2f5d 100644 (file)
@@ -80,8 +80,6 @@ def _real_extract(self, url):
             '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'),
index 7dcace2c6894631343165e039304bacee79c5b22..de81e0de7b00631ed8c60a01866ed1173159572e 100644 (file)
@@ -184,8 +184,6 @@ def _real_extract(self, url):
                             '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 @@ def _real_extract(self, url):
                 'ext': ext,
                 'vcodec': 'none',
             })
-        self._sort_formats(formats)
 
         title = show.get('audio_title') or 'Bandcamp Weekly'
         subtitle = show.get('subtitle')
index ec9bdd8cad94f9675235396974bffa08b2f0e1f9..51e7220578bc6a8cf2d2050d24d7124321a82995 100644 (file)
@@ -135,7 +135,6 @@ def _real_extract(self, url):
             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,
index 35a7a165caa81e99425a1b38fd82630e5e847cdd..9d28e70a3aa501947104eef4d01958aecac297a8 100644 (file)
@@ -575,8 +575,6 @@ def _real_extract(self, url):
         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 @@ def _extract_from_media_meta(self, media_meta, video_id):
     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 @@ def _real_extract(self, url):
                             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 @@ def _real_extract(self, url):
                                         continue
                                     raise
                             if entry:
-                                self._sort_formats(entry['formats'])
                                 entries.append(entry)
 
         if entries:
@@ -1015,7 +1010,6 @@ def _real_extract(self, url):
 
         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 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
                     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 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
                     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 @@ def parse_media(media):
                     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 @@ def extract_all(pattern):
             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:
index f71f1f30802fc7155f517414445cf1dadb679435..0aecbd089d33c7772cbdb1270abd9a1c18984f17 100644 (file)
@@ -74,7 +74,6 @@ def _real_extract(self, url):
                 fmt['abr'] = 96
                 fmt['asr'] = 44100
             formats.append(fmt)
-        self._sort_formats(formats)
 
         images = []
         for name, info in track['images'].items():
index 5957e370abcfca648fc371908bced8615f56e80a..52ee68eca716ed188e5b3afe79dae583499ae190 100644 (file)
@@ -76,8 +76,6 @@ def _real_extract(self, url):
                 f['height'] = height
             formats.extend(current_formats)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'display_id': first_fact.get('id'),
index 6b2797ca00a53618f869948fdda8d72ec4ee6867..02d1ba0e3f64ec0811b0a0ce818206a66679f764 100644 (file)
@@ -63,8 +63,6 @@ def decode_url(quoted_b64_url):
                     'url': decode_url(file_url),
                 })
 
-        self._sort_formats(formats)
-
         description = self._html_search_meta('description', webpage)
 
         return {
index 8a0e10da8046f25f8076925c20194f5eb8a13672..bc0424194fa214b5c51dcd7150a0c326fdf7bb6b 100644 (file)
@@ -67,7 +67,6 @@ def extract_formats(self, play_info):
             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 @@ def _get_formats(self, *, ep_id=None, aid=None):
                 '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 @@ def _real_extract(self, url):
             })
             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,
index 3a423449165e03cb306282d1864b260b5ad681cc..027753503b7d6fad9c3f4c3c7c77ce6c743a9c9b 100644 (file)
@@ -86,7 +86,6 @@ def _real_extract(self, url):
                     'height': int_or_none(height),
                     'ext': ext,
                 })
-        self._sort_formats(formats)
 
         thumbnails = []
         for k, v in item.items():
index 9e3d6337a724a4f80061bfca043c91d64cace47f..10e7b0b2bb53b3eacb93671063381331596bacd6 100644 (file)
@@ -117,7 +117,6 @@ def _real_extract(self, url):
             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,
index bd8eac1f13ae034aa2ab7998560f6b560d088cf6..a82cd263a796a883c17bd7e57f331ff27320e853 100644 (file)
@@ -45,7 +45,6 @@ def _real_extract(self, url):
         formats = self._extract_m3u8_formats(
             channel['data']['url'], username,
             'mp4')
-        self._sort_formats(formats)
 
         return {
             'id': username,
index c842c342ca659fc239c9e9f69fb84a68e4bc3c54..792155e51ac3e6be660207240e2b70861e860ca1 100644 (file)
@@ -67,7 +67,6 @@ def _real_extract(self, url):
             else:
                 formats.extend(self._extract_f4m_formats(
                     stream_url, video_id, f4m_id='hds', fatal=False))
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 0c081750e4b97866f667fa05b90d4dac3ffa8f82..ca326f25fad52066e9d6f4001ff7669c0674ef69 100644 (file)
@@ -21,8 +21,6 @@ def _extract_bokecc_formats(self, webpage, video_id, format_id=None):
             'quality': int(quality.attrib['value']),
         } for quality in info_xml.findall('./video/quality')]
 
-        self._sort_formats(formats)
-
         return formats
 
 
index 9ba166b043b33946863dd13f2e7b64a1beda02ea..bf955668dfb0654371403b0f4e92e4339561be16 100644 (file)
@@ -57,7 +57,6 @@ def _real_extract(self, url):
         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,
index 8c94714be07f69eb47f571941e8ed089b7861428..5c55f2c765857983acd226eb339edfaf87b4b79c 100644 (file)
@@ -67,7 +67,6 @@ def _real_extract(self, url):
                 'height': video_data.get('resolution'),
                 'preference': -10,
             }))
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 5842de88a8dd85d5229b25100a985b265f6b5d45..8ab149626bdb8b9d467bcf17bfb661e46cf994d2 100644 (file)
@@ -79,8 +79,6 @@ def _real_extract(self, url):
                 'url': update_url_query(authenticated_download_url, query),
             })
 
-        self._sort_formats(formats)
-
         creator = f.get('created_by') or {}
 
         return {
index 388f1f94fbf3e64076396565fc5590be45d64fae..f28e581b87bc63a554aa5c38da98dc70413c7702 100644 (file)
@@ -48,8 +48,6 @@ def _real_extract(self, url):
                 'format_id': '%s-%s' % (quality, determine_ext(video_url)),
             })
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'formats': formats,
index faac442e89a0527d229f02b25e3749fe373630cb..309452d23ec7a752d912ce1478b519b8c9c33720 100644 (file)
@@ -157,7 +157,6 @@ def _extract_formats(self, assets, media_id):
                         '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 @@ def _real_extract(self, url):
                     'tbr': tbr,
                     'filesize': int_or_none(node.get('fileSize')),
                 })
-        self._sort_formats(formats)
 
         subtitles = {}
         for edge in clip.get('captionFiles', {}).get('edges', []):
index 51c8c822fa2a9b02117ebe1e8934f2df6761bc85..00cf308c7a02e696ff0a50d7d0379d9c432b5989 100644 (file)
@@ -63,7 +63,6 @@ def _real_extract(self, url):
                 'format_id': 'http-%d' % bitrate if bitrate else 'http',
                 'tbr': bitrate,
             })
-        self._sort_formats(formats)
 
         title = self._search_regex(
             (r'title["\']\s*:\s*(["\'])(?P<value>(?:(?!\1).)+)\1',
index ca5757374d6a3f308af8f09e2c84c837aaf81480..ea0a59c8668e54d141e89798f4a1cd5e2dc21b73 100644 (file)
@@ -24,7 +24,6 @@ def _real_extract(self, url):
         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),
index 99a216fb49818dfd74010a3bf23551201bac1b13..35e1aa9c9dac6f95f0d2c47b4e8101b54fdf4d10 100644 (file)
@@ -546,8 +546,6 @@ def build_format_id(kind):
                 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)
 
index eca2e294e7919029789956e4730a61c3b0341570..9ed6efe799475fe3edead12ea3d10b077e18e126 100644 (file)
@@ -108,7 +108,6 @@ def _real_extract(self, url):
                 'thumbnail': ep.get('imageThumbnail'),
                 'duration': parse_duration(ep.get('length')),
             })
-        self._sort_formats(formats)
 
         return merge_dicts(info, {
             'id': video_id,
index 1d98ea5983b53600a336629fc18be917e2e8ea55..e4b1c9a84c30ff57976107876f3bc71e952d397f 100644 (file)
@@ -49,7 +49,6 @@ def _real_extract(self, url):
                 'url': f['url']
             } for f in info['rfiles']
         ]
-        self._sort_formats(formats)
 
         return {
             'id': info['vid'],
index 3200b56771116a7e312da001a3e3821da11dffdb..2e374e5eba0f5521a28ea6b4336325b7238b1ae2 100644 (file)
@@ -22,7 +22,6 @@ def _real_extract(self, url):
         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,
index 6c8129f0658149d627520ddd2ffb093815de456f..e9668763ef48f739be774e1384f3b26e6e0ed980 100644 (file)
@@ -54,7 +54,6 @@ def _real_extract(self, url):
         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'))
index e52dfb17064228ed7092c1f37c41885a68e46a1e..f4a4a834b8ec3b2f3ce1f69e8dc9c4d4c509574c 100644 (file)
@@ -27,7 +27,6 @@ def _real_extract(self, url):
         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,
index 4256b28e08af050ae844bb47d51ff18fbcc95ff0..2650cc1ef13594d32f3cc98b2e3c232a54b59aae 100644 (file)
@@ -20,7 +20,6 @@ def _real_extract(self, url):
         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,
index 32fbffcc2c88ab3166754b9d096008ebce089503..0509057fc6f5cd8432a61c6370e295da1e4322ca 100644 (file)
@@ -84,7 +84,6 @@ def _real_extract(self, url):
                 else:
                     continue
                 formats.append(f)
-        self._sort_formats(formats)
 
         return {
             'id': user_id,
index 1b47b0584a24b19e0e6b5befad4781fa821f2810..021cd916f3950d61c01b3bbf0b9bfe008966e3d7 100644 (file)
@@ -47,8 +47,6 @@ def _real_extract(self, url):
         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),
index f2ec9355f4447024e245212308f106e310b0d89a..df5ca5818779313b8535485b43b2dd555b706c01 100644 (file)
@@ -82,7 +82,6 @@ def _real_extract(self, url):
             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(),
index c9bb94c402e0a33774080278b91736412febe9d5..597cb2a6b0ecb931729fef3239452ad9d50cbb5b 100644 (file)
@@ -58,8 +58,6 @@ def _real_extract(self, url):
         else:
             info = self._parse_html5_media_entries(url, webpage, url)[0]
 
-        self._sort_formats(info['formats'])
-
         info.update({
             'id': video_id,
             'title': title,
index b184398e2d94b4463ac1cd141ce74cfcb7429d6b..b7e2f9dd4622c8ccd6f8323e6bcbf22715ddffea 100644 (file)
@@ -86,7 +86,6 @@ def _real_extract(self, url):
                     'format_id': format_id,
                     'quality': preference(format_id),
                 })
-        self._sort_formats(formats)
 
         thumbnails = [{
             'id': image_id,
index 8eff4a57c15ff0da25beecd02c8f360cf09dda88..ae6e03a4d5cf4bcdb44efc5327a86c397da69ae5 100644 (file)
@@ -118,7 +118,6 @@ def _real_extract(self, url):
                     'format_id': format_type,
                     'url': format_url,
                 })
-        self._sort_formats(formats)
 
         subtitle_urls = data.get('subtitleUrls')
         if isinstance(subtitle_urls, list):
index 087ea8aa084ab9acec715f17c4d1df5612ebbae5..d6044a3193aebcbac3964c184616467512ea34ae 100644 (file)
@@ -43,7 +43,6 @@ def _real_extract(self, url):
             '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(
index 999b7bc53ae31774b6369997817f0d7883cc6052..210f5f8eea4cc14c341380832d823877d9c72a39 100644 (file)
@@ -380,8 +380,6 @@ def _real_extract(self, url):
                 if 'descriptive' in format['format_id'].lower():
                     format['preference'] = -2
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': video_info['title'],
index 9515806edaf9520549e3a42475cfe0092edc9ca1..9aacd50c4565fe75bc43437dc695e96a3fb41ae5 100644 (file)
@@ -52,7 +52,6 @@ def _extract_common_video_info(self, content_id, asset_types, mpx_acc, extra_inf
             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,
index 98ec28df0063dcd64bcb4d5346c926e3717e9c99..16edf3af86858c5325ac3a70bf4b063a26f7c8cb 100644 (file)
@@ -132,7 +132,6 @@ def _real_extract(self, url):
             })
 
         formats = self._extract_akamai_formats(video_info['url'], display_id)
-        self._sort_formats(formats)
 
         return {
             'id': display_id,
index 56a25514976cdcfa2696d67345f45ae3ce687ef3..b5d85af12ba38fac25d1e3b16fbe086505cdf73d 100644 (file)
@@ -40,7 +40,6 @@ def _real_extract(self, url):
         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
index 1bc0f07f22ee6c1f72597ab012da52b5dfd0c3de..22e3a22ecefbb9ae86db6c47029cf85d451a802f 100644 (file)
@@ -64,7 +64,6 @@ def _real_extract(self, url):
                 'language': language,
                 'vcodec': vcodec,
             })
-        self._sort_formats(formats)
 
         return {
             'id': event_id,
index ca739f8a14e8c381ad5364d2bef6d52a3e28990d..88ff82f6e6b2735b9d966a0c5b3ba8f89074fa67 100644 (file)
@@ -81,7 +81,6 @@ def _real_extract(self, url):
                 'url': media_url,
                 'vcodec': 'none' if media_type == 'audio' else None,
             })
-        self._sort_formats(formats)
 
         informacio = media['informacio']
         title = informacio['titol']
index 623cbb3420a866c403eee6adcbad6a62f5fdfa18..466bdfb7cc635e0b0e08beecd598a2318d80c12e 100644 (file)
@@ -170,8 +170,6 @@ def _real_extract(self, url):
                 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)
index 2a12b054be290dea9d1e7f09dacac97eca487680..d1212e686acfe1f137fbd9fd01c0697ea60595b9 100644 (file)
@@ -151,8 +151,6 @@ def _api_extract(self, video_id):
             '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 @@ def extract_format(page, version):
 
             extract_format(webpage, resolution)
 
-        self._sort_formats(formats)
-
         return merge_dicts(info_dict, info)
index 64a30d7e317378a78ce5d40b92ab0a32673dcb82..9896a31afe5df1ae5362622c7b3ce8307b9d4e3f 100644 (file)
@@ -50,7 +50,6 @@ def _real_extract(self, url):
             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),
index 5f4c447f2c3c08dc31770b812b68de30c3d41ee4..be2b0bb4333c8ddad6afa51364d1954b08c28927 100644 (file)
@@ -249,9 +249,6 @@ def _real_extract(self, url):
                     '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)
index d0390d93716ef7a8628a0e7e1c937893c6221c2a..a88474060a745f9b9b788e8a7e839f8f15b58d3a 100644 (file)
@@ -185,7 +185,6 @@ def quality(quality_id, format_url):
             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', []):
index 27f8b33e54f70ee77052b91ad9fc5bf690279cae..8fe6797c6ac42313c61099a14b26f16e3cb02d22 100644 (file)
@@ -38,8 +38,6 @@ def _real_extract(self, url):
         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({
index d39210bf742b75ad57afe44d986dc1f6f1548ea5..99dfcfdebb960f2b0b265288dcc38aa8d138f2fa 100644 (file)
@@ -95,7 +95,6 @@ def _real_extract(self, url):
                 # 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,
index e54d92a86a4df8241d3e797f69c5697d8cc2e3bf..48091dd654192820b440d19c504bce7923f65ab6 100644 (file)
@@ -32,7 +32,6 @@ def _get_post(self, id, post_data):
                 '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)
index ff962aad17dbbf2aa28b046fd4c26ed74992a67f..7a7ea8b228b7e2eaf87645e9fbed766c08b8eb4f 100644 (file)
@@ -47,7 +47,6 @@ def _real_extract(self, url):
                 'format_id': 'backup',
                 'url': backup_url,
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index e1aae9bda6de12ec82fd3cfdd937957342167be4..44595d854c410a2fe10ac2bc44d68017201e6df9 100644 (file)
@@ -72,7 +72,6 @@ def _real_extract(self, url):
                     'vcodec': 'none',
                     'acodec': 'mp3',
                 })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 7e5fd317507e0c304f52c81ea57f95ef4abdba9d..2b907dc804e29bd3a4a82c17872c0e5837658924 100644 (file)
@@ -62,7 +62,6 @@ def _real_extract(self, url):
                 '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*'([^']+)';",
index 8bc0ad883d705f4e62a1f204c6494727d64fdba5..748e8e9087c232a8aa6f96bec1059dcf5106c6ca 100644 (file)
@@ -51,7 +51,6 @@ def _real_extract(self, url):
             '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,
index ce86212965fdac5269dc13f8269a89edbfc970e4..403e44aafd248dcc71ecc4cd2457e1968e517cfd 100644 (file)
@@ -42,7 +42,6 @@ def _real_extract(self, url):
             'url': src['src'],
             'quality': quality_order(src['streamQuality']),
         } for src in sources]
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index c64726ca278ff45e1042ec6db5fd2d336a504ff8..0aaf73d18d8113dd0ded085eb55ff08975ec1eb6 100644 (file)
@@ -60,7 +60,6 @@ def _real_extract(self, url):
                         'format_id': format_id,
                         'vcodec': 'none',
                     })
-        self._sort_formats(formats)
 
         title = metadata['Title']
         description = metadata.get('Description')
index 3701fe6b3f6b1944dc5c56de027dd0f02874b30c..c2b9970ec880012b8afca0e9a0bccd309acbde5d 100644 (file)
@@ -1699,7 +1699,14 @@ def __init__(ie, *args, **kwargs):
         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 @@ def _parse_xspf(self, xspf_doc, playlist_id, xspf_url=None, xspf_base_url=None):
                     '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 @@ def _parse_jwplayer_data(self, jwplayer_data, video_id=None, require_title=True,
                     'url': formats[0]['url'],
                 })
             else:
-                self._sort_formats(formats)
                 entry['formats'] = formats
             entries.append(entry)
         if len(entries) == 1:
index ffdd820e2345d980c6c9f54147e8868a58af20ba..3170c2990ea8da18fdef27e726bf9457c35d626a 100644 (file)
@@ -197,7 +197,6 @@ def _extract_video(self, params):
                 'ext': ext,
                 'quality': 1 if quality == 'high' else 0,
             })
-        self._sort_formats(formats)
 
         subtitles = {}
         for t, caption in video_info.get('captions', {}).items():
index 50648a53687fa475e6a5f8473274453eb7e730ac..d69e81610bc02cbd8e90c61e2af537572ffef492 100644 (file)
@@ -69,8 +69,6 @@ def _real_extract(self, url):
                 'url': media_mp4_url,
             })
 
-        self._sort_formats(formats)
-
         subtitles = {}
         captions = m_details.get('captions') or {}
         for caption_url in captions.values():
index 8c920e3ab889cf80ebd9393289f180e9d39c6df3..c03d65310d2b9ca0924d6dc085390ff08e82560b 100644 (file)
@@ -126,7 +126,6 @@ def _real_extract(self, url):
                 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', []):
index b462acaf01705472deb1acdc7ed85f2c2d1644c9..9bab698a3d22f5c57f956cb1abe4e54ca96a4282 100644 (file)
@@ -104,8 +104,6 @@ def _real_extract(self, url):
                 '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'))
index 65ac2497f47a3620f76cd9259caa68b7c08492f3..0f23f2be2602692e6d2fc6561e9d614c65e14671 100644 (file)
@@ -54,8 +54,6 @@ def _real_extract(self, url):
                 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):
index 319374f3b81b0559cbef8ec86121b9af951b3767..46100151a932e1f78f20a757ce5bfa21f626149b 100644 (file)
@@ -177,7 +177,6 @@ def _real_extract(self, url):
                 })
         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(
index 85c145e12a41df41aa70d7a8848b0d73e6e7cfa9..4de7e3d53077c689b82207f4532cea05e025034b 100644 (file)
@@ -45,7 +45,6 @@ def _real_extract(self, url):
             '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,
index 75d90b5c55f64173199ff4e5ae194239ef104e86..d83c01560c9b4ad19e2d9fd60e0364cf64b7de11 100644 (file)
@@ -60,7 +60,6 @@ def _real_extract(self, url):
             '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'),
index 35752f1bdf82b7a7029a3aefebcefc91d79aa717..ee344ce8bea2e0830b3e66be3f86b5304578b7c6 100644 (file)
@@ -208,7 +208,6 @@ def _real_extract(self, url):
                     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,
index 1184633f530a6b8fdc4b410cf3344927afa2eb74..0075680e8f505e85478ff6d93a1dad629f1f1d31 100644 (file)
@@ -218,7 +218,6 @@ def get_text_attr(d, attr):
                     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': (
index a105b6ce2a27382b5bc0dd4ab3050cc33769a755..26cf24fbbd290ae85cfaaa950a0aed81b9478cd7 100644 (file)
@@ -117,7 +117,6 @@ def _real_extract(self, url):
                             'format_id': 'http',
                         })
                     formats.append(fmt)
-        self._sort_formats(formats)
 
         title = media['title']
 
index 0fe014f769c37a81d7f412b4002cc3c1bbd14265..551d5e3abebb15652ab3375193275415785a3cb1 100644 (file)
@@ -81,7 +81,6 @@ def _real_extract(self, url):
                     'height': int_or_none(height),
                     'ext': ext,
                 })
-            self._sort_formats(formats)
 
             return {
                 'id': video_id,
@@ -117,7 +116,6 @@ def _real_extract(self, url):
                     'height': int_or_none(height),
                     'ext': ext,
                 })
-        self._sort_formats(formats)
 
         thumbnails = []
         for k, v in item.items():
index f25d7a8c6d15bf70fe8e751498bbef06929ff4ad..43401e111568b3977c7f5afc492e1b458ed63520 100644 (file)
@@ -63,7 +63,6 @@ def _real_extract(self, url):
                 'protocol': protocol,
                 'ext': 'mp4' if is_hls else None,
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 65a9feec5bc039f11466ce9f11a9c4d68d4b239c..2a44718fb5951e260707294ffe5b808d457e0172 100644 (file)
@@ -293,7 +293,6 @@ def _real_extract(self, url):
             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 {}
index 1f27797ada64163da1c1ec6961446cd3b9f21728..f177c9d9cbd39e4ca58dcf5c6078a8679fd27f4b 100644 (file)
@@ -67,7 +67,6 @@ def _real_extract(self, url):
             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,
index 962d9741bf2c3019fffa20b02b1db1cf595bf06b..0e08e4f651445315aa7d9f43d9ad4cc992a00088 100644 (file)
@@ -36,7 +36,6 @@ def _real_extract(self, url):
         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,
index 4f59d904fc5bd231e6636eb1206ef4975745e3cf..ef3520a21c6e69d61f174f07ad4b9cc228799919 100644 (file)
@@ -36,7 +36,6 @@ def _real_extract(self, url):
                     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,
index bee1c7501ce242ba0beb1e40ef75db8514a29fa2..f61f12af02b20c4c9051e712506649950adb4e2f 100644 (file)
@@ -62,7 +62,6 @@ def _real_extract(self, url):
                 '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 @@ def _real_extract(self, url):
                 '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({
index af327e6c6b2f43ad712e5af084bde4b1b87634d0..1624d085c1feeb914fe2fb0dbf6e898fab89025a 100644 (file)
@@ -59,8 +59,6 @@ def _real_extract(self, url):
                 'vcodec': 'none' if key == 'audio' else None,
             })
 
-        self._sort_formats(formats)
-
         default_lang = 'en'
         subtitles = {}
 
index 7209e66118117570aabb38ff4922091450103ff0..f1480542469659a46d041f9c1507f39ce761cfbb 100644 (file)
@@ -146,7 +146,6 @@ def _extract_from_webpage(self, url, webpage):
             }
 
         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, {
index 5aca729889337c44cbdad28369be571311947c73..c4fb5c2a428949acbb9e5ece32d3f4ca6efb37b7 100644 (file)
@@ -41,7 +41,6 @@ def _real_extract(self, url):
                 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,
index 3813a51fe2c051ee38c58c2a2417a4cd9e7e228e..3461e36eb6cd6bc3dc7c384b015d066d0f399fd3 100644 (file)
@@ -88,7 +88,6 @@ def _entries(self, items, language, **kwargs):
             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,
index 5fbc42ffe9ef23c512fce4c508a34b9887c8d7f9..912e33ba7b1f3bed0eba19138856e9dbe5574837 100644 (file)
@@ -81,8 +81,6 @@ def _real_extract(self, url):
                 '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'))
index 7b4278c8820a538d4bc1d241b13b5664410dd021..1f3d8e31c53aa4cf5aee6e951806cfd6f1b13630 100644 (file)
@@ -50,7 +50,6 @@ def _extract_video_info(self, video, stream, display_id):
             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')
index f9af59a5710497819d071b69acb2370f780c1518..430de326f40a96e622b9d238aa209020f8138dbc 100644 (file)
@@ -134,7 +134,6 @@ def _real_extract(self, url):
             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', []):
index d4f3324e7cdc327d24f0ad05d10cb645a63dbe43..37f89b9bc08c30d385c141bd9b500242672ea38d 100644 (file)
@@ -117,7 +117,6 @@ def _real_extract(self, url):
         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,
index 31b4a568f298015a156e9a2a927d9d46aba22794..30fcf9fceff381c7a8d870d9ed10ece4625515db 100644 (file)
@@ -40,7 +40,6 @@ def _real_extract(self, url):
         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 @@ def _real_extract(self, url):
         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,
index 3f0b315a5762b92449b8cc2684e2198d027d90f1..8eb4d8ffa8a73862c6ffe1646912d788dafb45be 100644 (file)
@@ -126,7 +126,6 @@ def _get_disco_api_info(self, url, display_id, disco_host, realm, country, domai
                     'url': format_url,
                     'format_id': format_id,
                 })
-        self._sort_formats(formats)
 
         creator = series = None
         tags = []
index dca8c89d04416d667ef608da08e9b12ab4a617b1..824d70defbaafb7aabc196a13bdbc0a6e75abb2f 100644 (file)
@@ -30,7 +30,6 @@ def _real_extract(self, url):
         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(
index 54d97a25dc4d4aa0ae04ca977594029c621f1bba..214b309bfd98d4cd674a6984ef95dbfe7501b4e3 100644 (file)
@@ -63,7 +63,6 @@ def _real_extract(self, url):
             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,
index 824c2be120577afb46a830441737daef473dd614..e5dab6ac0d5df4a27045daaec4561676fcceccf6 100644 (file)
@@ -58,7 +58,6 @@ def _real_extract(self, url):
                     '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'))
index 708b72fae32b9f2ac63f3481058c05b501e00583..128f4391452d27fd614ecfb86966e49d15c54d06 100644 (file)
@@ -300,8 +300,6 @@ def decrypt_uri(e):
                 '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 @@ def _real_extract(self, url):
                         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,
index dc61115ff7a28a9c09d2f84a9b4cab0ce5261322..010c2d092db6521796c046d5088e2e698094ec7f 100644 (file)
@@ -48,7 +48,6 @@ def _real_extract(self, url):
                 'format_id': version,
                 'quality': quality(version),
             })
-        self._sort_formats(formats)
 
         thumbnails = []
         stills = item.get('stills') or {}
index 61d469f11c6544f16342ed1048daf284e43942e2..e67143370ba451d6f1f19d25d0dab5f2bb215dbd 100644 (file)
@@ -142,7 +142,6 @@ def _parse_video_metadata(self, js, video_id, timestamp):
                         'format_id': join_nonempty('http', ext, label),
                         'height': int_or_none(height),
                     })
-        self._sort_formats(formats)
 
         return {
             'id': data.get('mediaid') or video_id,
index ee2365ddd05dc098e94ad15b24a0548984fcbbf0..9c4a08e54f66d048e8c8a945b454afd930417e12 100644 (file)
@@ -62,7 +62,6 @@ def _real_extract(self, url):
                 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:
index 7e5047b560f8ae4808c3d69dea7076aff84deb0e..9ebd24d8088c07126739821fe16e418fa22b485e 100644 (file)
@@ -192,8 +192,6 @@ def _real_extract(self, url):
                 f['url'] = format_url
                 formats.append(f)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
index d5c954961f25c0b41401ff2f079a1d8ae54a6503..a4b2a12f684fabc660d4f12010223d7ba0dfb7c2 100644 (file)
@@ -117,7 +117,6 @@ def _real_extract(self, url):
                 formats.append({
                     'url': format_url,
                 })
-        self._sort_formats(formats)
 
         return {
             'id': lesson_id,
index 37be68c613a6030e2144a0d40b577a8ac11d89c7..53bc2535d0055ca076d9a478f1d729400db0af0a 100644 (file)
@@ -89,8 +89,6 @@ def _real_extract(self, url):
                 'url': mp4_url,
             })
 
-        self._sort_formats(formats)
-
         description = get_elements_by_class('synopsis', webpage)[0]
         thumbnail = self._html_search_regex(
             r'''<img[^>]+src=(["'])(?P<url>(?!\1).+?/moviecovers/(?!\1).+?)\1''',
index 01a47f6fde3a58e6f7d57120631646f46f5c4211..bd027da6b4d06c1cbc84c60646afcc0c1f99177a 100644 (file)
@@ -71,8 +71,6 @@ def _real_extract(self, url):
                 '%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'],
index bcd458cdf4c89265c54865f1b341cb553a068d44..6eb00f9c98cb9fea596819b8502a802d931a50ad 100644 (file)
@@ -28,7 +28,6 @@ def _extract_video(self, data, video_id):
                     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(
index f99e12250ea480ef5c412cb1b554c43933b2001d..c5558ffcd9efb6856fc544b97459ede5fe117b8b 100644 (file)
@@ -53,7 +53,6 @@ def _real_extract(self, url):
         else:
             formats, subtitles = [], {}
             self.raise_no_formats(f'Unknown streaming format {ext}')
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 89424785ecdb8abb5dfaded984f16e71feebc7c2..3bfcc5470cb4446645086f067954cc7f88290ddd 100644 (file)
@@ -59,7 +59,6 @@ def _real_extract(self, url):
         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', []):
index 6bc70c5c61dc8a67a66a98983e5010e63629228d..a2337979b845aef0ba5c0d52c20fa94ba8fcf7fb 100644 (file)
@@ -106,7 +106,6 @@ def calc_hash(s):
                         'height': height,
                         'fps': fps,
                     })
-        self._sort_formats(formats)
 
         json_ld = self._search_json_ld(webpage, display_id, default={})
 
index eb52ad0310ceb1cc2fee406527a21401a895c599..9ecdf5d3b7c92e3b1835c3656c0aef6f1447a79f 100644 (file)
@@ -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 @@ def _extract_formats_and_subs(self, video_id, allow_none=True):
                 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 @@ def _real_extract(self, url):
         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}'
index 5d9c46f72d232224b64469c117b96265f42f7928..85a1cbf400b5548f9a6ff75e052494a758749bf1 100644 (file)
@@ -95,7 +95,6 @@ def _real_extract(self, url):
             '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,
index ba0a98beabe42c85ba4254cee3a4fd8002e973a4..f4b0134ab8d7c1bc97aa6e03166a0a790bb801a1 100644 (file)
@@ -162,7 +162,6 @@ def extract_source(source_url, source_id=None):
         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 @@ def _real_extract(self, url):
                     'url': item['url'],
                     'vcodec': 'none',
                 })
-        self._sort_formats(formats)
         return {
             'id': id,
             'title': data_json.get('title'),
@@ -400,7 +398,6 @@ def _real_extract(self, url):
             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,
index 1736788db2a124ff27b89962e696fb03d195b368..02e7efaf0d5dfe5e813c53fd0d41173553b92e69 100644 (file)
@@ -43,7 +43,6 @@ def _real_extract(self, url):
                     '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(
index ea20b4d4d4752375eee572e20ac0f3f5c0e4571c..c2b4937658671b10e5db8c3f2482de2de349c030 100644 (file)
@@ -76,7 +76,6 @@ def get_item(type_, preference):
                 'format_note': xpath_text(file_, './lglabel'),
                 'language_preference': language_preference(lang)
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 5681499fb33ab185564fba9a09b53c0ba5676fc5..654e11206433e99697742eea9e9d60372afd79c3 100644 (file)
@@ -83,8 +83,6 @@ def _real_extract(self, url):
             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),
index 4435f08e0d73f6b4c4fac3348f10223f0453bf74..65a1dc7c503e66c967c43e24b1abc1b2ee5aa3c5 100644 (file)
@@ -45,7 +45,6 @@ def _real_extract(self, url):
         formats = [{
             'url': source['src'],
         } for source in video_json.get('sources', [])]
-        self._sort_formats(formats)
 
         return {
             'id': id,
index 92eaf4248a0a02fabcfc302eb8bb56ebeec3d169..bda6e3cb29109db2e0ecb364431a8605ecf95c65 100644 (file)
@@ -49,7 +49,6 @@ def _real_extract(self, url):
                         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)
index 5381e988046624639cccac3aa84e49df68fdeaa7..86967b631b33937411c4861ca2cf92f4e141d1cf 100644 (file)
@@ -70,7 +70,6 @@ def extract_data(name):
             formats = [{
                 'url': stream,
             }]
-        self._sort_formats(formats)
 
         title = info.get('titleRaw') or data['title']
         description = info.get('descriptionRaw')
index 35acbc643095f863867e9898aa51878b1cecd015..1404be612e7ef072dc88d6f8752c100186c5e853 100644 (file)
@@ -461,13 +461,12 @@ def extract_dash_manifest(video, formats):
                 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 @@ def parse_graphql_video(video):
                                 '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 @@ def parse_graphql_video(video):
                         '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 @@ def parse_attachment(attachment, key='media'):
             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
index cc12fda2b9201adb58b61d10e8c41be38443eae8..bca62add9f730b3e6677551b28ccd133f47b55f6 100644 (file)
@@ -78,7 +78,6 @@ def _real_extract(self, url):
                             'tbr': tbr or int(mobj.group(3)),
                         })
                     formats.append(f)
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 3501c4cf6b8cbd61bae38239009582912baefa02..dd5e088fc105ceb115adc88379a79cba2e50852d 100644 (file)
@@ -250,7 +250,6 @@ def _real_extract(self, url):
                             'Referer': url,
                         }))
 
-        self._sort_formats(formats)
         for fmt in formats:
             fmt.update({
                 'protocol': 'fc2_live',
index df40888e1b4ee731e07d98dd245f0d27a1d39b61..8175b6b0f770486004b0ef49aedeedb7735724a2 100644 (file)
@@ -38,8 +38,6 @@ def _real_extract(self, url):
             '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 {
index e170b67a7f3ca11f1d07d142640f728c3ca3aebe..dc00edcb31cd2858f0818f2b1ddf680af79e5a0f 100644 (file)
@@ -80,7 +80,6 @@ def _real_extract(self, url):
             })
 
         formats, subtitles = self._extract_m3u8_formats_and_subtitles(content_data['playURL'], video_id)
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index d741311925a1a1e9ded85af9f4e988d478628f18..9eb550eed543c0a6a6dce6c79a6cfd29b2b09691 100644 (file)
@@ -51,8 +51,6 @@ def _real_extract(self, url):
             'protocol': 'm3u8_native',
         } for source in data['sources']]
 
-        self._sort_formats(formats)
-
         subtitles = {}
 
         if data.get('subtitle'):
index 7040231beed8d170a02c112e166f48d8deb5fc0d..9a93cb9840294fc22d071edf1fe4291d9c23a33b 100644 (file)
@@ -65,7 +65,6 @@ def _real_extract(self, url):
                 'quality': QUALITY(stream.get('quality')),
                 'protocol': 'm3u8_native',
             })
-        self._sort_formats(formats)
 
         thumbnails = []
         poster = response.get('poster', {})
@@ -153,7 +152,6 @@ def _real_extract(self, url):
                 'ext': 'mp4',
                 'quality': QUALITY(quality),
             })
-        self._sort_formats(formats)
 
         thumbnails = []
         for name, width, height in self._THUMBNAIL_RES:
index 99c27e0c327c1a84cc06279387a96af877e26015..f74bd132f513cc73048432163f5ef62042000925 100644 (file)
@@ -123,7 +123,6 @@ def _real_extract(self, url):
                     % (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(
index 9f60a6b1f9baa9c5b3acfee7dcba108621965315..89a40d7e23a6ff360a94baa62c9769be3311d6be 100644 (file)
@@ -89,7 +89,6 @@ def _real_extract(self, url):
                     'url': stream['_content'],
                     'quality': preference(stream_type),
                 })
-            self._sort_formats(formats)
 
             owner = video_info.get('owner', {})
             uploader_id = owner.get('nsid')
index 0e69fa32f32dc3ddc746beef6372b5d5ddca7fa8..55a11e591b071ae70d1634c6c13fe6532a0edd58 100644 (file)
@@ -59,7 +59,6 @@ def _real_extract(self, url):
             '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,
index c6af100f3728cb8f011a6a374415f33e0b39d0ff..b6368b87daaa1821398eb6236f33dbaf8e247091 100644 (file)
@@ -35,7 +35,6 @@ def _extract_formats(self, url, video_id, media_id, sources):
             'resolution': format + 'p',
             'quality': int(format),
         } for format in sources]
-        self._sort_formats(formats)
         return formats
 
     def _real_extract(self, url):
index e1804e39e9767ecd2f7194b44f754d0b880635d7..c388a3a072e9d2810f0b5e4bd01d99bc7b276906 100644 (file)
@@ -29,7 +29,6 @@ def _real_extract(self, url):
             '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,
index 53826630fe47c999c6cec60e6148dd493c942d40..15c0c48c178616487df6eb334ab0f3739028212e 100644 (file)
@@ -132,7 +132,6 @@ def _real_extract(self, url):
         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 {}
index b285464ec8497d86d3ace9229899199e7fbaa690..f4f29c65d13893af7be49c5fde2dbe787895edf5 100644 (file)
@@ -48,8 +48,6 @@ def _real_extract(self, url):
         } 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,
index 1872d8a1ca26b6ee5b7b8312f734b1dc931d6b26..85613bafe5a191eefd7c29ea2596e6d4abb32ef4 100644 (file)
@@ -59,7 +59,6 @@ def _real_extract(self, url):
         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=' - '),
index 56a00a2387cb7dcdef6b254069a8dc32d6230c6a..052317204eea6b2a8e0c0e6719fae43146217afc 100644 (file)
@@ -191,8 +191,6 @@ def _extract_video(self, video_id, catalogue=None):
                 } for sheet in spritesheets]
             })
 
-        self._sort_formats(formats)
-
         if subtitle:
             title += ' - %s' % subtitle
         title = title.strip()
index 9724dbdf0fb5f7b5108ef5bd52d440079319ed60..8b5f2278cd8da9a27aa34ba4836d3852fb18062a 100644 (file)
@@ -63,7 +63,6 @@ def _real_extract(self, url):
             'format_note': channels,
             'quality': quality,
         } for quality, format_url in enumerate(audio_urls)]
-        self._sort_formats(formats)
 
         return {
             'id': audio_id,
index f38bae90b7faf5cc36ae0830339a6a149a0cd055..757a10d0160777ce4ca16a3b0cae3b31029377d6 100644 (file)
@@ -43,7 +43,6 @@ def _extract_video(self, content_id, action='olyott_video_play'):
 
         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 @@ def _extract_series_season(self, season_id, series_title):
         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,
index e0529b7ba76e050ff3db7422affbe1feea369d6d..3bae8add05fb6cd3a518ad391ad56f03f1e65775 100644 (file)
@@ -160,7 +160,6 @@ def _real_extract(self, url):
                     'format_id': format_id,
                 })
                 formats.append(f)
-        self._sort_formats(formats)
 
         subtitles = {
             'en': [{
index d7f49accdcd5b31b69116cbeaffe54697c508fb6..668bb2743c742f317f6bbb7be1279cba59cd80d0 100644 (file)
@@ -57,7 +57,6 @@ def _real_extract(self, url):
                                   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 @@ def _real_extract(self, url):
             'formats': formats,
             'subtitles': subtitles,
             'thumbnail': f'{self._BASE_URL}img/program/{series_id}/episode/{video_id}_a.jpg',
+            '_format_sort_fields': ('tbr', )
         }
index c70cf50c7e7b822aec19c9d203c5fe8306d7e689..18363c1b917438ecbe280dfa0e2ac7f87b9b5688 100644 (file)
@@ -247,7 +247,6 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
             'formats': formats,
             'thumbnails': thumbnails,
             'subtitles': subtitles,
+            '_format_sort_fields': ('lang', 'source'),
         }
 
     def _get_subtitles(self, subtitles, experience_id, episode, display_id, format_name):
index 46bda49ea8b206e370f0accee67553c9a4f5aff3..689422fca49e81af7b631beadd97fbc844e3b022 100644 (file)
@@ -70,7 +70,6 @@ def _real_extract(self, url):
                         'protocol': 'm3u8_native' if ext == 'm3u8' else 'https',
                     })
         if formats:
-            self._sort_formats(formats)
             info['formats'] = formats
         else:
             info.update({
index 7ed81f76130ce2b78106b8a4e48ebb7a26ff0c4e..5016e2ff9e75d68caf650d4c997fa58dd1e3c04b 100644 (file)
@@ -54,7 +54,6 @@ def _real_extract(self, url):
             else:
                 frmt['height'] = str_to_int(resolution.replace('p', ''))
             formats.append(frmt)
-        self._sort_formats(formats)
 
         return {
             'id': id,
@@ -120,8 +119,6 @@ def _real_extract(self, url):
             } 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}',
index 4ace0544a957aa9fef02cf0eb3c57ad2359496ad..c84386f2cb3aefd651e9d77e5bbce06be4aa1b96 100644 (file)
@@ -88,7 +88,6 @@ def _real_extract(self, url):
             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', {})
index e1d31737711d6a6bae97ddc216454a89170afe9b..8dec2522c64dc6e64246f6ae80386ab50a7e5f87 100644 (file)
@@ -65,8 +65,6 @@ def _real_extract(self, url):
             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,
index 76ddcc40e6e1efb1a601d14eea21dafb30b4c9d5..e0bbdae0a23ec161c4036bdd5d558f73d9748008 100644 (file)
@@ -93,6 +93,5 @@ def _real_extract(self, url):
             'view_count': view_count,
             'average_rating': average_rating,
         })
-        self._sort_formats(entry['formats'])
 
         return entry
index 4cc67802138e5765859781cb1fbf4ec92fc68744..1878d636d225afa610af938a2904e2d90fb1a40c 100644 (file)
@@ -186,7 +186,6 @@ def _real_extract(self, url):
                     duration = int_or_none(v)
 
         self._clean_formats(formats)
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 21e92cba69f0319e75b95377af93ccd729eceb13..85581e62280738fd87a5ecb0469e90b7633d82d3 100644 (file)
@@ -2619,7 +2619,6 @@ def _real_extract(self, url):
                     '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 @@ def _real_extract(self, url):
         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 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
                     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 @@ def _extract_embeds(self, url, webpage, *, urlh=None, info_dict={}):
                 })
             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 @@ def filter_video(urls):
                     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 @@ def filter_video(urls):
             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:
index 45e1618ba0835bbb4c83a6fd674fc3422bb2f663..9b4f14dd13f322a51666edd91f1b09d409d0c7ec 100644 (file)
@@ -30,7 +30,6 @@ def _extract_from_webpage(self, url, webpage):
                     make_archive_id('generic', f'{video_id}-{num}' if len(entries) > 1 else video_id),
                 ],
             })
-            self._sort_formats(entry['formats'])
             yield entry
 
 
index 9bd6200b6770a98d7e8472042ebdc01422bcf6fe..7795dc56f752d42e8c1ef4490a095564336cbc60 100644 (file)
@@ -121,8 +121,6 @@ def _real_extract(self, url):
                 'height': int_or_none(post_data.get('vid_hgt')),
             })
 
-        self._sort_formats(formats)
-
         return {
             'id': post_id,
             'title': title,
@@ -192,8 +190,6 @@ def _real_extract(self, url):
             '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),
index 9d091c113a3d1f314e7fc6176086dd7d14b8880e..edc2e56e447328831936c568ff1e8e2d7a580e35 100644 (file)
@@ -127,7 +127,6 @@ def _real_extract(self, url):
                 'filesize': filesize,
                 'quality': quality(format_id),
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 5d6b208aad45ba88947ef49d9726a8e4a04641f7..112572366bcb306ea644da71317b8d1cf309365c 100644 (file)
@@ -74,8 +74,6 @@ def _real_extract(self, url):
             if youtube_id:
                 return self.url_result(youtube_id, 'Youtube')
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'display_id': display_id,
index e728598f797b2d92be28b748fe32c1b3ab69c8fe..b59c129abf83cb10c502273fe274a1d98242286e 100644 (file)
@@ -59,7 +59,6 @@ def _real_extract(self, url):
                 '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)
index fb2a3fab23165e45aa7d1e741550d43c7d7e6735..a7be2cb766a76c0da4ef2233ce5dc43bf2db79de 100644 (file)
@@ -139,7 +139,6 @@ def _real_extract(self, url):
         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':
index 86fe1b0243e012b78eef9396714f5d4679dbcda9..22aac0db90aaef11f2d5bdf0c9d9250363df6392 100644 (file)
@@ -82,7 +82,6 @@ def _extract_api_data(self, video, video_id):
         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 = [{
index 9b8723ea170b06741b9eb0409220282fa2cb7617..b075a02e0fe13eeeb45e07f687b98c331e8da74b 100644 (file)
@@ -293,7 +293,6 @@ def _real_extract(self, url):
                             'height': height,
                         })
                 formats.append(f)
-        self._sort_formats(formats)
 
         for cc in video_data.get('closedcaption', {}).get('src', []):
             cc_url = cc.get('value')
index 8416b5aa470aeefea0bfc5341faca797fcfaa805..c33d950191a0edb0cec75fbfabc4df2a69a55ecb 100644 (file)
@@ -51,7 +51,6 @@ def _real_extract(self, url):
                 'filesize': self._int(e.findtext('filesize'), 'filesize'),
                 'ext': determine_ext(e.findtext('./filename')),
             })
-        self._sort_formats(formats)
         info['formats'] = formats
 
         thumbnails = []
index 0866647e6451d061558a3e3fab4a05d38280efb3..c17ad56f46c08acfea8495a98702cf41b69d3cb0 100644 (file)
@@ -41,7 +41,6 @@ def _real_extract(self, url):
         else:
             self.raise_no_formats('User is offline', expected=True, video_id=channel_name)
 
-        self._sort_formats(formats)
         return {
             'id': player_id,
             'formats': formats,
index cb123b874d28547dcab31cd926cd39e79da0c178..e027ea7c4d8c81cca7689aa0f436c8f23b5a1928 100644 (file)
@@ -253,8 +253,6 @@ def add_source_format(urlh):
         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')
index 31267e1aa2fece50e5d4d7aca3659c69d24e7f94..2882b49dd32fd731515bd2bfa694b9f8f99d9b7e 100644 (file)
@@ -81,7 +81,6 @@ def _real_extract(self, url):
 
         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,
index 14d6b21879e85153e24eefe959d63edb31c44c9b..ae965374cf59d069bbbcf4b3dfa924dcfcb19ddf 100644 (file)
@@ -78,8 +78,6 @@ def _real_extract(self, url):
                 '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)
index c112c785770952e204f2585109982f2daa1da3bc..b6cf14117422617cc2ca21207ec3c561d3f25cbc 100644 (file)
@@ -37,7 +37,6 @@ def _real_extract(self, url):
                 'url': data_json['vtt_url'],
                 'ext': 'vtt',
             })
-        self._sort_formats(formats)
         return {
             'id': id,
             'title': data_json.get('title'),
index f546286651543bbc0a2b6cd3d9ddfaf40aef8ac4..530bdb7270f80552882124d5e235452d3ff16e42 100644 (file)
@@ -112,7 +112,6 @@ def _extract_info(self, url, display_id):
                         'width': format_info.get('width'),
                         'height': format_info.get('height'),
                     })
-        self._sort_formats(formats)
 
         thumbnails = []
         card_sizes = xpath_element(video_data, 'titleCardSizes')
index 9aa1325afde5484ba4f12435004aee5d4b61bc99..d1a400d8ccbb695d6500ee6ff35e00eeca14b9bf 100644 (file)
@@ -81,7 +81,6 @@ def _real_extract(self, url):
                     'acodec': ext,
                     'quality': 2,  # Usually better quality
                 })
-        self._sort_formats(formats)
 
         return {
             'id': track_id,
index 86661d75a13bef27ce74599f0f3d271cfccc77d4..27d737c04969206569fb7a7e921daf943b33186a 100644 (file)
@@ -194,7 +194,6 @@ def _make_kaltura_result(kaltura_url):
                 'format_id': '%s_%s' % (ext, label),
                 'height': height,
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index fd0327228f2c83154662a6edc0716cff967792cb..fa32b27c8cf2e5a92703c7132d4f5b4fa6247eba 100644 (file)
@@ -39,7 +39,6 @@ def _real_extract(self, url):
         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+)',
index b7c8260553d3f4902f00a7ce9d5fe70e9a75a429..e518cae1acbf3a82f7947fc28c2d7c86cdbd416e 100644 (file)
@@ -29,7 +29,6 @@ def _real_extract(self, url):
             'url': s['file'],
             'ext': 'mp4',
         } for s in params['sources']]
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 50d49adf066d44cf301357d6a38b637d92ea03d7..3a53f2c459c251d3754663794b8775705b7cda0f 100644 (file)
@@ -103,7 +103,6 @@ def _real_extract(self, url):
                     f['language'] = audio
                     f['format_note'] = f'{version}, {extra}'
                 formats.extend(frmt)
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index fdcf6770d542ea9fd43bb03fad29035adb5a7949..f0c689883681bbc0dadde05463611c009dc0b729 100644 (file)
@@ -118,7 +118,6 @@ def _real_extract(self, url):
                     '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 @@ def _real_extract(self, url):
                             '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)
index 4c616d1ddc8bc4e89327fb269a9579a1fd4c3507..10879564fac2232b2ba06b69fae71c4bd57be342 100644 (file)
@@ -137,7 +137,6 @@ def _real_extract(self, url):
                 'width': w,
                 'height': h,
             })
-        self._sort_formats(formats)
 
         subtitles = {}
         tracks = try_get(playlist0, lambda x: x['tracks'], list) or []
index 48aa6e94ad5249b3f5753cdd1fe0b559640fd905..8725c9436f088ad1fe13db868426e2b7e64d7a89 100644 (file)
@@ -227,7 +227,6 @@ def _real_extract(self, url):
 
         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)
 
index c49c0899e0b5902dc7f156c3525b7c2a9d444f88..238fc0b42d6251d69d363c3114c2c7b690311425 100644 (file)
@@ -75,8 +75,6 @@ def _real_extract(self, url):
                     'vbr': vbr,
                 })
 
-        self._sort_formats(formats)
-
         return {
             'id': '%s' % video_id,
             'display_id': display_id,
index 447782019dc656c242e9e4cf831a7ec617af9add..35e9f67c4a90c0a14611b3cea41f77475d95da34 100644 (file)
@@ -58,8 +58,6 @@ def extract_formats(self, loader_data):
                 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):
index 773ae0c9a7f0b84eafdb1d6e77cc8ced95bcb940..cfec80d14470016e263c10bf8bdb7ec1d5bb400f 100644 (file)
@@ -144,7 +144,6 @@ def _real_extract(self, url):
         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'))
index 9faf46a5d42d347f90057887a35e5b61c7b4fe44..3cb21d2dd1aaa75d4702ef0384aee5508e0c93c0 100644 (file)
@@ -25,7 +25,6 @@ def _extract_formats_and_subtitles(self, sources, video_id):
             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
 
 
index 27ebc8b6c2ce022ade6569c332c7674d2daca2db..69fdc34ef73373b7e8aae3d69290ce83596afe9c 100644 (file)
@@ -79,8 +79,6 @@ def _real_extract(self, url):
                     'vcodec': 'none' if key.startswith('audio/') else None,
                 })
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': video_title,
index 717f50a834424ba0145e30c2596b5c0ddb8a8f49..2e9939601f0d51888546effe70914263ba251291 100644 (file)
@@ -53,7 +53,6 @@ def _real_extract(self, url):
             })
 
         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)
index c05e77c321ac3eefd0fc0d7d26696f04e70420a8..b6e9eec24b0148c236c6df622076bb3237ae60bb 100644 (file)
@@ -93,8 +93,6 @@ def _real_extract(self, url):
                     **self._RESOLUTION.get(si.get('sDisplayName'), {}),
                 })
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
index dc7a2f0ba10d099b3c95a50855391461248e8a3d..d081cf42e255d7d7e8ae9ce22721162da4810adf 100644 (file)
@@ -169,7 +169,6 @@ def _real_extract(self, url):
             'url': url_or_none(info.get('thumbnail') or assets.get('thumbnail'))
         }]
 
-        self._sort_formats(formats)
         return merge_dicts({
             'id': video_id,
             'title': None,
index ffff36cc1ff1f2c7ac4cb03a8fb46f9035bc0e22..9d55ddc0212870772479b16a45c6a87b877a1db5 100644 (file)
@@ -73,8 +73,6 @@ def _real_extract(self, url):
                 'acodec': 'aac',
             })
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': uploader or video_id,
@@ -147,8 +145,6 @@ def _real_extract(self, url):
                 'http_headers': {'Referer': url},
             })
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': uploader or video_id,
index bfb1e9d64926447fee044657c26b660f7e8ad642..d4797d35e01aa3b5dc3e5dabf59a3ce3202d0473 100644 (file)
@@ -102,8 +102,6 @@ def _real_extract(self, url):
                 'url': mezzanine_url,
             })
 
-        self._sort_formats(formats)
-
         thumbnails = []
         for thumbnail in (video.get('thumbnails') or []):
             thumbnail_url = thumbnail.get('url')
index 74cab7dc1d39558102f1a7728e452e3a370a7fd4..557a3b7b7b5e575634ec4dd3a125e4c67c02d11f 100644 (file)
@@ -100,7 +100,6 @@ def _real_extract(self, url):
                 'ext': ext,
                 'quality': quality(format_id),
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 5b8bfda96f3dbf7ee861db59afdf61ac9f19acf1..8e220fd9f3c5863bb22c197f292e38d7a8fa6b19 100644 (file)
@@ -103,7 +103,6 @@ def _real_extract(self, url):
                 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', []):
index 21c56d8791fe8358b35c88b502bf97c5cfaf5cee..bff6ed57f5b0c878c3f2900380b1ee2a30fde2fb 100644 (file)
@@ -84,8 +84,6 @@ def _real_extract(self, url):
                 },
             })
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'formats': formats,
index b397c168c4a2653b809d71a2d5f2a7b262331a76..4fa97d8bbad90eccc8786f14e5e613035ee00867 100644 (file)
@@ -89,7 +89,6 @@ def _real_extract(self, url):
                 'url': video_url,
                 'height': height,
             })
-        self._sort_formats(formats)
 
         timestamp = video.get('date')
         if timestamp:
index 6b31701eb1fa0933e74136accc5487e249ccfb85..192bcfe35d21a6680f45121940733b75129ade2a 100644 (file)
@@ -128,8 +128,6 @@ def _real_extract(self, url):
                 + self._extract_http_video(webpage)
                 + self._extract_http_audio(webpage, video_id))
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': video_title,
index fc08f377cfa38ff1bc73ae81c81fdb73a7b7e244..02335138f14c885a35ac491c07255ccb224fee71 100644 (file)
@@ -155,7 +155,6 @@ def _extract_product_media(self, product_media):
         } 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 @@ def _real_extract(self, url):
         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 = [{
index c8f70785f110d4e2589d0dc76addd936ab20a3cf..1b1cb574ad3aa0de75d0e2a2d710f40a7a6ec722 100644 (file)
@@ -60,7 +60,6 @@ def _real_extract(self, url):
             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'))
index 6a8e30d73df99547196272d404178fea0ed93f31..9d2574cb068d6931be2e1d5e043a18aff024e21a 100644 (file)
@@ -48,7 +48,6 @@ def _real_extract(self, url):
                 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,
index c98fe5b4274e07f291c4261a6d675e25080b5aab..181820542c5a18c2eff01a855334c1fa0e51fc93 100644 (file)
@@ -148,7 +148,6 @@ def _real_extract(self, url):
                 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 @@ def extract_formats(format_url, format_key=None, lang=None):
         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,
index bb77647f8c874541cc9d435748d11bfccae84a00..dbc688fb929b6aeb9de7f48e175dae81c8573180 100644 (file)
@@ -385,7 +385,6 @@ def _real_extract(self, url):
 
             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'<span[^>]+data-videochanged-title="word"[^>]*>([^<]+)</span>', webpage, 'title'))
@@ -667,8 +666,6 @@ def _real_extract(self, url):
                 })
             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([{
index bac852b12dec4f9990ffe04732c8ecc12029999e..253a846b7adb50c5c07b6c0b1b97b85eaec3c3f5 100644 (file)
@@ -41,7 +41,6 @@ def _real_extract(self, url):
             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,
index 26d77a46956d213cc5169863da85afee7a8e86c7..9ac7be3074b7a5a8854c59b4620ed4f97b41d52b 100644 (file)
@@ -172,7 +172,6 @@ def _real_extract(self, url):
                 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(
index 6772fcbb9670363b060f14b5fd731196a06f9c9d..dc6a48196df14352f85ae2f46a466bb078745814 100644 (file)
@@ -166,7 +166,6 @@ def _real_extract(self, url):
                 '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
index 538a961b70650846f615c7d3a75f402fa01c2aa3..7d1e554c2785e341ea0a7181384c05bb8cac7e9d 100644 (file)
@@ -67,7 +67,6 @@ def _real_extract(self, url):
             'ext': 'flv',
             'quality': quality(format_id),
         } for format_id in self._QUALITIES]
-        self._sort_formats(formats)
 
         return {
             'id': server_id,
index f77c5d44d2e204d41de5708c26b9645ebe1a649d..ec3e59c6d0024c13ee312a306c85736367ad5fe5 100644 (file)
@@ -116,8 +116,6 @@ def _real_extract(self, url):
                 'quality': 1 if format_id == 'Source' else 0,
             })
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
index 163edf48016d78b761b9afc40802e350b625b22c..1f086d2bdcdef0f3d8434c2a0e849c881a60243b 100644 (file)
@@ -67,7 +67,6 @@ def _real_extract(self, url):
         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'),
index 6520ecf6d14865dd9544b0531af1145d95e9f726..5cdf8709dc16352924a2eaeb7de22014e1be5fb9 100644 (file)
@@ -78,7 +78,6 @@ def _real_extract(self, url):
                 '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(
index 6840654cc30ad2979654e2de33581b37c41b7cec..84c3225e4858e9d4df68c0bb420c44d033025506 100644 (file)
@@ -45,7 +45,6 @@ def _real_extract(self, url):
         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,
index 578e57a674950a2dd8e160653fb9d3a1a86e2c44..a2bbba3979b6a05e1c8a5327b72dfd13cfc00692 100644 (file)
@@ -87,7 +87,6 @@ def _real_extract(self, url):
             ('ogg1', 'ogg', 'ogg'),
             ('flac', 'flac', 'flac'),
         ))]
-        self._sort_formats(formats)
 
         urls = []
         thumbnails = []
index f2f50db7a72759b78df65b25edeffb81c330c5dd..6c650568acda79b96cc1f02fad5a430f2903b1c3 100644 (file)
@@ -122,7 +122,6 @@ def _real_extract(self, url):
         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 @@ def _real_extract(self, url):
         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'<td\s+align="left">(.+)\s*\(\d+分\)',
@@ -264,7 +262,6 @@ def _real_extract(self, url):
             '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,
index 7480af0504c11f99065bc98138e60c7f040f1a59..4830e61c1bdb5e5d20e6cd7d1e9067b89a3416f4 100644 (file)
@@ -31,7 +31,6 @@ def _extract_data_from_jixie_id(self, display_id, video_id, webpage):
                     'ext': 'mp4',
                 })
 
-        self._sort_formats(formats)
         return {
             'id': video_id,
             'display_id': display_id,
index 298b3782321455ad9005a963d447a90bd454c032..9b622845a7fc760a22a52a8e050878ddac03ef1f 100644 (file)
@@ -81,7 +81,6 @@ def _real_extract(self, url):
                         r'(\d+)[pP]', format_id or path, 'height',
                         default=None)),
                 })
-        self._sort_formats(formats)
 
         thumbnail = self._og_search_thumbnail(webpage)
 
index a5014d9317708b8c782508a2a472c3b161b24508..1f0f0a5d5cbd56dcf233c66bc9fa8c711983f12a 100644 (file)
@@ -120,7 +120,6 @@ def _real_extract(self, url):
                 '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 []:
index 677f989a704fd6b6083c21bf785594dec46f1498..95e2deea5bdde41625ec86617512e872c5c49fbf 100644 (file)
@@ -518,8 +518,6 @@ def sign_url(unsigned_url):
             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
index 1c2d5c01ca1dab4d07f601f9c346d1cf713a4ed6..b50da420cbe15d4f7acc90f5c0a3f3eb163c5107 100644 (file)
@@ -5,7 +5,6 @@
 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 @@ def extract_format(format_url, height=None):
                 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'<h1[^>]*>([^<]+)', webpage, 'title')
index dea056c1276321506fa087bff003ae916716e554..2ca9ad426177b5f46fb43101cbd56c28ff14ea7c 100644 (file)
@@ -59,7 +59,6 @@ def _entries(self, playlist):
                     subtitles.setdefault('en', []).append({
                         'url': track['file'],
                     })
-            self._sort_formats(formats)
             yield {
                 'id': video_id,
                 'title': item['title'],
index 3747d8eeaa6a0236095a32cef3a749899c45bde8..df1386fb86d261d44d0e12a89789e72c445c1b4a 100644 (file)
@@ -147,7 +147,6 @@ def _real_extract(self, url):
                     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 @@ def _real_extract(self, url):
                     'url': fallback_rendition_url,
                 })
 
-            self._sort_formats(formats)
-
             return {
                 'id': video_id,
                 'title': title,
index 84a2489a31425e960fd1b482a3a58635d1b7caee..5db9083498dc82cc75374897ecc247333c061bbe 100644 (file)
@@ -44,7 +44,6 @@ def _real_extract(self, url):
         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',
index 1e177c36372a7caa9aab93497fb0133710411809..10767f1b69bd53cfab193deb5a52fd873506ae4b 100644 (file)
@@ -95,8 +95,6 @@ def _real_extract(self, url):
                 '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')
index 892d355badb924dae08412bb6a74d81dff70316e..9cfec5eb955af72e1713fc7086ba9ed44cbf7406 100644 (file)
@@ -101,7 +101,6 @@ def _real_extract(self, url):
         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')),
index 4fec2c2b224b437d289288d69e62fc26d8d2c5b3..a23ad8945d5d67294ff7b2e56e76007759957225 100644 (file)
@@ -71,7 +71,6 @@ def _real_extract(self, url):
                 '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,
index 0c9518e66144659620b92f92e3d9992583caf9d5..cfec1c50f62863de99fdc3345866d2153c57096a 100644 (file)
@@ -104,7 +104,6 @@ def _real_extract(self, url):
             lrc_content = None
 
         formats = self._get_formats(song_id)
-        self._sort_formats(formats)
 
         album_id = self._html_search_regex(
             r'<a[^>]+href="http://www\.kuwo\.cn/album/(\d+)/"',
@@ -339,8 +338,6 @@ def _real_extract(self, url):
             'format_id': 'mv',
         })
 
-        self._sort_formats(formats)
-
         return {
             'id': song_id,
             'title': song_name,
index 8ce44cc1346b87c8e74232edda2123b7370ff187..68dc1d4df134a99f8c573c3992617344f415a377 100644 (file)
@@ -78,8 +78,6 @@ def _real_extract(self, url):
             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 @@ def _extract_info(self, webpage, video_id=None, ppn=None):
             'format_id': ext,
             'ext': ext,
         }]
-        self._sort_formats(formats)
 
         title = self._html_search_regex(
             (r'<div class="title">(?P<title>.+?)</',
index a90ed16a0d4785d413d36068b328605270ea10d1..416dd7eb4e864d33a7ccedcbae2a6bcecd197d3e 100644 (file)
@@ -49,7 +49,6 @@ def _extract_formats(self, token_url, video_id):
         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):
index b2b61abace1b757bef0b78c5ebb7ee7645301488..b5def1e0711a76d6a11a7c1139c8f3ac8d87187e 100644 (file)
@@ -250,7 +250,6 @@ def _real_extract(self, url):
         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 {
index bee4e7587bb96df5157a6b1e8bafeb794f2e2071..3a9b30a3c24902f5e7938d82d4f13db8be42e33d 100644 (file)
@@ -49,8 +49,6 @@ def _real_extract(self, url):
                     '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(
index c3d0cb193bc7969bba2dda1d0e1a47a12312b33d..973764c63f760bbf15347af0f38f2f22609a29f3 100644 (file)
@@ -137,7 +137,6 @@ def _real_extract(self, url):
                         'height': int(mobj.group(1)),
                     })
             formats.append(f)
-        self._sort_formats(formats)
 
         subtitles = {}
         automatic_captions = {}
index 258e396cbd8e777082a705a31d89e5a13ffc94fc..85033b8f8b48c5b79c44e3e17941fa1805c55c25 100644 (file)
@@ -182,7 +182,6 @@ def get_flash_urls(media_url, format_id):
                     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'发布时间&nbsp;([^<>]+) ', page, 'publish time', default=None),
@@ -196,6 +195,7 @@ def get_flash_urls(media_url, format_id):
             'thumbnail': playurl['pic'],
             'description': description,
             'timestamp': publish_time,
+            '_format_sort_fields': ('res', 'quality'),
         }
 
 
@@ -356,7 +356,6 @@ def _real_extract(self, url):
         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,
index 7d0238a1f1e34410482c608fb312b5bffabd30d3..811b44758786a2fdd8cd5f82c010150f5449683b 100644 (file)
@@ -113,7 +113,6 @@ def _real_extract(self, url):
                         'width': quality[2],
                     }),
                 formats.append(f)
-        self._sort_formats(formats)
 
         subtitles = {}
         sub_file_id = video.get('SubFileId')
index afe3c98a1186db09e6192f353418821cea92913b..b76ca090818e3cba8568766d2215401b443af80e 100644 (file)
@@ -126,8 +126,6 @@ def _real_extract(self, url):
                 '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'))
 
index 8c7d2064d379a2b642a652b28c3650f8971cb228..919cfcb374b24291d6a874a1117735f9e15a7f53 100644 (file)
@@ -223,8 +223,6 @@ def extract_original(original_url):
                 else:
                     extract_original(video_url)
 
-        self._sort_formats(formats)
-
         thumbnail = thumbnail or self._search_regex(
             r'"image"\s*:\s*"([^"]+)', webpage, 'thumbnail', default=None)
 
index b53e7a5ca71f43190c46f7950841a1a37eb83a14..74ee2bea9cfdb111de5a7d765981b0fcf9648a53 100644 (file)
@@ -122,7 +122,6 @@ def _real_extract(self, url):
             'width': info.get('video_width'),
             'quality': 1,
         }]
-        self._sort_formats(formats)
         return {
             'id': video_id,
             'title': info.get('msgText'),
index 90065094b60006641d72bffdc28f6ffea8d005b3..e11ec43d66aab257c0ac74abbdc981797490ae61 100644 (file)
@@ -179,8 +179,6 @@ def _extract_info(self, pc, mobile, i, referer):
                     'ext': ext,
                 })
 
-        self._sort_formats(formats)
-
         subtitles = {}
         for flag in mobile_item.get('flags'):
             if flag == 'ClosedCaptions':
index 09c512e506850f75f7cfd3a57dfeecc93771e104..3fab9c8a5d1d191bccc7e2ae0a00483c84163b52 100644 (file)
@@ -98,7 +98,6 @@ def _real_extract(self, url):
             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
 
index 27f1080b44a050cdb913244cfe23aa48ec4b38fc..2bf2e9a11746f586f2814b91323d824edb8d2ec1 100644 (file)
@@ -111,8 +111,6 @@ def _real_extract(self, url):
             '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 @@ def _real_extract(self, url):
                 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 @@ def _real_extract(self, url):
             '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')
         }
 
 
index bf22855a98f585fe7c0e5e8fce7c7e58529c2dd7..a570248b7a94b56a6ab333d3b893b41dd172b5cb 100644 (file)
@@ -218,7 +218,6 @@ def type_field(key):
         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,
index 70449dce59607ca8b0ee430003c58733e7be0204..d883eafcff3dbcba1c04ee332739b9d99974e6f3 100644 (file)
@@ -126,7 +126,6 @@ def _extract_video_info(self, video_data):
         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 @@ def _extract_stream_info(self, stream_info):
                 'url': rtsp_url,
                 'format_id': 'rtsp',
             })
-        self._sort_formats(formats)
 
         return {
             'id': broadcast_id,
@@ -300,7 +298,6 @@ def _extract_video_formats(self, video_data, video_id):
                 'format_id': 'rtsp',
             })
 
-        self._sort_formats(formats)
         return formats
 
     def _extract_folder(self, url, folder_id):
index 9ea08ec5a61bf5b4faa6d353b954c946e94181f7..6282d2eaf3f1de2536686bd6b336968a00b3302c 100644 (file)
@@ -67,7 +67,6 @@ def _real_extract(self, url):
         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 @@ def _real_extract(self, url):
             formats.extend(fmts)
             subtitles = self._merge_subtitles(subtitles, subs)
 
-        self._sort_formats(formats)
         return {
             'id': id,
             'title': video_json.get('title'),
index a49fd592fadf528b604ab3a430233e13fbee4778..80d4d1cdb3a9481e37833d6b4f117e17c8c3a7af 100644 (file)
@@ -37,7 +37,6 @@ def _real_extract(self, url):
             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 {
index 1ae7f9d4febe3f5bb4ba8c5dbf1dca541d8fa4a3..768ce913eedbe75ec5c9b5f70e3dd4990f78eff1 100644 (file)
@@ -157,7 +157,6 @@ def _real_extract(self, url):
                         '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 @@ def _real_extract(self, url):
                 } 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)
 
index 5f30d0eaa8a4b45741cf51bfea3544ccf3049be4..387d211fe115299bf534c8ff81ac5c1baf45f9a6 100644 (file)
@@ -160,7 +160,6 @@ def _real_extract(self, url):
                 'height': height,
                 'http_headers': headers,
             })
-        self._sort_formats(formats)
 
         meta_data = video_data['meta']
         title = remove_end(meta_data['title'], '.mp4')
index 213a1df5723e9655e05186fddc2213a92d1e0796..fe5589d598d8784dee5bad3c581bed11e042884d 100644 (file)
@@ -197,8 +197,6 @@ def _real_extract(self, url):
             subtitles = self._merge_subtitles(m3u8_subs, mpd_subs)
             formats.extend(m3u8_formats + mpd_formats)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
index 02f226be57bbeefb9b358c5a95456a80556190a8..e1031d8da4d202dee12095713fd43af6bc82c433 100644 (file)
@@ -72,7 +72,6 @@ def _real_extract(self, url):
 
         formats = self._extract_m3u8_formats(
             video['VideoSource'], video_id, 'mp4', 'm3u8_native')
-        self._sort_formats(formats)
 
         subtitles = {}
         for s in (video.get('Subtitles') or {}):
index 568831aa8a20d12a47dbd649ee735f3bf258c379..efaf66fa200d123685e59b80f7ae1c2d07534695 100644 (file)
@@ -44,7 +44,6 @@ def _real_extract(self, url):
             ], webpage, 'format url')
         formats = self._extract_wowza_formats(
             format_url, page_id, m3u8_entry_protocol, ['smil'])
-        self._sort_formats(formats)
 
         return {
             'id': page_id,
index dc8653f5d590fc9fa95f59b3b217284375e82a26..2792e6e7078a74e5c728b2f0ad82b7b22e0b7c60 100644 (file)
@@ -54,7 +54,6 @@ def _real_extract(self, url):
         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 @@ def _real_extract(self, url):
         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',
index 63ff5f054e256cf64c5dbe9700b8104190894624..741745378b3e1a5e093d4a1ec914496a4895ef4f 100644 (file)
@@ -135,8 +135,6 @@ def mung_title(s):
             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, ),
index 4508e4391abcd28228eef241cad69a3d8e66c249..7dacb43e02c6f3ea36a1043b699643e1a446f1ff 100644 (file)
@@ -65,8 +65,6 @@ def _real_extract(self, url):
                 'vcodec': 'none' if format_id.startswith('Audio') else None,
             })
 
-        self._sort_formats(formats)
-
         return {
             'id': episode,
             'title': title,
index d1ce07f10121a2da6f465ee8fe446e84a76776d5..716f1c9615a201b4be9a09b1ddcc27ae39ef4be3 100644 (file)
@@ -25,7 +25,6 @@ def _real_extract(self, url):
             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()]
 
index 94ae20b26fa6342190ed1afa5ea3dc1ef1fb486c..a67fa9fe4c24c2f12157edf4bbcedb5af371c715 100644 (file)
@@ -43,7 +43,6 @@ def _real_extract(self, url):
             })['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': 'Матч ТВ - Прямой эфир',
index b44cf809ad17c3ce76ab3c9932442b693ea94493..49f5b49a40ffa2604d81f31c0f238e6abf9a0fa9 100644 (file)
@@ -162,8 +162,6 @@ def _real_extract(self, url):
 
                     formats.append(f)
 
-        self._sort_formats(formats)
-
         description = xpath_text(doc, './broadcast/broadcastDescription', 'description')
         timestamp = parse_iso8601(
             xpath_text(
index 80efcc764966a7d41b01651fd671870b29367142..82be823b8a23b5b57fa1228798266eeb1e96beab 100644 (file)
@@ -150,8 +150,6 @@ def add_item(container, item_url, height, id_key='format_id', item_id=None):
                     '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 {}
index f9a449377ed872d6608da81f57b97a44a091f0d1..46365081b72b944acb528ad16a02740b67485fe6 100644 (file)
@@ -89,7 +89,6 @@ def _real_extract(self, url):
 
         formats = self._extract_wowza_formats(
             playlist_url, video_id, skip_protocols=['f4m', 'smil', 'dash'])
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 6daa50846644657977c572a335d829ade7321dcc..bce20dcfd7ce8be5ebf40b00d150df75115c707f 100644 (file)
@@ -100,7 +100,6 @@ def _real_extract(self, url):
                     'ext': ext,
                     'url': src,
                 })
-        self._sort_formats(formats)
 
         return {
             'id': production_id,
index a3b5491d2eedd2b94f3253647aeefb751f9c4ae5..61bdb2a3f1de9d8e66b094f86f6b3973197de2a3 100644 (file)
@@ -247,8 +247,6 @@ def _real_extract(self, url):
         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)
index 0ffd01cd294ef7b70634d106564b743fdeb5a9f7..fe549c49fb430b6ca462dfceb6c2355df4103c3f 100644 (file)
@@ -264,8 +264,6 @@ def _real_extract(self, url):
                 })
             formats.extend(stream_formats)
 
-        self._sort_formats(formats)
-
         # XXX: Presentation['Presenters']
         # XXX: Presentation['Transcript']
 
index 651239bd49e1e33467fcd5b850592bf1a6f215a6..62e37d24a915324b16730f0b81c28b5a8c7a8dcb 100644 (file)
@@ -90,8 +90,6 @@ def _real_extract(self, url):
                 audio_format.setdefault('acodec', 'aac')
                 formats.append(audio_format)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': asset.get('title'),
index 54c7b7f9fe2f3df7e1f8e18ff6ee799e9d0995c7..2f3f11f519111021c2844912f0b18b7b4d8dc1cd 100644 (file)
@@ -87,7 +87,6 @@ def _real_extract(self, url):
             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,
index 0cbc961c42548c833b630582ef7d131346a7afe3..1d3fff856621fb616f28a7bb11ecc9d6f787c343 100644 (file)
@@ -44,7 +44,6 @@ def _real_extract(self, url):
 
         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
index 048c74e68b1e5aaff945378ae293cf01fb3bc19c..d7f5def0e068867c409e3855de2db54a89269f72 100644 (file)
@@ -267,7 +267,6 @@ def _real_extract(self, url):
                 'url': video_url,
                 'ext': video_ext,
             }]
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 543bdffaddd3f44c189c7b09078a071887b183bf..14410549ab8fe26a8fdc0c2d31331748b1aea510 100644 (file)
@@ -49,7 +49,6 @@ def _real_extract(self, url):
                 '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)
index c41c513844293a1a57f10504d188b462f1444c77..2388a7192062f6c1b6c7ab3fe232791b9c4c5da0 100644 (file)
@@ -68,7 +68,6 @@ def _real_extract(self, url):
                 'ext': fmt['format'],
 
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 37594d12d9142e078e395ae0358d08709692fafd..edc92b371fbe43d390f0fd639c20a2736f7ae965 100644 (file)
@@ -117,7 +117,6 @@ def _real_extract(self, url):
                 },
                 'format_note': stream.get('name'),
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 1425a0159e4b56080232d8bcfda0b386dc470f31..f71ab3e921189738be4273c0d21f07d94ba9fa1b 100644 (file)
@@ -39,7 +39,6 @@ def _real_extract(self, url):
                     'height': source.get('heightPixels'),
                     'width': source.get('widthPixels'),
                 })
-        self._sort_formats(formats)
 
         subtitles = {
             lang: [{
index 2dde82a752b98c61c6c69aad57798a87acad0d5b..9b50996b703ea5852aef293d97e67ac65bf9a222 100644 (file)
@@ -101,7 +101,6 @@ def _real_extract(self, url):
                     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,
index f15f00ee57630710b155231fe379c9cd278ccd8f..b759b1860b1f1dd64811b3967afbec55ef12c352 100644 (file)
@@ -93,7 +93,6 @@ def _real_extract(self, url):
                     'acodec': acodec,
                     'vcodec': vcodec,
                 })
-        self._sort_formats(formats)
 
         subtitles = {}
         for source in settings.findall('.//MarkerResourceSource'):
index c7a61dfa0a1be1977041db26628e26e833d1e765..f64d575dcc8126f797bdf4e09804c0ca2d5ae28c 100644 (file)
@@ -74,8 +74,6 @@ def _real_extract(self, url):
         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 @@ def _real_extract(self, url):
                 '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'),
index 85dd5fd79a564cefce2aa28a7cc06c5d69bffe26..2fb17920ccb93e97cdac020240a3ba006cd68d8e 100644 (file)
@@ -92,7 +92,6 @@ def _real_extract(self, url):
                 'height': int_or_none(source.get('size')),
                 'url': src,
             })
-        self._sort_formats(formats)
 
         entity = video.get('entity') or entity
         owner = entity.get('ownerObj') or {}
index e799cd3bcc893e61d4240d84df08ad0fa2a4af3a..8d18179c780dbaedccb2a4b20237f6cbea49d11c 100644 (file)
@@ -35,7 +35,6 @@ def _real_extract(self, url):
                     'height': int_or_none(fmt.get('height')),
                     **parse_codecs(fmt.get('codecs')),
                 })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 8192f2b4674f030503eb18395603e3bc06bd6e88..0a8ee0c3a52eeff28f2d9e679e0ae5913bc34970 100644 (file)
@@ -55,7 +55,6 @@ def _real_extract(self, url):
             hls_url, video_id,
             ext='mp4', entry_protocol='m3u8_native',
             m3u8_id='hls', live=is_live)
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index becc56a2b9f157815f8546ca8ad7c98b06c29cff..fb5a08ca286bca6b88b4b023c55a53809dd4435d 100644 (file)
@@ -169,8 +169,6 @@ def _real_extract(self, url):
         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 {}
index 2f0f2deabcee0ebdfb3fc808aeb1dc8b2c43b728..72057dc97a0be14fdef0ffd6d104c00dfcfbec8e 100644 (file)
@@ -54,7 +54,6 @@ def _real_extract(self, url):
                         '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 @@ def _real_extract(self, url):
             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),
index 65e3d476a96f99b878bca3c31d5b1ad078cc29d7..98bab2e100c9ef25b2aca714d55aab7ff95201e3 100644 (file)
@@ -59,7 +59,6 @@ def _real_extract(self, url):
             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'))
index 27d2d9c2cf63b5e6ddf90dff602e8f72c3afcdc0..5f72b810bb5eff8cdb3e751cabe356c8797b7a59 100644 (file)
@@ -42,8 +42,6 @@ def _real_extract(self, url):
                 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,
index 5757322d662a77ac5242909b1f37fc2341b1eee5..cffcdcfb561ca17dfcf5281f985dd7501e313497 100644 (file)
@@ -29,8 +29,6 @@ def _real_extract(self, url):
             'ext': 'mp4',
         }]
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': self._search_regex(r'title: "(.+?)",', jsplayer, 'title'),
index 6f4935e5132f6c83ceb914b26778204490cdac57..f91c53eba1d18b8319dffee5802e2688a8a9739b 100644 (file)
@@ -131,7 +131,6 @@ def _real_extract(self, url):
                         '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', []):
index b2009dc5be056473c5bc2dfb05aa64cb10c5a815..d91be62700b058338da4ea1cbe7921da2dd131c6 100644 (file)
@@ -102,8 +102,6 @@ def _extract_video_formats(self, mdoc, mtvn_id, video_id):
                     }])
                 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 @@ def _get_video_info(self, itemdoc, use_hls=True):
         if not formats:
             return None
 
-        self._sort_formats(formats)
-
         return {
             'title': title,
             'formats': formats,
index b9681d1bd7401fa2173213dcb354a10d35c14d25..36a2d4688eb5374129974e39ee3fedd37a280be2 100644 (file)
@@ -60,7 +60,6 @@ def _real_extract(self, url):
                 '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,
index 0cbb1673624c9aa57838c5b0005f5f4f485f5279..efbfd9d430a6079e5863b61b4fde112acd86954e 100644 (file)
@@ -47,7 +47,6 @@ def _real_extract(self, url):
                 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,
index 63d36c30a7c018866edce37877e229686343b1b0..3451098379e351b051b1bb191f7beb6de124c3ee 100644 (file)
@@ -122,7 +122,6 @@ def search_data(name):
                 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 @@ def search_data(name):
                 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'],
index cc0ff533e789800850705bf604885c41a4d9f794..55345f3983d055acd97a3f711432bcd9f6967f37 100644 (file)
@@ -24,8 +24,6 @@ def _real_extract(self, url):
         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,
index c83b2acbd848d4d3a87dacdf3e6c723b76760084..5e74caa7f6c9e8e025ad7674949918e4dfa3dd95 100644 (file)
@@ -68,7 +68,6 @@ def _real_extract(self, url):
             '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'),
index 3c4e735350a49a15131793b396994527558d8336..b5425c7448f2009b51d33eac4c97831927de73bc 100644 (file)
@@ -67,7 +67,6 @@ def extract_formats(streams, stream_type, query={}):
                 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 @@ def _extract_video_info(self, video_id, url):
                 quality.get('url'), video_id, 'mp4',
                 m3u8_id=quality.get('qualityId'), live=True
             ))
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index e95c1b795cb67c6799617d9ef0c0571e5c7d691b..d8fc82488d36a08e81d6c71e65fc335ee644ab7b 100644 (file)
@@ -92,7 +92,6 @@ def _extract_video(self, filter_key, filter_value):
                 formats.extend(cvp_info['formats'])
                 info = merge_dicts(info, cvp_info)
 
-        self._sort_formats(formats)
         info['formats'] = formats
         return info
 
@@ -318,7 +317,6 @@ def _extract_video(self, video, team, extract_all=True):
                     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']))
 
index dbc82de9f4bcaf0bbe4d0afb1b0dd9fbb2c8c7c1..1ea6355b560ca99929fd1cac1ed6614abdb05977 100644 (file)
@@ -305,7 +305,6 @@ def _real_extract(self, url):
                 '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 @@ def _real_extract(self, url):
                 'tbr': tbr,
                 'ext': 'mp4',
             })
-        self._sort_formats(formats)
 
         subtitles = {}
         closed_captioning = video_data.get('closedCaptioning')
@@ -581,7 +579,6 @@ def _real_extract(self, url):
             # -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 @@ def _real_extract(self, url):
         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),
index 90a658cd803d046e274dfb828b58a7750ea21da3..41ea3629a97b0ede3225356502166b22ee15c3e7 100644 (file)
@@ -266,7 +266,6 @@ def _real_extract(self, url):
                     ff['vcodec'] = 'none'
                     ff['ext'] = ext or 'mp3'
                 formats.append(ff)
-        self._sort_formats(formats)
 
         config = playlist['config']
 
index 5cf96ad7ef26ab6ed3eded0022ba014ffbac316d..595709899af1d04923d2abf94ece0d31f58f1747 100644 (file)
@@ -236,7 +236,6 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
             {'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 @@ def _real_extract(self, url):
 
         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'],
index 49b29b67cc03d7e14ade6e1a6d32b25e464cbaae..9c314e22330ee959437b82d09fbebab749116179 100644 (file)
@@ -72,7 +72,6 @@ def _real_extract(self, url):
             'ext': 'mp4',
             'url': tpl.replace('{}', film_fn) + suffix[key],
         } for key, tpl in templates.items()]
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index ba24720e32b96f627d290c0318cfea9a7059c22f..9e3286dfe749040176b50043b887892747b2f0ff 100644 (file)
@@ -172,7 +172,6 @@ def _real_extract(self, url):
         if video_type_description == 'Audio File':
             formats[0]['vcodec'] = 'none'
         self._check_formats(formats, media_id)
-        self._sort_formats(formats)
 
         return {
             'id': media_id,
index a368ce4e021539cf897a57d3227cb20e6cee59fb..b6334dcbafa59304f33cbfcebe06f4981ead1623 100644 (file)
@@ -29,7 +29,6 @@ def _real_extract(self, url):
         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(
index 20db46057324136b06ace27e0c6210a5caa43e69..820eb4ba7f87707e482d8c6c5943786db7a9d74d 100644 (file)
@@ -64,7 +64,6 @@ def _real_extract(self, url):
             formats.append(f)
 
         self._check_formats(formats, video_guid)
-        self._sort_formats(formats)
 
         return {
             'id': video_guid,
index 9fde6c079024abcfc9aee9c21e12bdac03dcf69e..a5a7b168cdd1ff41b3dd0f47772afd60531e3b9a 100644 (file)
@@ -36,7 +36,6 @@ def _real_extract(self, url):
             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,
index 69c48652cad038b27cf5ecb875c464b1c83c668d..b4874c8f3e0d84e8a3758f30694b0018b7af6cee 100644 (file)
@@ -452,8 +452,6 @@ def find_video(result):
         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'):
index 79c6aaf0cb3e1ff859f8bb0168ae64e201512ed3..38e068af4189f338c63af24948a4208aaad2b86a 100644 (file)
@@ -35,7 +35,6 @@ def _real_extract(self, url):
             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,
index e6f98b036ae8e850eb35ce3002d3d00ce7c9c4ed..febad8fdf30a9f8ae05e4ba774eab7a2ef43a154 100644 (file)
@@ -124,7 +124,6 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
             'uploader_url': uploaderPage,
             'location': location,
             'upload_date': upload_date,
-            'is_live': isLive
+            'is_live': isLive,
+            '_format_sort_fields': ('res', 'tbr'),
         }
index 106566611733f617c2e73138aad7961979115f73..29c53d5a50eafc8c9b34141245c34928398d8ea4 100644 (file)
@@ -71,7 +71,6 @@ def _parse_video_config(self, video_config, display_id):
             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:
index 517660ef107270cf796959e12f28fce98ce44b57..59702b247ee57cca283b1635f656d00e1804f15b 100644 (file)
@@ -78,7 +78,6 @@ def get_clean_field(key):
                     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 @@ def _real_extract(self, url):
         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'))
 
index 884f9e2aed631940a26a1b6815aabebb573d1a9a..2521c40e0836ab3c6e00282e480fe7d9fb922562 100644 (file)
@@ -48,7 +48,6 @@ def _real_extract(self, url):
                     '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 []
index e131b044a438d468886c5397840d4827ce30d233..2103037596db0a90207c19503e5a7c5bdeab252d 100644 (file)
@@ -425,8 +425,6 @@ def get_video_info(*items, get_first=True, **kwargs):
             if fmt:
                 formats.append(fmt)
 
-        self._sort_formats(formats)
-
         # Start extracting information
         tags = None
         if webpage:
index 462caf46639fc114cae128b5ab3b0d9fb5500638..31df42f4f6ca52a7c53f2087cac079cfdd5b3a89 100644 (file)
@@ -43,7 +43,6 @@ def _real_extract(self, url):
         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 []):
index 86e710f2b1fb0c6dca89ed990f1f8cbde40a844a..865ad99ac5ac364482d790f6f0cc0243b35640a9 100644 (file)
@@ -116,7 +116,6 @@ def _real_extract(self, url):
                     'format_id': image_id,
                 })
                 formats.append(common)
-        self._sort_formats(formats)
 
         section = traverse_obj(post, ('postSection', 'name'))
 
index e761cf257ca0ed90ab017a276e2c8ed674a7530c..7b8a526f0298cb2b79e283b15314b620372be260 100644 (file)
@@ -69,8 +69,6 @@ def _real_extract(self, url):
             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
index 35b64530f8d41ab72a71764d286e1a9168670a05..1aa9705be45792e5c2ad462d7a86f1aa8acceb07 100644 (file)
@@ -48,7 +48,6 @@ def _real_extract(self, url):
                 formats.append({
                     'url': source_src,
                 })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 3e04da67e89e90a9f8e64ef662d8ca8a0ebcc172..e6208956fb3fb7657c3e18cbcdb5868466f3bebc 100644 (file)
@@ -47,8 +47,6 @@ def _real_extract(self, url):
             'ext': source.get('type'),
         } for source in playlist_info.get('sources')]
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'formats': formats,
index 6875d26ba51e756c8a82bee980fba8fbbbe516a3..8bd3fd4725fffa816985bcb206f04a3e380d36cb 100644 (file)
@@ -123,7 +123,6 @@ def _real_extract(self, url):
 
         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 @@ def _real_extract(self, url):
             formats = [{
                 'url': video_url,
             }]
-        self._sort_formats(formats)
 
         title = mediafile.get('meta', {}).get('title') or self._og_search_title(webpage)
         thumbnail = config.get('poster')
index 152b93bd4c5f0334ffc9a3457751fba67e0e5791..92d1d136c7c9ee25ff19bac931ab5bb62c4e205f 100644 (file)
@@ -55,7 +55,6 @@ def _real_extract(self, url):
                 '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,
index b42a56f7e31d752db5a214a13dede141dff3f868..59d259f9df6ddabbb31f5266222fa5a6b3e47afc 100644 (file)
@@ -71,7 +71,6 @@ def _real_extract(self, url):
                     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,
index b307e6a7887f3bc366f91f85ea3699b32a1217bf..f18cb9e28b22853ecffd596389c3c9910d7e350b 100644 (file)
@@ -247,8 +247,6 @@ def _get_info(self, url, video_id):
             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 @@ def add_format_url(format_url):
                         'quality': stream.get('kwaliteit'),
                     })
 
-        self._sort_formats(formats)
-
         subtitles = {}
         if metadata.get('tt888') == 'ja':
             subtitles['nl'] = [{
index e677e862d59cb7b7a0c424466800b937f2090c5c..4b6855c93fe2d0b362ef4c3d24be51af775c2348 100644 (file)
@@ -121,8 +121,6 @@ def _real_extract(self, url):
                 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,
index 14951f8e18c1b717a5622d7ce5cdd273a2dfef7f..88d08e5e3a9edc9cedf41369810c2b79dc928d16 100644 (file)
@@ -180,7 +180,6 @@ def call_playback_api(item, query=None):
                     'format_id': asset_format,
                     'vcodec': 'none',
                 })
-        self._sort_formats(formats)
 
         data = call_playback_api('metadata')
 
index d252ced86615dfc155bba31a37796d3592288d38..6d7ea3d1844a1d1d6dd437df5ffda1b2368724c9 100644 (file)
@@ -60,7 +60,6 @@ def _real_extract(self, url):
             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,
index c8df110e80e324fd42cc3af629d4b26779143822..8d5877daa0cff1900ee931900e96baff74c06948 100644 (file)
@@ -115,7 +115,6 @@ def _real_extract(self, url):
                 'url': file_,
                 'filesize': int_or_none(xpath_text(video, './%ssize' % format_id)),
             })
-        self._sort_formats(formats)
 
         return {
             'id': xpath_text(video, './id'),
index fafcc8f4b33242c26064557b7b35588e55d95bec..6ac351cb03d96adb85111d41804712d2615260c0 100644 (file)
@@ -80,7 +80,6 @@ def _real_extract(self, url):
         } 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 = [
index fe6986a8277257c8a9e2a8b22ea863e30c16313e..2e21edbb4120b87bdcc34c4e6436d0ef70d2f43a 100644 (file)
@@ -72,7 +72,6 @@ def get_file_size(file_size):
                     'tbr': int_or_none(video.get('bitrate'), 1000) or None,
                     'ext': ext,
                 })
-        self._sort_formats(formats)
 
         thumbnails = []
         for image in video_data.get('images', []):
index 195563bbb12b41d2718c6cd2cd68bd167aacd307..4f325f08784892a03fe9c77327ff46021e2611fa 100644 (file)
@@ -370,8 +370,6 @@ def _extract_desktop(self, url):
             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
 
index 42ea949051b3b18142317e590ce9739b53cd08d3..61d1f404863fd0c9a15e08d60621353c5277807e 100644 (file)
@@ -54,7 +54,6 @@ def _real_extract(self, url):
         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,
index 779becc70026ab54cf8cc133314cb206d5ce6dba..9a4abc98d9171e3217c95c7a8720e1116d6742ff 100644 (file)
@@ -76,7 +76,6 @@ def _real_extract(self, url):
                     'vcodec': 'none',
                     'acodec': 'wav'
                 })
-        self._sort_formats(formats)
 
         return {
             'id': event_id,
index 41815bef1f64f96f397b9d048d75d7db289f4eed..591d15732db9a28bd8cb105ab3a46cbecd1b180a 100644 (file)
@@ -36,7 +36,6 @@ def _real_extract(self, url):
         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'),
index ea46d7def674966e529ca6eae08679d9fd07aa97..0d59e8cb448a47fbbe3e16d963cde6dc5d800404 100644 (file)
@@ -80,7 +80,6 @@ def _extract_from_id(self, video_id, webpage=None):
                                 'vbr': float_or_none(f.get('video_bitrate')),
                             })
                         formats.append(http_f)
-        self._sort_formats(formats)
 
         meta = video.get('meta', {})
 
index 146c1f981a46d3f2acb7a58efe77e12d604cfa9c..65afccdb1c95824c2da74fc1961bc41d805bf0e0 100644 (file)
@@ -85,7 +85,6 @@ def _extract(self, content_tree_url, video_id, domain=None, supportedformats=Non
         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():
index c640224dd6d889a07fcf860ce2170243655c9e97..fa46757f7b62fe386a671a0869ca0ec53374d3ad 100644 (file)
@@ -92,8 +92,6 @@ def _parse_mediapackage(self, video):
                     })
                 formats.append(track_obj)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'formats': formats,
index 6c1eb8f3ad4598f4319ccac5f1b1cdce11a099a3..86dc9bb898cf1f7867cba477a49562767e247044 100644 (file)
@@ -50,8 +50,6 @@ def _extract_movie(self, webpage, video_id, name, is_live):
             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 @@ def _real_extract(self, url):
 
         formats = self._extract_m3u8_formats(
             capture_data.get('source'), video_id, ext='mp4')
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 09b1214227903229dc30cfb57623a5a432d86195..d49909d528ac467d3cd0f26242d6ba72b97f76f3 100644 (file)
@@ -54,7 +54,6 @@ def _real_extract(self, url):
                     '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')
index 24abf7f26c2ed7e62b2d528c8f9bf70b3cd14a7f..e9d23a4d12c53cf504a282827bddd012fff3cb8e 100644 (file)
@@ -134,8 +134,6 @@ def _pagefunc(self, url, data_jsb, n, *, image=None):
                 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 @@ def _real_extract(self, url):
                     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 @@ def _real_extract(self, url):
                         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:
index 3747f31d2c6e601047161c818bb08e079d132be8..ccc78da57fa5ec5757cf0a5db0d81cdaaf01f39a 100644 (file)
@@ -112,7 +112,6 @@ def _real_extract(self, url):
                 'url': format_url,
                 'height': int(height),
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 5f5edb26b2cb3b4e9759c7274af6ee26208bbc4b..32c103bc1e2e6cc80e7bb9056fb84186b2692d28 100644 (file)
@@ -407,7 +407,6 @@ def _real_extract(self, url):
         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 {
index f31ae576cddf16f3d5e60e3f96a31160ebfe69c5..0b547917c0a2b6ef094258661ce233d3f1d1ae51 100644 (file)
@@ -44,7 +44,6 @@ def _real_extract(self, url):
         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)
index 43c90c8f1655b82ada4e05f7f7d30a4cfe1d4d5a..529aba178c5bfa3f572ffe26351da9088d970efd 100644 (file)
@@ -277,7 +277,6 @@ def _real_extract(self, url):
                 }
             elif name == 'video':
                 formats, subtitles = self._extract_m3u8_formats_and_subtitles(post_file['url'], video_id)
-                self._sort_formats(formats)
                 return {
                     **info,
                     'formats': formats,
index 4e6674e85e38ca0a7ffc71da3fdf3e26b5562ea6..5bdf561db9ef833e5651f459b63e29f2bee968ec 100644 (file)
@@ -660,7 +660,6 @@ def extract_redirect_urls(info):
         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:
index e76305acd4e16f224cf1d6996becb82ca7117e0b..e27e5a7bac5e42e6321a24385fa470b00fa22294 100644 (file)
@@ -45,7 +45,6 @@ def _real_extract(self, url):
                 '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>[^<]+)',
index fd25b5adbdbe54b14721261133791ae6bdff1b0d..2d9b9a742513e4d215d96838e5e1524391e8b981 100644 (file)
@@ -40,7 +40,6 @@ def _real_extract(self, url):
         } 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({
index 6d280e41c0e56648852589cc63fc78e77f8b78b1..68e15737b978a52d64e3be21ea861858e69aeade 100644 (file)
@@ -1233,7 +1233,6 @@ def _real_extract(self, url):
             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:
index 821abe496ed9c989b0d23816e7c442b655ca0267..a709e21b44f6369a44eb1bfae36cab42314e7176 100644 (file)
@@ -43,8 +43,6 @@ def _real_extract(self, url):
 
         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', ' '),
index 3fc05d1f272141cabbb18d0d323f6e5934428f6a..4835822cf5eae3f7b301f2a22a857b3c86e57336 100644 (file)
@@ -157,7 +157,6 @@ def _real_extract(self, url):
             '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'),
index 824495f40d40f0417b9ae7dba84416349134f344..f4d7f22d0a31da276b8fd4e90a2c2ce83dffd380 100644 (file)
@@ -65,7 +65,6 @@ def _real_extract(self, url):
                 'vbr': int_or_none(c.get('videoRate'), 1000),
                 'abr': int_or_none(c.get('audioRate'), 1000),
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 2ff6589d5f03b00f2f3f1b908fcd67370b2ff1ca..84bcf1573ac04ffab523c6efa5c2cbf12df7cb77 100644 (file)
@@ -127,7 +127,6 @@ def add_width_and_height(f):
             }
             self._add_width_and_height(rtmp_format)
             formats.append(rtmp_format)
-        self._sort_formats(formats)
 
         info['formats'] = formats
         return info
index 5ea2b639334629699993c79f0c65b887b9ef75be..e8494a0840542d7ed087d406aaf41b123c53060e 100644 (file)
@@ -75,7 +75,6 @@ def extract_entry(source):
                     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,
index 54999a832cb0d6915b625e827ed51cd34bdec2cd..36a062def385b3f60017dd2a2153e4d04509f115 100644 (file)
@@ -64,7 +64,6 @@ def _real_extract(self, url):
                 formats.append({
                     'url': source_url,
                 })
-        self._sort_formats(formats)
 
         mature = metadata.get('adult')
         if mature is None:
@@ -114,7 +113,6 @@ def _real_extract(self, url):
         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,
index fba7242f5dc46ebda0be8aff71f02229a2d222bc..cc60b304e5d0a9ba8f02dbefeb439eeb21433971 100644 (file)
@@ -153,8 +153,6 @@ def process_asset_files(asset_files):
                 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 @@ def process_asset_files(asset_files):
             'timestamp': parse_iso8601(video_data.get('dateadd')),
             'formats': formats,
             'subtitles': subtitles,
+            '_format_sort_fields': ('tbr', ),  # Incomplete resolution information
         }
index 313b5cce0d7a63e456007c3cdef52dbc53c8d75f..e4e1caaa258365120acb1287d71ab2e1015084e0 100644 (file)
@@ -49,7 +49,6 @@ def _real_extract(self, url):
                 '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(
index 171f9e4eb071fb76f644954fb1a7c9b92b195447..2c6cd6d4bbb295e49d5490f237273ff76a2079f9 100644 (file)
@@ -52,7 +52,6 @@ def _extract_video(self, data, extract_formats=True):
                         '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'))
index bfdb8b24e899a90cea22735ad0bddce2a834c8fb..850c6f23d958b9b347d5fc3551b6b211e155e3d3 100644 (file)
@@ -71,7 +71,6 @@ def _real_extract(self, url):
         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,
index 8be08a5bc2ad9c9842c0f21b03066907e63e4f3e..dcf18e1f3b133e6aa22793a8966b3bde6197b0e1 100644 (file)
@@ -111,8 +111,6 @@ def fail(text):
             if error:
                 fail(error)
 
-        self._sort_formats(formats)
-
         webpage = self._download_webpage(
             'http://video.pladform.ru/catalog/video/videoid/%s' % video_id,
             video_id)
index 03b9d6aaae31d714864ed6f11673ea3facdb0e20..25753fe7eea61232a5d90018355b4bbd0b87f8a9 100644 (file)
@@ -57,7 +57,6 @@ def _real_extract(self, url):
                 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,
index 29d3210ace31572a84719901c4b87c4f4f379084..b8a4414940e3b7fd817d3f870462e9a93c8a358b 100644 (file)
@@ -127,7 +127,6 @@ def _real_extract(self, url):
                         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'))
index 05dbaf066198c54cdf8d4057d42328050dbf78d2..316f220f799db70483cf066a6f0186c1f8cc325e 100644 (file)
@@ -79,7 +79,6 @@ def _real_extract(self, url):
                 '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', []):
index 700dfe40771609b3b456d5275cf23d5cb31b7304..9371f7b2375bca5d17ccb9a9c0434f6aa6cc1c1d 100644 (file)
@@ -38,7 +38,6 @@ def _real_extract(self, url):
                 'format_id': 'http-' + format_id,
                 'height': int_or_none(height),
             })
-        self._sort_formats(formats)
 
         info.update({
             'id': video_id,
index f7e5ddbe774069cde56a58244c823d9745de541c..c418f88cb1d00ffd13822df1ce43846cd015d244 100644 (file)
@@ -160,7 +160,6 @@ def _real_extract(self, url):
                 'quality': quality(fmt.get('quality')),
                 'preference': preference,
             })
-        self._sort_formats(formats)
 
         title = item['title']
         is_live = item['type'] == 'stream'
index 18aeda7de38376346933096dabbddbfc38ec97e8..1e0989d0aabe3b50ed2aa6ea97ce8a833e8abccd 100644 (file)
@@ -74,7 +74,6 @@ def _real_extract(self, url):
                         'height': height,
                         'url': val,
                     })
-        self._sort_formats(formats)
 
         # Extract title - should be in the flashvars; if not, look elsewhere
         if video_title is None:
index 683dbf4a584a21166bcff4283c34f52467f21ba9..1057bff3a03480c492f9a5b7a650b75267b8e584 100644 (file)
@@ -62,7 +62,6 @@ def _real_extract(self, url):
         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,
index b50152ad8b961fc1af8f1971e513c101822bb6fa..809b65608f2b1bc5c4c6b54a673913d446695fe9 100644 (file)
@@ -410,8 +410,6 @@ def guess_allowed_qualities():
                     })
                     formats.append(clip_f)
 
-        self._sort_formats(formats)
-
         duration = int_or_none(
             clip.get('duration')) or parse_duration(clip.get('formattedDuration'))
 
index 6e8f46fa320b26f7d8c49345bb93375e93185938..71a05cc7a8620be40557f4de4c1c76e5dddc9572 100644 (file)
@@ -135,7 +135,6 @@ def _get_video_info(self, video_json, slug, series_name=None):
             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,
index e44d951e6e0b8cab1da3bf69b180c5bf7f0b3240..1524a1fb9f8e8b8f903d3aa23bbd4a150cdfaffc 100644 (file)
@@ -42,7 +42,6 @@ def _real_extract(self, url):
 
         formats = list(self._extract_formats(
             try_get(media, lambda x: x['playback']['mediaSources']), video_id))
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 514753b64d0df650962f5dd057586355b68a569c..99244f6b4aa2e0fea6dd4bcb96643bb297410e95 100644 (file)
@@ -295,8 +295,6 @@ def _real_extract(self, url):
                     'url': stream_url,
                 })
 
-        self._sort_formats(formats)
-
         return {
             'id': compat_str(channel['id']),
             'formats': formats,
index 2ebd3fa0968cd6c14c1fa9deb194a8ddb52cfe4a..c8ef240d70cd14675eebef4c0e1be3c90520add2 100644 (file)
@@ -73,8 +73,6 @@ def _real_extract(self, url):
             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,
index 26536bc65636c1d96e4589d5eaaabb4203363871..51a9cf38f73ffe03ef7217b2976b4fc5b38de1c6 100644 (file)
@@ -60,7 +60,6 @@ def _real_extract(self, url):
             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('&amp;', '&')
         formats = self._extract_mpd_formats(mpd_url, video_id, mpd_id='dash')
-        self._sort_formats(formats)
 
         return {
             'age_limit': 18,
index 06a44ddd14f78cd0acf43e9c0c283f8117ad7bbc..c8a1ec80b5b23adae2f584f93fc53081328d1599 100644 (file)
@@ -84,7 +84,6 @@ def _real_extract(self, url):
             })
         if formats:
             info['formats'] = formats
-        self._sort_formats(info['formats'])
 
         description = self._html_search_regex(
             (r'(?s)<section[^>]+class=["\']video-description[^>]+>(?P<value>.+?)</section>',
index 6afaf5e6e7f5fd3c451f9b4549caf243629c2cb8..5d8d7c100a4d40109f4f682c401ddec35a865619 100644 (file)
@@ -456,10 +456,6 @@ def add_format(format_url, height=None):
                 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(
index 96d2da7c75e3b8e732a88e78bf6cae33e9fe50ab..aa48da06b99f8924cdcf7285fc1a6d2b51dc5a1d 100644 (file)
@@ -55,7 +55,6 @@ def _real_extract(self, url):
                         'height': item.get('height'),
                         'bitrate': item.get('bitrate'),
                     })
-        self._sort_formats(formats)
 
         webpage = self._download_webpage(url, video_id)
 
index e4aa4bd35c09f4662d627662bdae8ee8296e05d3..0e029ce8cdade1af4938f46043024ed6b59ac027 100644 (file)
@@ -42,7 +42,6 @@ def _real_extract(self, url):
             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'],
index cb5ada1b9ad730c95f823b02af42dde639bcc2bb..46e2e8a8fa30457ab99affba94977d6b6ddff93c 100644 (file)
@@ -156,7 +156,6 @@ def fix_bitrate(bitrate):
                                 'tbr': tbr,
                                 'format_id': 'http%s' % ('-%d' % tbr if tbr else ''),
                             })
-        self._sort_formats(formats)
 
         return {
             'duration': float_or_none(video.get('duration')),
index a5dac1dff563794b13e185f44a94a762987041ea..482e5705f02cb10898e2ad3aa9d7af808ae36f37 100644 (file)
@@ -111,7 +111,6 @@ def _real_extract(self, url):
                 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)
index fa2454df455688a9e56bc31420310ad79a038b8a..92858259a5f5257f9b5c94b8ebbb53018a7d58ed 100644 (file)
@@ -122,7 +122,6 @@ def _real_extract(self, url):
                 'abr': details.get('abr'),
             })
         self._check_formats(formats, mid)
-        self._sort_formats(formats)
 
         actual_lrc_lyrics = ''.join(
             line + '\n' for line in re.findall(
index b459efceb5b2fbe17febb1a3db422799014a47b1..f067a0571b4e10a2bdb166f33d42e8dbea32274b 100644 (file)
@@ -66,7 +66,6 @@ def _real_extract(self, url):
                 f_copy['protocol'] = 'http'
                 f = f_copy
             formats.append(f)
-        self._sort_formats(formats)
 
         description = video.get('description')
         thumbnail = video.get('thumb')
index 498cc6be94a50bf681871ffd402db93b38f3a13f..f10292203479aed6a43def16c4530500a9ee6230 100644 (file)
@@ -125,7 +125,6 @@ def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token,
                     sf['downloader_options'] = {'ffmpeg_args': ['-ss', time_to_skip]}
             formats.extend(subformats)
 
-        self._sort_formats(formats)
         return formats
 
 
index dd6f899a4832d8e675897dd2a5b8fb8511df15b8..72c21d5022e95bb8a92fe571eb7a4308f2423fcd 100644 (file)
@@ -113,7 +113,6 @@ def get_meta(name):
             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')
index befb0b72b46fddc8c4101a889d0029eea4f2ba42..32c36d55777bc86c08fe4ebd002a1eca09ad7344 100644 (file)
@@ -38,7 +38,6 @@ def _real_extract(self, url):
             'abr': stream['bitRate'],
             'asr': stream['sampleRate']
         } for stream in broadcast['streamUrls']]
-        self._sort_formats(formats)
 
         return {
             'id': radio_id,
index 38420a15d694bf114d084d90816e450978c97bb0..92e51b7f45d0edcdb368416975d449921bb8431d 100644 (file)
@@ -46,7 +46,6 @@ def _real_extract(self, url):
             for i, fm in
             enumerate(re.findall(r"([a-z0-9]+)\s*:\s*'([^']+)'", formats_str))
         ]
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 6a61188991c2198bc78eef15b463441b38d56649..6a91394668c26dbf9083d1ed381399312eacb828 100644 (file)
@@ -50,7 +50,6 @@ def _real_extract(self, url):
                 'format_id': format_id,
             })
             formats.append(f)
-        self._sort_formats(formats)
 
         title = self._og_search_title(webpage)
         thumbnail = self._og_search_thumbnail(webpage)
index ed38a07f03451db9531e4002aa3433fa4a051765..9bcbb11d547ca914c90e530ae36837a1aca5e91c 100644 (file)
@@ -62,7 +62,6 @@ def _real_extract(self, url):
             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', {})
 
index cd19ec07b2d6862758b1fea4d1e607a5cc8d14bf..cab12cc214a0b64788cb4aeb9fc7b3e4d6056292 100644 (file)
@@ -313,7 +313,6 @@ def _real_extract(self, url):
         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 @@ def _extract_from_content_id(self, content_id, url):
         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 @@ def _real_extract(self, url):
 
         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 @@ def _real_extract(self, url):
 
         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),
index d69a1a216cc07affe86ba4147fa6f7f206c4cd0e..b905f8d2ee72f322ac6c5a67ec0c6c7c92dd132c 100644 (file)
@@ -196,7 +196,6 @@ def _create_formats(self, urls, video_id):
                 'format_id': 'http-mp4',
                 'url': urls['mp4']
             })
-        self._sort_formats(formats)
         return formats
 
     def _real_extract(self, url):
index 0cfecbc9a8301602900b6097373d22acc373aee0..27b4ad7bbcde0456b1f596f010063d06db9ba185 100644 (file)
@@ -194,8 +194,6 @@ def _real_extract(self, url):
             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')),
index ee510eb40f6cbefea7c5cd6e83b34b72e5230476..b59b518b135301b00f93b805ae81e19b56ddf2f8 100644 (file)
@@ -117,13 +117,10 @@ def _real_extract(self, url):
         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 @@ def _real_extract(self, url):
             '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 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
             'series': data.get('programLabel'),
             'subtitles': subtitles,
             'is_live': is_live,
+            '_format_sort_fields': ('res', 'proto'),
         }
index 50e61ba6e18a4675581b143a1c3d75debd92ed80..a01bc8434cf917b0b0f01c47e9ba2dece27e400f 100644 (file)
@@ -80,7 +80,6 @@ def extract_info(self, video_id):
         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_'):
index c713b24fed9bd2f463bf66d2ad401158dc0c08c3..cfd79abfd80081b59195669e8334e88714614198 100644 (file)
@@ -179,7 +179,6 @@ def add_thumbnail(src):
                 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,
index 92d996ca648755c4bb18dc920397833198e9aad8..f688d1e63153283baa644982d4f4e52a8d0d605b 100644 (file)
@@ -45,7 +45,6 @@ def _parse_gif_data(self, gif_data):
                 'height': height,
                 'quality': quality(format_id),
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 8e767b6e439e4a590689b3c6d4d32c8729931578..49076ccd815672dc254704701b1e57b4b73ff701 100644 (file)
@@ -110,7 +110,6 @@ def _real_extract(self, url):
             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(
index ab47ee5525c42c058720e4939d0be0e582262901..fdde31704c9479f46a7403bd32a2951eb6869425 100644 (file)
@@ -47,7 +47,6 @@ def _real_extract(self, url):
                 formats.append({
                     'url': src,
                 })
-        self._sort_formats(formats)
         return {
             'id': video_id,
             'title': title,
index cd3c20d7ae4b6531724ca0cff69ebe6c8063d1ec..6d032564d3f0f6ef285a91fe05a3ff3f8a10bb22 100644 (file)
@@ -31,7 +31,6 @@ def _real_extract(self, url):
         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,
index 1428b7cc9522f0a829005ab7eefcb353dcd30d48..6919425f3ad6f647095d60438008b74b5e3bdd58 100644 (file)
@@ -55,7 +55,6 @@ def get_json_value(key, fatal=False):
                     'ext': ext,
                     'container': container if method != 'mobile' else None,
                 })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 9ca47f3d43435a14faa7026d3c10a1da30088baf..3dd4d31deb735486a235376c3e2c19c60596f2e4 100644 (file)
@@ -88,7 +88,6 @@ def _real_extract(self, url):
                         'ext': 'flv',
                     })
                 formats.append(fmt)
-        self._sort_formats(formats)
 
         thumbnails = []
         for content_asset in content_data.findall('.//contentAssets'):
index 5f1db0f057c655e4bf0c487c6c6853029ac0b66b..c491aaf53476e4dd36cd0fa9295a833d75f258bf 100644 (file)
@@ -54,8 +54,6 @@ def _real_extract(self, url):
             if youtube_id:
                 return self.url_result(youtube_id, 'Youtube')
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
index fcef325bfd97292305caa3df3bd113e3b9e0f3e4..ade3cd0a43a02da8ca322d818ffeab0700974649 100644 (file)
@@ -112,7 +112,6 @@ def _real_extract(self, url):
                 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)
index 011dadfaa2d494fe5004ade4bd37b1b403406d13..776fbfbc08e2600907657b730b6e3c9c7e38b5f7 100644 (file)
@@ -146,7 +146,6 @@ def _real_extract(self, url):
 
         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,
index 93faf1b324f95497c94dc899d185bccc43bc09e6..aedaa5b5501818c500f9b55e14516f4610a431d5 100644 (file)
@@ -94,8 +94,6 @@ def _real_extract(self, url):
                     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
 
index afa0d33cf5f1861f854c86d830e74fe0d6f1243c..056cf87d2929198ed783aa2841786fad9bef1d53 100644 (file)
@@ -94,8 +94,6 @@ def _real_extract(self, url):
         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 @@ def _real_extract(self, url):
             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)
index 3852a3a1353f624d016ad81dd67697b6c0ba72cc..724cb64e9319c49955839765d7e106f8e89156b1 100644 (file)
@@ -116,7 +116,6 @@ def _real_extract(self, url):
 
         formats = self._extract_m3u8_formats(
             m3u8_url, uuid, 'mp4', m3u8_id='hls', fatal=False)
-        self._sort_formats(formats)
 
         thumbnails = []
 
@@ -174,7 +173,6 @@ def _real_extract(self, url):
         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,
index 6644538ed1bac4be08191a1522157978e717f9a2..81c4d7cac83a12aa5020ffb43dd26cd101ed37f1 100644 (file)
@@ -212,7 +212,6 @@ def extract_bitrate(url):
             })
 
         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):
index b9b181feb622837b5e4f6daa7b985db689df544d..a99a266c6083dd9d6e939887838f86dabf9b8feb 100644 (file)
@@ -130,7 +130,6 @@ def _extract_png_formats(self, video_id):
                     'quality': q(quality),
                     'url': video_url,
                 })
-        self._sort_formats(formats)
         return formats
 
     def _real_extract(self, url):
@@ -238,7 +237,6 @@ def _extract_png_formats(self, audio_id):
                     'quality': q(quality),
                     'url': audio_url,
                 })
-        self._sort_formats(formats)
         return formats
 
     def _real_extract(self, url):
index 58af3dda2cf8ce452f61b20d7e0b56e46ff14d5d..7c6174494b80e90e6c7d85e7d61e3b75c5a2513e 100644 (file)
@@ -49,7 +49,6 @@ def _real_extract(self, url):
             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,
index fb06efa4b9387e990fdad9632ef078862679f403..a84a78da8dceffaa35fa1c479423bd4e6afe55c2 100644 (file)
@@ -72,7 +72,6 @@ def _real_extract(self, url):
             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,
index b63ccb96f88e3900161014042867f72d7086e091..05942b6b443d1ca8710c99c8cd5cebf7057050a4 100644 (file)
@@ -133,7 +133,6 @@ def _real_extract(self, url):
         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')))),
index bb113d822d677723f9d9bddff29c5f64f7d5e885..9d15f4d214d29f96fe8188a7b123c61a381f8f3e 100644 (file)
@@ -51,8 +51,6 @@ def _real_extract(self, url):
         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,
index 27040646b99a691ffa00d676be6e3e9ed8c6ce10..102615c6077342849a243b4681aa0ecca38eafcb 100644 (file)
@@ -202,7 +202,6 @@ def _real_extract(self, url):
                         'height': 'h',
                     }, default={})
                 })
-        self._sort_formats(formats)
 
         subtitles = {
             lang: [{
index cad3caa605ede5f327a0a72161c08f3365fa334e..5a4fd975e05e7a69668088f3220a95d5bb990d2a 100644 (file)
@@ -81,7 +81,6 @@ def _extract_formats(self, options, video_id):
                     'url': format_url,
                     'format_id': format_id,
                 })
-        self._sort_formats(formats)
         return formats
 
     def _download_and_extract_formats(self, video_id, query=None):
index 75da01f7d3ddba3662546567f809b35188b59a04..d7f9a73377de50d89f1b879935d984ce0b84adb0 100644 (file)
@@ -189,8 +189,6 @@ def _real_extract(self, url):
                 })
                 formats.append(fmt)
 
-        self._sort_formats(formats, ('source', ))
-
         return {
             'id': video_id,
             'title': title,
@@ -201,4 +199,5 @@ def _real_extract(self, url):
             'formats': formats,
             'subtitles': subtitles,
             'is_live': is_live,
+            '_format_sort_fields': ('source', ),
         }
index 3f6d30d3c42f13eadd56465be770de14cde458c1..33f6652df5651dfcbd0f31b995157a9729fb3cbf 100644 (file)
@@ -244,8 +244,6 @@ def pv(name):
             if ns_st_cds != 'free':
                 raise ExtractorError('This video is %s.' % ns_st_cds, expected=True)
 
-        self._sort_formats(formats)
-
         themes = pv('themes')
 
         return {
index 9a601a01c372b0f8ea3442449090c2470493e047..beffaee592e3a1802d0561161d9dd324293a77b5 100644 (file)
@@ -98,8 +98,6 @@ def _real_extract(self, url):
                 'height': 720,
             })
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
index eae652af7d48498673548ecd6ba7c543196be769..5ab0b6c601fdb1eb631a5b2aa29ecaa2e9b39267 100644 (file)
@@ -49,7 +49,6 @@ def _real_extract(self, url):
             'format': 'mp4',
         })
 
-        self._sort_formats(formats)
         return {
             'id': video_id,
             'title': traverse_obj(
index 8469f487a23fc85e5a1f3bcf17081abb087e093a..4f9fa144033e78457c735e45a0a538df5768fa7b 100644 (file)
@@ -93,8 +93,6 @@ def _real_extract(self, url):
         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'),
index 6fec7c0bb3cbfb667d6fdf19525d6842c102bd3b..7ff0cf5b72bfd0f84995b0b0c03724ad97132549 100644 (file)
@@ -131,8 +131,6 @@ def _real_extract(self, url):
                     entry['format_id'] += mobj.group('tag')
                 formats.append(entry)
 
-            self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
@@ -187,7 +185,6 @@ def _real_extract(self, url):
         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>([^<]*?)</title>'), webpage, 'video title')
index 5ff06f19d58b2c61f976fc5bfc348984a1c6b97c..3600e2e740c3f8fd732105e68f611e04a43e4ba9 100644 (file)
@@ -77,9 +77,6 @@ def _real_extract(self, url):
                     '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 @@ def _real_extract(self, url):
                 '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)
 
index ac030ea41bdfa24f7ef95cf3c5fd648a6784b9a0..490d562672385eb4d3292d2653080856cb802fd8 100644 (file)
@@ -104,7 +104,6 @@ def _real_extract(self, url):
                     'width': int_or_none(resource.get('width')),
                     'height': int_or_none(resource.get('height')),
                 })
-        self._sort_formats(formats)
 
         attrs = {}
         for attribute in video['attributes']:
index 000f7e166abc4cb94ea3415fee5bd3a975542c7c..3117f81e3880f828dfb99f8e21828aab76082cb8 100644 (file)
@@ -34,7 +34,6 @@ def _real_extract(self, url):
                 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'<title>([^<]+)\s*-\s*Sexu\.Com</title>', webpage, 'title')
index 05642a1168df7972b7315dd43799750244d72969..79e88858356f470e48095b88e1ca7f1159cbcc05 100644 (file)
@@ -93,7 +93,6 @@ def get_url(format_id):
                 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):
index 53ca86b73e0cf0304b436ef64a081e222878def4..26a0bff4008b17dd87d75fa0b874b565cde8e5df 100644 (file)
@@ -118,7 +118,6 @@ def _real_extract(self, url):
             # 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, {
index c0780abe2eaf49f002c0129ba04a5e8972d6fe50..7a78c6e054aa9aaf18dc0bb1c6e189099fd92da6 100644 (file)
@@ -74,7 +74,6 @@ def _real_extract(self, url):
         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-]+)'),
index cd681a0351002b6178db2a8332027ab54545500a..ab1895311830a59a766a157df577b3b5dc64d60e 100644 (file)
@@ -66,7 +66,6 @@ def _real_extract(self, url):
                     '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),
index d30d57d858355fdbbe060d05627bdb3b8acad28f..aeba4e3771042354159312bdbac9ec71a5c11ed7 100644 (file)
@@ -97,7 +97,6 @@ def _real_extract(self, url):
                     'quality': preference(quality_id),
                     'ext': 'mp4',
                 })
-            self._sort_formats(formats)
 
             return {
                 'id': video_id,
index b7b7d7d7fdf713abde046eb1fb5e5aa93145e296..a6fb6c1f5b865adf57c939d716de43e9a8cdfc61 100644 (file)
@@ -104,7 +104,6 @@ def _real_extract(self, url):
                     'quality': quality_key(quality),
                     'ext': ext,
                 })
-        self._sort_formats(formats)
 
         def get(getter):
             for src in (data, clip_data):
index 9e4d7d35dea116554367d08ba90e9885e5e637b8..42d30f7c4c98719e7c74c01f5f9658df4a9d7515 100644 (file)
@@ -42,7 +42,6 @@ def _parse_video(self, video, video_id):
             self.raise_geo_restricted(countries=['IT'])
 
         formats = self._extract_m3u8_formats(hls_url, video_id, 'mp4')
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 87d0fec3209aaf5e66f836be901a7ade4a2ec290..9a60a79e73bb1e655a0683925a6a1f55fef8ae19 100644 (file)
@@ -85,7 +85,6 @@ def _real_extract(self, url):
                 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,
index c3a13595589641abb3397e53611bb8380f889f2a..a8f1e4623e1c4b49afe72b8a49cade7d0021d7a6 100644 (file)
@@ -176,7 +176,6 @@ def _fetch_data(vid_id, mytv=False):
                     '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),
index 17d28478f9c79feb97cf08eb4e689f314a8e9001..aaad420f12f0472fc8893e258b3ef74ffba8e490 100644 (file)
@@ -150,7 +150,6 @@ def _real_extract(self, url):
             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']
index 228e19c3e99503d8c6c07926db40e596f92aa52a..4879d48c8079ff7a451b8c1fc9c8f30e553aaed8 100644 (file)
@@ -296,7 +296,6 @@ def add_format(f, protocol, is_preview=False):
 
         if not formats and info.get('policy') == 'BLOCK':
             self.raise_geo_restricted(metadata_available=True)
-        self._sort_formats(formats)
 
         user = info.get('user') or {}
 
index f1243cc492f0027cbda240fe23dbb5bc58bdb170..453016ccb309f253f4781d12d5508600f3226751 100644 (file)
@@ -104,7 +104,6 @@ def _extract_bunnycdn_iframe(self, video_id, bunnycdn_id):
         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
index 1aa8eaba1daa7313851e8729826811030203524c..f242d334c9420d8fb66c486bf49e23e5fed06380 100644 (file)
@@ -128,8 +128,6 @@ def extract_format(format_id, format_url):
                     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(
index d1990e4de7dbeb6519f7ab7c357619a91f7effc3..334b29773c5afe3d6d479aebb06c5ba373deae5d 100644 (file)
@@ -101,7 +101,6 @@ def _real_extract(self, url):
             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'))
 
index f4ac98b6e02a760704a8bcc9caca5a413d99e28d..44b4067de3a1f194eb2cf9048323fd30152399ef 100644 (file)
@@ -74,7 +74,6 @@ def _real_extract(self, url):
             '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,
index 622a81b47c128d4b144254843020c65f9da5152f..ccbb0e8ccf4a480dc15750e6fdc292459ca1d28f 100644 (file)
@@ -65,7 +65,6 @@ def _real_extract(self, url):
                 formats.append({
                     'url': src,
                 })
-        self._sort_formats(formats)
 
         player = self._parse_json(
             self._search_regex(
index 539a6420943e04a987480f797ca2d3f3bc7fe80b..a98584a27d5fea716d4778f0c2ec85577afaf64e 100644 (file)
@@ -102,8 +102,6 @@ def _real_extract(self, url):
         })
         formats.append(m3u8_format)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
index 6dd31298510f6b7e0e86ff45aa65a722a0214264..145f25e9f7602856c620e8365b2c1bcc9b072a1e 100644 (file)
@@ -128,7 +128,6 @@ def _real_extract(self, url):
                     'url': podcast_url,
                     'quality': q(quality),
                 })
-        self._sort_formats(formats)
 
         if media_type == 'video':
             for sub in (media_data.get('subtitleList') or []):
index ee03f78376a7d2fb0f0466ffb64dc2a16838202c..e92122f9b764b37e8e48b410fd59f7a73e531ef2 100644 (file)
@@ -49,7 +49,6 @@ def _real_extract(self, url):
 
         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)
index eea20ff855a4c8e14af5b56e1e808ebd417044cc..7daee2fe03c7068daef087b8aef960a6011ff988 100644 (file)
@@ -109,7 +109,6 @@ def _real_extract(self, url):
                                 'format_id': ext + quality,
                                 'url': video_url,
                             })
-            self._sort_formats(formats)
             entry['formats'] = formats
             entries.append(entry)
         embedded_videos = re.findall(r'(<iframe[^>]+>)', webpage)
@@ -163,7 +162,6 @@ def _real_extract(self, url):
             '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),
index 3e60479ad04eb0ba76e237406122218c71288411..462861e0e089697f1ba51c9b679ed04bdc58d9cc 100644 (file)
@@ -89,7 +89,6 @@ def _real_extract(self, url):
                 '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,
index f8c37c0dd5368e250bcad5c30a69787c9d058286..6eaee52d95e4124ac2d022e1eddbfa34b6eb38c6 100644 (file)
@@ -35,7 +35,6 @@ def _real_extract(self, url):
         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,
index 849a9882da37aba3060ff8e205aebafd87ba8b6a..c4537ba8df8a058d8687e43d4fb89b33811b2fe4 100644 (file)
@@ -109,7 +109,6 @@ def _real_extract(self, url):
                 })
 
         formats = list(self._extract_formats(spl_url, video))
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index d04aa1db065adf7fd28b772b28c53bec768bd585..4229a0bf16d2230620b94da5729c0d7ef366f9b5 100644 (file)
@@ -51,8 +51,6 @@ def _real_extract(self, url):
         if not formats:
             self.raise_no_formats('No active streams found', expected=True)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': video_id,
index 787b9f70d68d51964caa9f1343e24a8168e5f238..fa3826388b6a05b06efbfa8870bcebf2da68bb74 100644 (file)
@@ -88,7 +88,6 @@ def _real_extract(self, url):
         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,
index 19498701c646fa31ceee916227cb11e77acd2ccd..708873a9566f6da8512f994617c53fd921aefc27 100644 (file)
@@ -61,7 +61,6 @@ def _real_extract(self, url):
                 'format_id': video_ext,
                 'quality': quality(video_ext),
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 4a4b5cf7ef44cb96acf9bb2ce116e8a4fdd273aa..65da615d00c7bca3c56701cb55fa9237dbd4df60 100644 (file)
@@ -58,7 +58,6 @@ def _real_extract(self, url):
                 'vcodec': 'none',
                 'url': audio_url,
             })
-        self._sort_formats(formats)
 
         return {
             'id': audio_id,
index b422b6d93467d75e52ff1386ab672999105c6b7e..31bf7f97e6430245e44d002cfe25c084a352563e 100644 (file)
@@ -51,7 +51,6 @@ def _extract_video(self, video_info, video_id):
             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):
index deebdd1a4adaadc3a498dc1a8584dfe3d42ac939..38bdfced76b0a22cecbba843088026c48ab59192 100644 (file)
@@ -92,7 +92,6 @@ def _real_extract(self, url):
                     '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')
index 9b9513f07566499e757a2c5e0bc488447a8f2f2f..ea0532c24e13b0501bb5b384ee9449e99a4c1313 100644 (file)
@@ -139,8 +139,6 @@ def _real_extract(self, url):
         timestamp = video_info.get('timestamp')
         title = title or video_info.get('description')
 
-        self._sort_formats(formats)
-
         return {
             'id': display_id,
             'title': title,
index d20dacfc1fb5854b600deb59432b46c08cb7fb7a..67e544a6a38fafe8a611b1bb116814e6b858409d 100644 (file)
@@ -48,7 +48,6 @@ def _real_extract(self, url):
                 'format_id': label,
                 'quality': quality(label),
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 2bf836abd7f8012a7c1a966e25f2c9ce4370a3e5..c3eec2784f6764fb7af477c53a580034e1454c52 100644 (file)
@@ -73,8 +73,6 @@ def _real_extract(self, url):
             } 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)
index 840702ed9e582cbc08615de759d7cc648d421886..a822b676f60f576da84569ac96363209237ef33a 100644 (file)
@@ -196,7 +196,6 @@ def _real_extract(self, url):
                         'format_id': format_id,
                         'quality': get_quality(format_id),
                     })
-            self._sort_formats(formats)
             info['formats'] = formats
 
         return info
index 0e09ec75758f3560872189ef47d5714a1b0506da..c28a1549876aba7dc0c336d66fbb772756427f18 100644 (file)
@@ -125,8 +125,6 @@ def _real_extract(self, url):
             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
index 8e35bc85fe8249e7ff7504de3cc9121ddeca187a..212af3785034c3678ad08c2f902e2e7963ca81f3 100644 (file)
@@ -71,7 +71,6 @@ def _real_extract(self, url):
                         'ext': ext,
                     })
                 urls.append(format_url)
-        self._sort_formats(formats)
 
         return {
             'id': display_id,
index 8d87b6ec1faea5923c0848af885de3070667bdf0..2c50a67e95217632e113ece0b4e71f74d22ba067 100644 (file)
@@ -59,7 +59,6 @@ def _real_extract(self, url):
         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
 
index a9c0755f4881431944f1d3d2f4577880d8f9beeb..20bb824208776c14e47fb47eeb8872a813979645 100644 (file)
@@ -102,7 +102,6 @@ def _parse_content(self, content, url):
             }).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,
index 6562d122cdaaaa515b1e9c1a7c81fb5aa358e6f1..13e9515f8ddfb86482f4a70f27a9e79ea26b8e0c 100644 (file)
@@ -75,8 +75,6 @@ def _real_extract(self, url):
                 'format_id': 'http' + ('-%s' % label if label else ''),
             })
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
index 39f1a628a0410ccb1973976d96e7e5a264dabda1..5ec54857d6ebf53cb801f30ead21102eaf839f57 100644 (file)
@@ -113,7 +113,6 @@ def clean_text(html_class, html):
                 '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}),
index 7e444c0d092a24c6b4a5d7cbfcbc72b200545599..3d29dace305287254426bac1c036f8d941fdf7ef 100644 (file)
@@ -57,7 +57,6 @@ def _real_extract(self, url):
                     '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(
index 64954b8f1b5d7ae5dfca025b104f73de6e5ec786..88f29cb83c779fefcd4ad680aaa8d9717f16a5fc 100644 (file)
@@ -40,7 +40,6 @@ def _real_extract(self, url):
             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 {
index 61f300fa4c76404d2e4fcd3a9de56573ed2ec718..ff8bf991efd68d5392eb9ee8ab8d77c70758931c 100644 (file)
@@ -116,7 +116,6 @@ def _extract_all_video_formats_and_subtitles(self, url, video_id, series_id):
             formats.extend(fmts)
             self._merge_subtitles(subs, native_subtitles, target=subtitles)
 
-        self._sort_formats(formats)
         return formats, subtitles
 
     def _get_clean_title(self, title):
index 47cb0965e0c9236f65a31a7c6e40aa945e08a7ed..bc64226bf0180bbcbd3b9f2f6bffb4aa906e315b 100644 (file)
@@ -138,8 +138,6 @@ def _real_extract(self, url):
         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),
index fc47814473063b895a84bff4e509526761d94eea..633032e310c5a55698f9ae5004ebcfaa96980a8d 100644 (file)
@@ -98,7 +98,6 @@ def _real_extract(self, url):
         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,
index f0a096d412e805b66f7415e92ac8603a9bd601aa..a13f83bffadf3b8fd26193e16ef86653e2052268 100644 (file)
@@ -24,7 +24,6 @@ def _real_extract(self, url):
             r'(<div[^>]*\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,
index c8026d2941340b67c94ea3c2393dc99c2aa87594..e659b8ee10d5ac661129f66f7dffc58940099d02 100644 (file)
@@ -296,7 +296,6 @@ def _real_extract(self, url):
             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 @@ def _extract_feed_info(self, provider_id, feed_id, filter_query, video_id, custo
                 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')),
index 3ec6b971181a0e4dada0a0c0fb563483978d3776..ecf0ea091dd3d79419ff0cff96465da58682ea8d 100644 (file)
@@ -41,7 +41,6 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
         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,
index 4f6d2ecbad2213bbc5e5f4a50cdc4110b06bfe71..682e4335d2c55fa1d6ab76b8ee5244257b887645 100644 (file)
@@ -79,7 +79,6 @@ def _real_extract(self, url):
                     'url': variant_url,
                     'format_id': variant_id,
                 })
-        self._sort_formats(formats)
 
         cc_url = video_data.get('cc_url')
 
index a313a8dfbe6332a0b9c94d6cdf8fdd940777b0a7..b1041902bff290f42a73f1a951b9c41fadf29ac2 100644 (file)
@@ -128,10 +128,6 @@ def _real_extract(self, url):
                         '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 @@ def _real_extract(self, url):
             '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')
         }
index ce28a37c07a2e0a88de22a32fb23bcaae45ba801..dbd5090878eb87e743de89f860dfc8b81758ba36 100644 (file)
@@ -57,7 +57,6 @@ def _real_extract(self, url):
                 'quality': 11,
                 'format_note': 'Original file',
             })
-        self._sort_formats(formats)
         return {
             'id': id,
             'title': data_json.get('title') or data_json.get('root_title'),
index 79a22386120dda2ff31430ed6e1f43621145acff..0ca6f5afdab05d6b143247892724155fa7cc7300 100644 (file)
@@ -233,7 +233,6 @@ def extract_addr(addr, add_meta={}):
         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 @@ def extract_addr(addr, add_meta={}):
             '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 @@ def _parse_aweme_video_web(self, aweme_detail, webpage_url):
                 'height': height,
             })
         self._remove_duplicate_formats(formats)
-        self._sort_formats(formats)
 
         thumbnails = []
         for thumbnail_name in ('thumbnail', 'cover', 'dynamicCover', 'originCover'):
index eceaadb308cf4a163a4b5d92b714f129a25d252a..4482c84746ae350124dbd2a23e62b4b24a0eaab5 100644 (file)
@@ -162,7 +162,6 @@ def extract_video_url(vl):
         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,
index 51a51d84b928b76b0a2caf75c1ab4fea31e5164f..70737337cfdf3662ed913639341eb5495521a137 100644 (file)
@@ -154,7 +154,6 @@ def _real_extract(self, url):
                         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', []):
index a30cabb3ce671539c993b2f2eb8172f9ff513d88..d022e27533588388ed837e7a1f93c9fdcc95f07c 100644 (file)
@@ -95,8 +95,6 @@ def _real_extract(self, url):
 
         description = remove_end(description, 'Category')
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'formats': formats,
index 2d633ca67da48bdc89067a6ef0ee5aa9389bebc0..acd9e68d2573ba5ee69fc082cf57553693bde924 100644 (file)
@@ -114,7 +114,6 @@ def _parse_video_info(self, video_info, username, user_info=None):
             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'))
 
index b7aa74060a6f78c56f8e2a6f924f856a496afe04..545a67275ad09194dc43c38ccc88f474560fc0ea 100644 (file)
@@ -95,7 +95,6 @@ def _real_extract(self, url):
                 'tbr': stream_info.get('bitrate'),
                 'http_headers': self._HEADERS,
             })
-        self._sort_formats(formats)
 
         info = {
             'id': program_id,
@@ -222,7 +221,6 @@ def _real_extract(self, url):
                 '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'))
index 89371b6eb7eb739161fe2fa557effd9ae484682b..ebabedc9c4814e0a187fa39a2d75fcf878ceed11 100644 (file)
@@ -37,7 +37,6 @@ def _extract_episode(self, episode_info):
         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'))
index f5ed950be6ed52d2c870211568eae35498ccbff1..de8b5da69763bbc79e0bf1ce3e7c1a129129f09d 100644 (file)
@@ -103,8 +103,6 @@ def _real_extract(self, url):
         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:
index 5d66151002a4142bcbe9b714f56e8952093b1edf..88d4ae32de898631f86c728b84abd683898d64a5 100644 (file)
@@ -358,7 +358,6 @@ def _real_extract(self, url):
             '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.
index f163eaf0957c338d1311300a9295e291cee02b24..43b4f673cd1c92d2b1277bbf392aa429098668cf 100644 (file)
@@ -49,7 +49,6 @@ def _real_extract(self, url):
                 'source_preference': reliability,
                 'format_note': format_note,
             })
-        self._sort_formats(formats)
 
         return {
             'id': content_id,
index 2973d15ec530d6c766c925e6d17f90a2192ed35b..e4e507b00412cc6a2874e24b144de46cf0fb0c85 100644 (file)
@@ -57,7 +57,6 @@ def _real_extract(self, url):
 
         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(
index e3f8941c44d4d24c0347ccb16d13448587944316..cdb7dcff85af6ecc6503913eccd376cf3219c17e 100644 (file)
@@ -53,7 +53,6 @@ def _real_extract(self, url):
                     'url': child.text,
                     'quality': get_quality(quality),
                 })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index fae8b51e76c8a50a70b7c3ddc24e805c23c22b4b..630d84bdc39fa10907af0de0d2fed905fe91f65f 100644 (file)
@@ -174,7 +174,6 @@ def _extract_cvp_info(self, data_src, video_id, path_data={}, ap_data={}, fatal=
                             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 @@ def _extract_ngtv_info(self, media_id, tokenizer_query, ap_data=None):
                         'start_time': start_time,
                         'end_time': start_time + chapter_duration,
                     })
-        self._sort_formats(formats)
 
         return {
             'formats': formats,
index 0024f7241428e4ababdfc72716805fcb07d2e8cd..c51e63371286b496d26b05f7e42a4e2b187f9b80 100644 (file)
@@ -95,7 +95,6 @@ def _real_extract(self, url):
                     })
         if not formats and data.get('drmProtected'):
             self.report_drm(video_id)
-        self._sort_formats(formats)
 
         thumbnails = [{
             'id': type,
@@ -258,7 +257,6 @@ def _real_extract(self, url):
                     })
         if not formats and data.get('drmProtected'):
             self.report_drm(video_id)
-        self._sort_formats(formats)
 
         thumbnails = [{
             'id': thumbnail.get('@type'),
index 8d2475296f8e1c45b9fc62abdd8263f677883162..89905acdb7ae53379b2e3680a45e8de6111fa5d2 100644 (file)
@@ -68,7 +68,6 @@ def _real_extract(self, url):
             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,
index 0af28631261471a1c0e7b44da977543d07491559..35e92f10c4dffeb486b0cf3511faee8a019d0f20 100644 (file)
@@ -164,7 +164,6 @@ def _real_extract(self, url):
                 formats.append({
                     'url': src,
                 })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 6ac07716ba912c666ed26540ac0c4fb921e07f4d..d4c21c046eec12a41bb96bc11c49f97434acd7b6 100644 (file)
@@ -66,7 +66,6 @@ def _real_extract(self, url):
         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,
index e8cdd5c8cb27ac3d2207e5cfe6743b9ed1a8d4ec..1378a6f574671822111e409a225c3ad999d2176c 100644 (file)
@@ -119,8 +119,6 @@ def _real_extract(self, url):
         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,
index d449cdc0423da19d6bcd4b22c47180a6559080e7..bd0be784d29de19bf1e40181163f518bfa475930 100644 (file)
@@ -77,7 +77,6 @@ def _real_extract(self, url):
                     'url': v_url,
                     'format_id': video_format,
                 })
-        self._sort_formats(formats)
 
         metadata = self._parse_json(
             vpl_data['data-metadata'], display_id)
index 1ef64caf9a9fc263a6e1f37a83a8c95b36118c1d..caa76ab6f2299e8e95b1386b998f9ddab2a77f64 100644 (file)
@@ -41,7 +41,6 @@ def _real_extract(self, url):
                 'height': int_or_none(info.get('height')),
                 'tbr': int_or_none(info.get('bitrate')),
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 9a7cb7214ceafdeaf2f1259832a0ad2cae278e56..6c982193d566d7aa65de9441db652268ed8eeffe 100644 (file)
@@ -120,7 +120,6 @@ def _real_extract(self, url):
                         'height': int_or_none(height),
                         'filesize': filesize,
                     })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 22b6058231a4ae4296de376b97c2b0d8fe231e38..9c777c17d8d529c82aacee1d6c8131c18fff6a59 100644 (file)
@@ -70,7 +70,6 @@ def extract_json(attr, name, default=NO_DEFAULT, fatal=True):
                 '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(
index 5820bb4a7b69009b8203d9ca6039337eb69551e6..77426f7e6800847f00e1cf4dad20c4d68af1ddb4 100644 (file)
@@ -109,7 +109,6 @@ def _real_extract(self, url):
             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'):
index 24add5260575993621fef78620ba93389e7dc6bb..0acc306df26ca9caa4f25daa7cf31f8709d4f5f6 100644 (file)
@@ -74,7 +74,6 @@ def make_urls(proto, suffix):
             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 @@ def url_repl(proto, suffix):
             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'))
index d8be12c964c122de308f4e67f962978a4e39c645..e208e57f2f736b197fbba8df15b94b9323b24439 100644 (file)
@@ -69,7 +69,6 @@ def _extract_formats_and_subs(self, response, video_id):
                 continue
             formats.extend(formats_)
             self._merge_subtitles(subs_, target=subs)
-        self._sort_formats(formats)
         return formats, subs
 
     def _real_extract(self, url):
index c83b997622bd172d99b3333ec26ab8ff184a9fdf..8483564f74b398dfeb71c95466a8c2e416ebb9a7 100644 (file)
@@ -433,8 +433,6 @@ def _real_extract(self, url):
                     '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 = []
index f815b5137910ffde50dbca3fea74ba3eefba4d71..9ef4f962c5c7ee05a3a124e138a4dce4ad1c887d 100644 (file)
@@ -294,8 +294,6 @@ def _real_extract(self, url):
                 '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 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
             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))
index 31d70b6b835b991f521ea880f13e296570a61ecd..b05355f876f249faef7d80741f2d6d7c6566555b 100644 (file)
@@ -72,7 +72,6 @@ def _real_extract(self, url):
             raise
 
         formats = self._extract_m3u8_formats(response['stream'], display_id, 'mp4')
-        self._sort_formats(formats)
 
         return {
             'id': resource_id,
index 6d1f92bbb4299e0343ec2a616417de48708554ff..e8e1fc666fdf53d7cdf1d9579e9c0c87f49ec0ac 100644 (file)
@@ -47,7 +47,6 @@ def _real_extract(self, url):
                     'height': height,
                     'ext': ext,
                 })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index f33f15914a12708364c67e012d3902f71409f186..74f90b00bf00646d854d3b314111519c5f256a70 100644 (file)
@@ -57,7 +57,6 @@ def _real_extract(self, url):
             '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')
index 9046f994db27d6df683aed73075f07edbbb25d9b..735cb0bb088397b0207fcbe1063d5c90b9a41047 100644 (file)
@@ -186,15 +186,13 @@ def find_dmu(x):
                         '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,
index 975e09c30209b726fdbdb978293b556e371bd477..c59d1cf1711596351e1b5ab45723e8a17cc5677f 100644 (file)
@@ -133,7 +133,6 @@ def _prefer_source(self, formats):
                         '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 @@ def _real_extract(self, url):
                 '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'):
index 48c14ddce1d176117bf6039e655f605594ea03c2..3c81473dc8f1d9b2102670f660e931089b68d2d0 100644 (file)
@@ -876,7 +876,6 @@ def extract_from_video_info(media):
                 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 @@ def add_thumbnail(name, size):
                 '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 @@ def get_binding_value(k):
                 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'):
index 2c8a35473cd6b8520953ff654639a0018a300ae7..8b99c59cf546430d06073002ea9cd4da822823ee 100644 (file)
@@ -391,8 +391,6 @@ def extract_subtitles(track_list):
                 if f.get('url'):
                     formats.append(f)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
index 9fdb46faf6c9b4bb88896cb8896cbae254141df1..10668ac4b8caccae19b08fd8d443022095c4b1c6 100644 (file)
@@ -90,8 +90,6 @@ def _real_extract(self, url):
                     })
                 formats.append(a_format)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'formats': formats,
index e6ed656b923acab0cf99337b79537cbf29524016..3ffcb7364ad9690619cd4c1e2b653cfd521a1244 100644 (file)
@@ -86,7 +86,6 @@ def add_m3u8_format(format_id):
         if not formats:
             for format_id in (867, 836, 940):
                 add_m3u8_format(format_id)
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 083c87209e1bfb961bffe90bb622819f06d9c618..6e872cd14f800d7527cb804760e16fda2cf6331c 100644 (file)
@@ -47,7 +47,6 @@ def _real_extract(self, url):
                 'format_id': format_id,
                 'quality': quality(format_id)
             })
-        self._sort_formats(formats)
 
         title = self._html_search_regex(
             r'<title>UTV - (.*?)</', webpage, 'title')
index e3d9127d8ed6a1c97adbbd0997383b4861f58592..068c2b87dbcbdf2872481ce4690f16d12d7685b8 100644 (file)
@@ -107,7 +107,6 @@ def _real_extract(self, url):
                 'url': f_url,
                 'quality': quality(format_id),
             })
-        self._sort_formats(formats)
 
         tags = []
         for tag in video_data.get('tags', []):
index 9b560f719603583636180ae8945a68f2c22d937e..87c427f63fa3c3f71a86f7812e91275b126ce30a 100644 (file)
@@ -33,7 +33,6 @@ def _extract_uplynk_info(self, uplynk_content_url):
         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)
index 3f687f737bdf700a3bd3e928879aad309be11797..debd2ba9eccaf406b4d652cd99a3c8b07a4176df 100644 (file)
@@ -40,7 +40,6 @@ def _real_extract(self, url):
                 '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'],
index 30bd3dcbf3965dd54024683ae74131574d2d8254..0f0d6592d869ba95c45eca4d0f35e2f1a9acc329 100644 (file)
@@ -76,7 +76,6 @@ def _real_extract(self, url):
                 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 = {}
 
index cb920bf13b9dd3555cbe716f6a2d44e429e184c5..5df2416537cfe4b18a9b039733ad40d35eafadbe 100644 (file)
@@ -210,8 +210,6 @@ def _real_extract(self, url):
                 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'))
index fd5dad0fc03b4af2440e210e14e5a119bec0514e..c3aeeb9615c674647dd25dcf6d75b32622281b38 100644 (file)
@@ -39,7 +39,6 @@ def extract(kind):
             } 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 @@ def _real_extract(self, url):
                     'width': int_or_none(quality.get('width')),
                     'height': height,
                 })
-        self._sort_formats(formats)
 
         thumbnails = []
         for image in video_data.get('images', []):
index 1213ae1bf5f3e1d3a0dc1a1a6218de264660b463..90c10c051a7909abba93dacd8143c145601c71e4 100644 (file)
@@ -68,7 +68,6 @@ def _real_extract(self, url):
             '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,
index 25d462a7d00517626f3bcfc231b7eceb24f10c3b..ef44d421ec6fd7600ad512197b7e77f6ce282316 100644 (file)
@@ -65,8 +65,6 @@ def _real_extract(self, url):
                 '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')),
index d9b3ab115a2461a307eefd94e2cc7b10a7a0214c..92ff86521a0ea14e2da0302ed493f3b0ff2a77bb 100644 (file)
@@ -105,7 +105,6 @@ def _real_extract(self, url):
                     'quality': q(f_id),
                     'url': f_url,
                 })
-        self._sort_formats(formats)
 
         categories = metadata.get('categoryPath')
         if not categories:
index a146be04862f9b4e71faf65b9f3b266bc62d90c4..da4ce49ca68660e70c0fed0573698c48dbc38ce3 100644 (file)
@@ -274,7 +274,6 @@ def _real_extract(self, url):
                     'width': int(m.group('width')),
                     'height': int(m.group('height')),
                 })
-        self._sort_formats(formats)
 
         track = video_info['title']
         if featured_artist:
index b637afddf1e4b55c218c5532a4d48f591d99d7ca..db338fa1063ede6f9e7ec265c73445f7050911ae 100644 (file)
@@ -238,8 +238,6 @@ def _real_extract(self, url):
                 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'],
index f3ad56bf1151d0f08f9dfa0d528ceb4e99523891..d1a3b48aac1cf841a38371a00f3651c1cd9d93f8 100644 (file)
@@ -150,7 +150,6 @@ def _real_extract(self, url):
         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 {}
index d81a31375d6520279d5e7e0201cd78b23f2faa1e..40914774ab61d10c48597ef07068d5178bb8840a 100644 (file)
@@ -116,7 +116,6 @@ def _real_extract(self, url):
                 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]
index fa16da28b49eb6f194d9a9fcd9e9ffc4f3c37f9d..52fa8fcec2ab5909ad78483d3072fdb3d74ce54e 100644 (file)
@@ -167,7 +167,6 @@ def _real_extract(self, url):
                 'height': int_or_none(source.get('height')),
             })
             formats.append(f)
-        self._sort_formats(formats)
 
         thumbnail = self._proto_relative_url(xpath_text(video, './poster_src'))
 
index 1aa84ea701c152128f00f851b7fb340e438992ee..982ab3dd0879bb3274c7ae40a6b46657c9dec2f4 100644 (file)
@@ -173,7 +173,6 @@ def _real_extract(self, url):
                 raise
 
         formats.append({'url': f'https://{host}/getMedium/{video_id}.mp4'})
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 2f81860bb7dc81c70077bf8416f8cc5c7c02e27b..ddc33f7d7dc923ac165727a53e80533bf2395b94 100644 (file)
@@ -181,7 +181,6 @@ def _real_extract(self, url):
                 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,
index 16965dfb0e710c883a6a8f6dcf0e8d83cdb7ac4e..0734aee9c2482f330e2635742775db3cb840bba5 100644 (file)
@@ -76,7 +76,6 @@ def _real_extract(self, url):
                 'width': int_or_none(video.get('width')),
                 'height': int_or_none(video.get('height')),
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 8d3abceed6fa52ca054fc5a6e739dff44b532204..770aa284da9590fc81b30ca8b98f5f786e784c06 100644 (file)
@@ -156,8 +156,6 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
             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,
index 69a75304e04a24c2302de8644486838c2c3fb6fe..5933783ae6f0da3670bec2fda38c8b389978aa6d 100644 (file)
@@ -77,7 +77,6 @@ def _real_extract(self, url):
                     'format_id': f'{height}p',
                     'height': height,
                 })
-        self._sort_formats(formats)
 
         title = self._search_regex(
             (r'<h1>([^<]+)</h1>', r'<title>([^<]+) - VidLii<'), webpage,
index b630f9a6d74ec92885e08950d88242aff1f5a592..38126011487154795565f3108f6675f8096be18a 100644 (file)
@@ -134,7 +134,6 @@ def _real_extract(self, url):
                 'url': sub_url,
             })
 
-        self._sort_formats(formats)
         return {
             'id': film_id,
             'title': title,
index 157ce4d8f944972bfd1cbd0612bf9ed25b89ca49..4cdf2677b2769c1bf3d62f262d623ad01d1e6b05 100644 (file)
@@ -158,7 +158,6 @@ def extract_part(part_id):
                 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:
index a922b195c91ab91ffc4fad01b7403ae9e6760e72..3246dab526c67bb6785cfea771e00e55236c7815 100644 (file)
@@ -263,7 +263,6 @@ def _real_extract(self, url):
             # 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,
index 1b21c00501d02015472621d26f276afc9736e105..26fe566b03130f500a7e2fe793faa5bffd783bdc 100644 (file)
@@ -123,11 +123,6 @@ def _extract_vimeo_config(self, webpage, video_id, *args, **kwargs):
     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 @@ def _parse_config(self, config, video_id):
             '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 @@ def _extract_from_api(self, video_id, unlisted_hash=None):
             })
         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 @@ def _real_extract(self, url):
             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 @@ def is_rented():
 
         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 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
         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
index 3522b8e3323d9834661177311f4921fdf7f3d614..7097149a55289a26f0ece0cd93480eedcbfe236f 100644 (file)
@@ -23,7 +23,6 @@ def _real_extract(self, url):
 
         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 @@ def _real_extract(self, url):
 
         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,
index a8b16dd290a817ebf4aaf60af5f2c92beff2e4a1..fdccf465ed3f6d24ecc5d490a998d2a94c5fc74d 100644 (file)
@@ -13,7 +13,6 @@ def _extract_spruto(self, spruto, video_id):
         formats = [{
             'url': f['url'],
         } for f in playlist['video']]
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 8e57201f68fa852ae7b32499aa6ca7408b052675..1909980f20da98729e31b92a87afcaa3284f16e4 100644 (file)
@@ -86,7 +86,6 @@ def video_url(kind):
                     'quality': quality,
                 })
         self._check_formats(formats, video_id)
-        self._sort_formats(formats)
 
         username = data.get('username')
 
index 574622fa92dc537faac100f994e15b6677fec3ed..79b9f299a8c525448c0d8657bf402887e249a293 100644 (file)
@@ -74,7 +74,6 @@ def _real_extract(self, url):
                     'vcodec': 'none' if is_audio else None,
                 })
                 formats.append(f)
-        self._sort_formats(formats)
 
         duration = int_or_none(data.get('duration'))
 
index d27091c94e78643c320518b651ebbdfae01fc0f5..19d48234e444a1df4ac8e207ddf8f5664ecaf18e 100644 (file)
@@ -86,7 +86,6 @@ def _real_extract(self, url):
             #     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 @@ def download_playback():
                 '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 []:
index 0c856e2b0a511e623dcecd3c5660d02a3b3aa4ce..347aa381d0a55f0f74f57755f82d5fb095570927 100644 (file)
@@ -507,7 +507,6 @@ def _real_extract(self, url):
                     'url': format_url,
                     'ext': 'flv',
                 })
-        self._sort_formats(formats)
 
         subtitles = {}
         for sub in data.get('subs') or {}:
index f4bb079b25b3d37eb1c782bb01523f5ddb4b1c3b..e2fd3931525325cb4c889d3ece73ac78a85f9727 100644 (file)
@@ -208,7 +208,6 @@ def get_common_fields():
                     '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 @@ def _real_extract(self, url):
                         'url': f_url,
                         'height': int_or_none(f_id[:-1]),
                     })
-                self._sort_formats(formats)
                 entry = {
                     'formats': formats,
                     'id': video_id,
index 0d3e7eec2108257f3f512562e4a289b5a2d3ba5c..5ff05004b690ac1df7e65fc38603cd153bdb5c96 100644 (file)
@@ -28,7 +28,6 @@ def _real_extract(self, url):
 
         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,
index e8cbd0e32c70fff61ec9f2d170132474172d43e3..47502afb4f71823d12cbaaaa0b91856824f93418 100644 (file)
@@ -46,7 +46,6 @@ def _real_extract(self, url):
             '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),
index feab79138a754b1c3837ac7d18cec7d89f164841..7438b49565b5e75c58ba94400d4605802e1cdbb7 100644 (file)
@@ -44,7 +44,6 @@ def _extract_single_article(self, entry):
             'acodec': 'mp3',
             'vcodec': 'none',
         }]
-        self._sort_formats(formats)
         return {
             'id': compat_str(entry.get('ArticleId')),
             'title': entry.get('ArticleTitle'),
index 173556e664097728738151b1d35fd8c21782e4e3..b709b74e28893a2f19ede387dc2ed91ba18c7355 100644 (file)
@@ -73,7 +73,6 @@ def _real_extract(self, url):
         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
 
index 96c782d8b3e45a10c425a42bed14070c3f1d99be..f9362002f2b82890c99b98f0ea0e7d5a1475fa71 100644 (file)
@@ -47,7 +47,6 @@ def _real_extract(self, url):
                 '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 @@ def _real_extract(self, url):
                 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',
index 0b9bf2903b80092e3fbe93efbfef6bcd9015ef96..89fa7affc260d1e82fc3298aea599eb0067f6e2b 100644 (file)
@@ -192,7 +192,6 @@ def _real_extract(self, url):
                     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'):
index 93842db794f4b2115165bdacf353ea78c71a56d1..1bc7ae4ba121a26b469264b2113ab7977ddd442f 100644 (file)
@@ -49,8 +49,6 @@ def _real_extract(self, url):
             url, '<video>%s</video>' % self._extract_packed(webpage),
             video_id)[0]
 
-        self._sort_formats(info['formats'])
-
         info.update({
             'id': video_id,
             'title': title,
index 0c3e83a0a8f639bdbaea5bbe7b452ea56ac08dab..ed725a55d51ff73ae443aa2fe93a0098e0ae4557 100644 (file)
@@ -223,7 +223,6 @@ def metadata_from_url(r_url):
             metadata_from_url(embed_code)
 
         if not is_youtube:
-            self._sort_formats(formats)
             info['formats'] = formats
 
         metadata_from_url(video_data.get('thumbnail'))
index df43caf38064d18e68b7da68456edc6bdc265a35..6b9817c9ec2e35a29de60402244966505e171ea3 100644 (file)
@@ -90,8 +90,6 @@ def _real_extract(self, url):
                     f['_decryption_key_url'] = url_templ % ('goose', '') + qs
             formats.extend(m3u8_formats)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
index 6b954c5cc24c87158cd283f01aa7f3d5fc1e7870..a1a9c1708c4a200731abbc26ec09a097de967d63 100644 (file)
@@ -69,7 +69,6 @@ def _real_extract(self, url):
             if m:
                 fmt['height'] = int(m.group('height'))
             formats.append(fmt)
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index bad5ccb993415b46f5842ce80006eea13847dc18..f57c619b5f8848f41121af0ef831086b8f51157b 100644 (file)
@@ -37,7 +37,6 @@ def _real_extract(self, url):
         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 @@ def _real_extract(self, url):
         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)),
index e6a89adf69c74cbc7ae2a07576a0848f61cc5604..7c62d2866a8bd5773dcb4dff16a37feca928520d 100644 (file)
@@ -95,8 +95,6 @@ def extract_formats(manifest_urls):
             if manifest_urls:
                 extract_formats(manifest_urls)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': title,
index e41148d4a61db0b5019dd78652a0785f1aca88e8..c973ca998703e18e0e9bb3e52393056a880ee2e7 100644 (file)
@@ -109,7 +109,6 @@ def _real_extract(self, url):
                 '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')
index 7b2e7c8e068e2b4e83cf58e020d3823ec1a05303..de5dc26667564411c477108bc1a8f07a0ca6f67e 100644 (file)
@@ -103,8 +103,6 @@ def _real_extract(self, url):
                         a_format['ext'] = ext
                     formats.append(a_format)
 
-        self._sort_formats(formats)
-
         caption_url = media_resource.get('captionURL')
         if caption_url:
             subtitles['de'] = [{
index a66a5f8c5e639ed60237122a4f9989d32da3a9a3..43eeca0171208bf81b529ddf7668c53e83ee109f 100644 (file)
@@ -50,7 +50,6 @@ def _real_extract(self, url):
                             'format_note': track.get('title'),
                         })
                     formats.extend(m3u8_formats)
-        self._sort_formats(formats)
 
         thumbnail = xpath_text(video, './/image', 'thumbnail')
 
index fde9300b0fc97efb94b1ff3a753120d5cab71b21..65f48f3b1931478982d00f63a5878c60bf3f05da 100644 (file)
@@ -104,8 +104,6 @@ def _real_extract(self, url):
             'play_path': play_path,
         }]
 
-        self._sort_formats(formats)
-
         return {
             'id': story_id,
             'title': title,
index d5a52ce20e09e31212fab59e6e962eeb468b7f01..81a23b9df3c09c740b22afa5e1f26828b98d0abf 100644 (file)
@@ -88,8 +88,6 @@ def _real_extract(self, url):
                 'height': res,
             })
 
-        self._sort_formats(formats)
-
         uploader = self._og_search_property(
             'nick-name', webpage, 'uploader', default=None)
 
index 21574471c4d5576c5578fb77a2a5efe224220387..f2808cd9fc83de6ce01b3a52694e63fd1fb020be 100644 (file)
@@ -70,7 +70,6 @@ def _real_extract(self, url):
         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:
index 6c71e9a04c837fed0e1fd3ed237700eb454198c4..0ec9c9d6e285594103b9269fd46dabb3c7b60efe 100644 (file)
@@ -41,7 +41,6 @@ def _real_extract(self, url):
             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')),
index d27a348d99bc24bf29b3d0517187a85857df2349..5711123903e08b356bd31ba5826accfd12c75686 100644 (file)
@@ -139,7 +139,6 @@ def _real_extract(self, url):
                 })
         json = json.get('resource')
         thumb = self._generate_thumbnail(json.get('thumbnailId'))
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index e1e5855c2649058e8ce6386759ca5dfc19e88359..38dcc2f5b58769d0e915e8543b8e9ba273371a6e 100644 (file)
@@ -98,8 +98,6 @@ def _extract_media(self, embed_config):
                     })
                 formats.append(f)
 
-        self._sort_formats(formats)
-
         subtitles = {}
         for caption in data.get('captions', []):
             language = caption.get('language')
index e1062b9b5b7bd21bb5655e98d16092e51786c479..5e590e2f4f5e77795b4d17e6844afc5ef28ad8c4 100644 (file)
@@ -138,8 +138,6 @@ def _real_extract(self, url):
                         random.choice(fmt['url']),
                         video_id, live=True))
 
-        self._sort_formats(formats)
-
         channel['formats'] = formats
         return channel
 
index 9eeed104f507dfd411686c71b532118f30e1f4b5..86e2646793b127d4887ad9cbd5a86fc9036626ab 100644 (file)
@@ -82,7 +82,6 @@ def _real_extract(self, url):
                 'height': int_or_none(v.get('height')),
                 'fps': float_or_none(v.get('fps')),
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index e5c479d033cadf316b5fe27e25f2283e3d299255..08c6d6c7c01f153ba37454a2da0020f8bea49382 100644 (file)
@@ -182,7 +182,6 @@ def _real_extract(self, url):
                         'url': video_url,
                         'format_id': 'sd',
                     })
-        self._sort_formats(formats)
 
         thumbnail = self._search_regex(
             [
index 688c6b952272954359e530ff2eecd2ce2e0a168b..59eececb6d91d0deeadcd23bc90a5244e3f90cf8 100644 (file)
@@ -234,7 +234,6 @@ def get_height(s):
                                         'Referer': standard_url,
                                     },
                                 })
-            self._sort_formats(formats)
 
             categories_list = video.get('categories')
             if isinstance(categories_list, list):
@@ -311,8 +310,6 @@ def get_height(s):
                 '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
index 96e23bb8d0f967e368d2362416d209076143a384..ddc1d0b5afcafe25e5fbe14df85d9a7f7d832f30 100644 (file)
@@ -72,8 +72,6 @@ def _real_extract(self, url):
                     'ext': 'mp4',
                 } for prog in v if prog.get('url') or []])
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'title': data.get('title'),
index 14beb134754306a603987f737107d589968e7212..1452aaec37149172a2486e8b4caed1adc069dd21 100644 (file)
@@ -64,7 +64,6 @@ def get(meta, default=NO_DEFAULT, fatal=True):
                     '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)
index 42bffb071fcb7489c521786d6e39cbcd91fa8eb1..8dd1cd9efbee5b8f2c592e09575020550c5e51fb 100644 (file)
@@ -82,7 +82,6 @@ def _extract_video_info(self, partner_id, video_id):
                     'url': media_url,
                     'tbr': tbr,
                 })
-        self._sort_formats(formats)
 
         link = find_xpath_attr(
             entry, xpath_with_ns('./atom:link', NS_MAP), 'rel', 'original')
index 93a6a3f3353340950cfc395fed7b538875d6f310..ce4480c7d8c6be68475377a4c59485e9d9f92b72 100644 (file)
@@ -129,7 +129,6 @@ def _real_extract(self, url):
                     })
 
         self._remove_duplicate_formats(formats)
-        self._sort_formats(formats)
 
         if not title:
             title = self._search_regex(
index 52423a327913524ba2841ab1848445e4038507a1..71ddadd428245933251242e5081c8b26f4492f36 100644 (file)
@@ -116,7 +116,6 @@ def _real_extract(self, url):
                 '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:
index 50b9394961f691be97a63547c0de49793b2ea96f..5c505c850be21b39515fafa88ab6f5e0e4e13a95 100644 (file)
@@ -149,8 +149,6 @@ def _real_extract(self, url):
                     'quality': -2 if format_id.endswith('low') else None,
                 })
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'formats': formats,
index 01a859556a49282672c146a9bbcae9e164fb850c..a69715b7c14546f1dab4a01dfd2dd85a1e552668 100644 (file)
@@ -241,8 +241,6 @@ def _extract_yahoo_video(self, video_id, country):
         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 @@ def _extract_formats(self, json_data, content_id):
                     'tbr': int_or_none(vid.get('bitrate')),
                 })
         self._remove_duplicate_formats(formats)
-        self._sort_formats(formats)
 
         return formats
 
index d87a7f9be96a6943156e9eaaf54a641389ee5d8b..d5eecbd9c0f530771ac98483f74d5c2b9f4bd043 100644 (file)
@@ -127,7 +127,6 @@ def call_api(action):
                     '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'])
index 5e6cf6edd5d3116ccecc2b4807cce3ad65dc050c..535b61f6588c82465009bab47c32cd82034db9c6 100644 (file)
@@ -121,8 +121,6 @@ def _real_extract(self, url):
             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 @@ def _real_extract(self, url):
                 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),
index 221df842cb084d219959cbc99af874dec6902cc6..19812bae000718bf4fd4eb8504c9b30587de8d72 100644 (file)
@@ -79,7 +79,6 @@ def _real_extract(self, url):
                 'quality': quality_key(format_id),
                 'height': hd_height if is_hd else None,
             })
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index b28c393808041f5a06ee1f121b427c2f34a78da4..b2e3172f9345de95faee04da8a33abfed3f7b1bf 100644 (file)
@@ -41,7 +41,6 @@ def _real_extract(self, url):
             'ext': 'mp4',
             'tbr': format_info.get('bitrate'),
         } for format_info in info['videoUrlModels']]
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 27eda972199564b5868f08838c9ecf8ebfde38e5..a7d7371f3b0983da90641f52e85e325516f00d1e 100644 (file)
@@ -39,7 +39,6 @@ def _real_extract(self, url):
         if m:
             title = m.group('title')
         formats = self._extract_f4m_formats(f4m_url, video_id)
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 45856fbbeaeaf7c1eee76e64f0a21bfcadba0b23..624975b982564f5a51022ac18f28e5fa22c177f3 100644 (file)
@@ -198,7 +198,6 @@ def _real_extract(self, url):
             '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,
index 7fdb865f7828a342c49eb63fd151c318d1225a28..2f3f2133240d5fae935fc0560a257acd1d4f729b 100644 (file)
@@ -103,7 +103,6 @@ def _real_extract(self, url):
                 })
             f['height'] = height
             formats.append(f)
-        self._sort_formats(formats)
 
         webpage = self._download_webpage(
             'http://www.youporn.com/watch/%s' % video_id, display_id,
index 7e3530c0fa24c377bd7b45cc706259776b10f082..8a2dd728c2cb78fe07a5fa92591cd7edb94bfbcc 100644 (file)
@@ -4003,10 +4003,6 @@ def is_bad_format(fmt):
 
         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 @@ def is_bad_format(fmt):
             '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 = {}
index 4b18cb86c8f9a98a2920c03a0a78cd3c29e61a67..88f526bbc9b354df0894a050f23eeb5a87469e4c 100644 (file)
@@ -92,7 +92,6 @@ def ns(path):
             if m:
                 f['height'] = int(m.group('height'))
             formats.append(f)
-        self._sort_formats(formats)
 
         return {
             'id': video_id,
index 572a1d0f2ad04122ca4d8074a798385059076346..22620c0a324d94c37816f134bf1a3209abcd3ca5 100644 (file)
@@ -202,7 +202,6 @@ def _extract_formats(self, cid, video_id, record_id=None, ondemand_id=None, onde
                 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):
index 1eab384b9c66af2688c1677409519624e31bcaa3..fca426a50bdaa0b8262d1dc046a3096d43ff8dc0 100644 (file)
@@ -110,7 +110,6 @@ def _extract_ptmd(self, ptmd_url, video_id, api_token, referrer):
                                 '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 @@ def _extract_ptmd(self, ptmd_url, video_id, api_token, referrer):
             '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 @@ def _extract_mobile(self, video_id):
             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')
index 10dd8fb1c321f6e1828ade4163bdb4fbf8e83ae7..a64eb9ed0d0f83212e8ea175f486bbb69e2cf8c1 100644 (file)
@@ -146,7 +146,6 @@ def _real_extract(self, url):
         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', []):
index ae2cc264e70dda0ad2342bcd50aebe7db962b1b2..1616dbfbf7c9cfcfa6fbe2c335099b55cb1989e1 100644 (file)
@@ -48,7 +48,6 @@ def _real_extract(self, url):
             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),
index d8d259dd69114b4c207f1c8bc6f68b70e896810a..c24b33874c4cd9f3e66e680961285fbcf251b088 100644 (file)
@@ -45,7 +45,6 @@ def _real_extract(self, url):
                 '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')
index 8b2d842ff4347a38caa5b3b44afc5f663834be65..a818c9fa9d4ce24bff56666af01e199b95426c88 100644 (file)
@@ -168,7 +168,6 @@ def _real_extract(self, url):
 
         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')
 
index a455f8c04aec969f1a9fbcd7345cad1c52802b99..ef8b71522c11e79b1b7d0e0335c1d9c0eeefdea2 100644 (file)
@@ -86,8 +86,6 @@ def _real_extract(self, url):
                 'preference': -1
             })
 
-        self._sort_formats(formats)
-
         return {
             'id': play_id,
             'title': data.get('topic'),
index a705149e62343940ee3372da936a79bf6bc553b7..8cf994505a3008e48ddff76d347284437c5733bc 100644 (file)
@@ -97,7 +97,6 @@ def get_attr(key):
             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: