]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/peertube.py
2 from __future__
import unicode_literals
7 from .common
import InfoExtractor
8 from ..compat
import compat_str
22 class PeerTubeIE(InfoExtractor
):
23 _INSTANCES_RE
= r
'''(?:
24 # Taken from https://instances.joinpeertube.org/instances
31 archive\.vidicon\.org|
41 clap\.nerv-project\.eu|
42 climatejustice\.video|
44 conspiracydistillery\.com|
45 darkvapor\.nohost\.me|
46 daschauher\.aksel\.rocks|
47 digitalcourage\.video|
48 dreiecksnebel\.alex-detsch\.de|
56 fotogramas\.politicaconciencia\.org|
61 grypstube\.uni-greifswald\.de|
70 kirche\.peertube-host\.de|
76 lepetitmayennais\.fr\.nf|
85 lolitube\.freedomchan\.moe|
86 lucarne\.balsamine\.be|
91 media\.inno3\.cricket|
93 media\.krashboyz\.org|
94 media\.over-world\.org|
96 media\.undeadnetwork\.de|
97 medias\.pingbase\.net|
98 melsungen\.peertube-host\.de|
101 monplaisirtube\.ddns\.net|
105 mytube\.kn-cloud\.de|
107 myworkoutarenapeertube\.cf|
108 nanawel-peertube\.dyndns\.org|
112 ovaltube\.codinglab\.ch|
117 peertube1\.zeteo\.me|
120 peertube\.alpharius\.io|
121 peertube\.am-networks\.fr|
122 peertube\.anduin\.net|
123 peertube\.anzui\.dev|
124 peertube\.arbleizez\.bzh|
125 peertube\.art3mis\.de|
126 peertube\.atilla\.org|
127 peertube\.atsuchan\.page|
128 peertube\.aukfood\.net|
129 peertube\.aventer\.biz|
130 peertube\.b38\.rural-it\.org|
131 peertube\.beeldengeluid\.nl|
133 peertube\.bgzashtita\.es|
134 peertube\.bitsandlinux\.com|
136 peertube\.boba\.best|
138 peertube\.bridaahost\.ynh\.fr|
139 peertube\.bubbletea\.dev|
140 peertube\.bubuit\.net|
141 peertube\.cabaal\.net|
142 peertube\.cats-home\.net|
143 peertube\.chemnitz\.freifunk\.net|
144 peertube\.chevro\.fr|
145 peertube\.chrisspiegl\.com|
146 peertube\.chtisurel\.net|
147 peertube\.cipherbliss\.com|
148 peertube\.cloud\.sans\.pub|
149 peertube\.cpge-brizeux\.fr|
150 peertube\.ctseuro\.com|
151 peertube\.cuatrolibertades\.org|
152 peertube\.cybercirujas\.club|
153 peertube\.cythin\.com|
154 peertube\.davigge\.com|
155 peertube\.dc\.pini\.fr|
156 peertube\.debian\.social|
157 peertube\.demonix\.fr|
158 peertube\.designersethiques\.org|
160 peertube\.devloprog\.org|
163 peertube\.ecologie\.bzh|
165 peertube\.european-pirates\.eu|
166 peertube\.euskarabildua\.eus|
167 peertube\.fenarinarsa\.com|
168 peertube\.fomin\.site|
169 peertube\.forsud\.be|
170 peertube\.francoispelletier\.org|
171 peertube\.freenet\.ru|
172 peertube\.freetalklive\.com|
173 peertube\.functional\.cafe|
174 peertube\.gardeludwig\.fr|
175 peertube\.gargantia\.fr|
176 peertube\.gcfamily\.fr|
178 peertube\.get-racing\.de|
179 peertube\.gidikroon\.eu|
180 peertube\.gruezishop\.ch|
181 peertube\.habets\.house|
182 peertube\.hackerfraternity\.org|
183 peertube\.ichigo\.everydayimshuflin\.com|
184 peertube\.ignifi\.me|
185 peertube\.inapurna\.org|
186 peertube\.informaction\.info|
187 peertube\.interhop\.org|
188 peertube\.iselfhost\.com|
190 peertube\.jensdiemer\.de|
191 peertube\.joffreyverd\.fr|
193 peertube\.kathryl\.fr|
194 peertube\.keazilla\.net|
195 peertube\.klaewyss\.fr|
196 peertube\.kodcast\.com|
197 peertube\.kx\.studio|
198 peertube\.lagvoid\.com|
199 peertube\.lavallee\.tech|
200 peertube\.le5emeaxe\.fr|
201 peertube\.lestutosdeprocessus\.fr|
202 peertube\.librenet\.co\.za|
203 peertube\.logilab\.fr|
204 peertube\.louisematic\.site|
205 peertube\.luckow\.org|
207 peertube\.lyceeconnecte\.fr|
208 peertube\.manalejandro\.com|
210 peertube\.mattone\.net|
211 peertube\.maxweiss\.io|
212 peertube\.monlycee\.net|
213 peertube\.mxinfo\.fr|
214 peertube\.myrasp\.eu|
215 peertube\.nebelcloud\.de|
216 peertube\.netzbegruenung\.de|
217 peertube\.newsocial\.tech|
218 peertube\.nicolastissot\.fr|
220 peertube\.offerman\.com|
221 peertube\.opencloud\.lu|
222 peertube\.orthus\.link|
223 peertube\.patapouf\.xyz|
225 peertube\.plataformess\.org|
227 peertube\.portaesgnos\.org|
228 peertube\.r2\.enst\.fr|
230 peertube\.radres\.xyz|
232 peertube\.robonomics\.network|
233 peertube\.rtnkv\.cloud|
234 peertube\.runfox\.tk|
235 peertube\.satoshishop\.de|
236 peertube\.scic-tetris\.org|
237 peertube\.securitymadein\.lu|
238 peertube\.semweb\.pro|
239 peertube\.social\.my-wan\.de|
240 peertube\.soykaf\.org|
241 peertube\.stefofficiel\.me|
245 peertube\.takeko\.cyou|
246 peertube\.tangentfox\.com|
247 peertube\.taxinachtegel\.de|
248 peertube\.thenewoil\.xyz|
249 peertube\.ti-fr\.com|
250 peertube\.tiennot\.net|
251 peertube\.troback\.com|
252 peertube\.tspu\.edu\.ru|
257 peertube\.underworld\.fr|
259 peertube\.ventresmous\.fr|
261 peertube\.w\.utnw\.de|
262 peertube\.westring\.digital|
263 peertube\.xwiki\.com|
264 peertube\.zoz-serv\.org|
266 periscope\.numenaute\.org|
268 petitlutinartube\.fr|
273 player\.ojamajo\.moe|
275 pocketnetpeertube1\.nohost\.me|
276 pocketnetpeertube3\.nohost\.me|
277 pocketnetpeertube4\.nohost\.me|
278 pocketnetpeertube5\.nohost\.me|
279 pocketnetpeertube6\.nohost\.me|
285 ptb\.lunarviews\.net|
286 ptmir1\.inter21\.net|
287 ptmir2\.inter21\.net|
288 ptmir3\.inter21\.net|
289 ptmir4\.inter21\.net|
290 ptmir5\.inter21\.net|
291 ptube\.horsentiers\.fr|
292 ptube\.xmanifesto\.club|
294 re-wizja\.re-medium\.com|
300 sender-fm\.veezee\.tube|
301 serv1\.wiki-tube\.de|
302 serv3\.wiki-tube\.de|
309 stream\.shahab\.nohost\.me|
311 studios\.racer159\.com|
312 testtube\.florimond\.eu|
313 tgi\.hosted\.spacebear\.ee|
316 theater\.ethernia\.net|
323 tube-aix-marseille\.beta\.education\.fr|
324 tube-amiens\.beta\.education\.fr|
325 tube-besancon\.beta\.education\.fr|
326 tube-bordeaux\.beta\.education\.fr|
327 tube-clermont-ferrand\.beta\.education\.fr|
328 tube-corse\.beta\.education\.fr|
329 tube-creteil\.beta\.education\.fr|
330 tube-dijon\.beta\.education\.fr|
331 tube-education\.beta\.education\.fr|
332 tube-grenoble\.beta\.education\.fr|
333 tube-lille\.beta\.education\.fr|
334 tube-limoges\.beta\.education\.fr|
335 tube-montpellier\.beta\.education\.fr|
336 tube-nancy\.beta\.education\.fr|
337 tube-nantes\.beta\.education\.fr|
338 tube-nice\.beta\.education\.fr|
339 tube-normandie\.beta\.education\.fr|
340 tube-orleans-tours\.beta\.education\.fr|
341 tube-outremer\.beta\.education\.fr|
342 tube-paris\.beta\.education\.fr|
343 tube-poitiers\.beta\.education\.fr|
344 tube-reims\.beta\.education\.fr|
345 tube-rennes\.beta\.education\.fr|
346 tube-strasbourg\.beta\.education\.fr|
347 tube-toulouse\.beta\.education\.fr|
348 tube-versailles\.beta\.education\.fr|
349 tube1\.it\.tuwien\.ac\.at|
350 tube\.abolivier\.bzh|
352 tube\.aerztefueraufklaerung\.de|
369 tube\.cloud-libre\.eu|
372 tube\.cryptography\.dog|
373 tube\.darknight-coffee\.org|
376 tube\.dsocialize\.net|
382 tube\.frischesicht\.de|
388 tube\.hackerscop\.org|
391 tube\.kai-stuht\.com|
394 tube\.lacaveatonton\.ovh|
397 tube\.lucie-philou\.com|
398 tube\.melonbread\.xyz|
406 tube\.nuagelibre\.fr|
411 tube\.opportunis\.me|
414 tube\.others\.social|
416 tube\.plomlompom\.com|
418 tube\.portes-imaginaire\.org|
420 tube\.rebellion\.global|
421 tube\.rhythms-of-resistance\.org|
426 tube\.schleuss\.online|
427 tube\.schule\.social|
434 tube\.superseriousbusiness\.org|
440 tube\.troopers\.agency|
441 tube\.tylerdavis\.xyz|
443 tube\.vigilian-consulting\.nl|
456 tuvideo\.encanarias\.info|
463 tv\.generallyrubbish\.net\.au|
465 tv\.mattchristiansenmedia\.com|
466 tv\.netwhood\.online|
469 tv\.pirateradio\.social|
472 twctube\.twc-zone\.eu|
486 vid\.pravdastalina\.info|
488 vid\.rajeshtaylor\.com|
489 vid\.samtripoli\.com|
494 video\.1146\.nohost\.me|
495 video\.altertek\.org|
496 video\.anartist\.org|
497 video\.apps\.thedoodleproject\.net|
499 video\.asgardius\.company|
500 video\.balsillie\.net|
501 video\.bards\.online|
502 video\.binarydad\.com|
503 video\.blast-info\.fr|
505 video\.cigliola\.com|
506 video\.cm-en-transition\.fr|
509 video\.codingfield\.com|
510 video\.comptoir\.net|
511 video\.comune\.trento\.it|
515 video\.demokratischer-sommer\.de|
516 video\.discord-insoumis\.fr|
517 video\.dolphincastle\.com|
518 video\.dresden\.network|
519 video\.ecole-89\.com|
520 video\.elgrillolibertario\.org|
521 video\.emergeheart\.info|
522 video\.eradicatinglove\.xyz|
523 video\.ethantheenigma\.me|
524 video\.exodus-privacy\.eu\.org|
527 video\.greenmycity\.eu|
528 video\.guerredeclasse\.fr|
530 video\.hackers\.town|
531 video\.hardlimit\.com|
534 video\.internet-czas-dzialac\.pl|
535 video\.islameye\.com|
537 video\.kuba-orlik\.name|
538 video\.kyushojitsu\.ca|
540 video\.lespoesiesdheloise\.fr|
543 video\.linc\.systems|
545 video\.linuxtrent\.it|
546 video\.lokal\.social|
550 video\.marcorennmaus\.de|
551 video\.mass-trespass\.uk|
553 video\.mundodesconocido\.com|
556 video\.odayacres\.farm|
557 video\.ozgurkon\.org|
558 video\.p1ng0ut\.social|
561 video\.pony\.gallery|
562 video\.potate\.space|
563 video\.pourpenser\.pro|
564 video\.progressiv\.dev|
565 video\.resolutions\.it|
567 video\.screamer\.wiki|
568 video\.sdm-tools\.net|
570 video\.shitposter\.club|
573 video\.stuartbrand\.co\.uk|
574 video\.thinkof\.name|
578 video\.vaku\.org\.ua|
580 video\.violoncello\.ch|
582 video\.wsf2021\.info|
584 videos-passages\.huma-num\.fr|
585 videos\.3d-wolf\.com|
586 videos\.ahp-numerique\.fr|
587 videos\.alexandrebadalo\.pt|
588 videos\.archigny\.net|
589 videos\.benjaminbrady\.ie|
590 videos\.buceoluegoexisto\.com|
592 videos\.casually\.cat|
593 videos\.cloudron\.io|
594 videos\.coletivos\.org|
595 videos\.danksquad\.org|
596 videos\.denshi\.live|
597 videos\.fromouter\.space|
599 videos\.globenet\.org|
602 videos\.john-livingston\.fr|
603 videos\.jordanwarne\.xyz|
604 videos\.lavoixdessansvoix\.org|
605 videos\.leslionsfloorball\.fr|
607 videos\.martyn\.berlin|
608 videos\.mastodont\.cat|
609 videos\.monstro1\.com|
611 videos\.optoutpod\.com|
612 videos\.petch\.rocks|
613 videos\.pzelawski\.xyz|
615 videos\.scanlines\.xyz|
618 videos\.stadtfabrikanten\.org|
619 videos\.tankernn\.eu|
620 videos\.testimonia\.org|
621 videos\.thisishowidontdisappear\.com|
622 videos\.traumaheilung\.net|
624 videos\.wakkerewereld\.nu|
632 vulgarisation-informatique\.fr|
633 watch\.breadtube\.tv|
634 watch\.deranalyst\.ch|
635 watch\.ignorance\.eu|
637 watch\.libertaria\.space|
639 watch\.softinio\.com|
640 watch\.tubelab\.video|
642 webtv\.vandoeuvre\.net|
648 www4\.mir\.inter21\.net|
649 www\.birkeundnymphe\.de|
650 www\.captain-german\.com|
652 xxivproduction\.video|
656 peertube\.rainbowswingers\.net|
660 videomensoif\.ynh\.fr|
661 peertube\.travelpandas\.eu|
662 peertube\.rachetjay\.fr|
663 peertube\.montecsys\.fr|
666 peertube\.umeahackerspace\.se|
668 video\.monsieurbidouille\.fr|
669 tube\.openalgeria\.org|
671 video\.anormallostpod\.ovh|
672 tube\.crapaud-fou\.org|
676 peertube\.snargol\.com|
681 peertube\.osureplayviewer\.xyz|
682 peertube\.mathieufamily\.ovh|
683 www\.videos-libr\.es|
685 peertube\.fediverse\.ru|
686 peertube\.oiseauroch\.fr|
694 peertube\.chantierlibre\.org|
700 videos\.elbinario\.net|
706 peertube\.gnumeria\.eu\.org|
710 tube\.kalah-france\.org|
714 peertube\.hatthieves\.es|
715 video\.fitchfamily\.org|
719 tube\.22decembre\.eu|
720 peertube\.harmoniescreatives\.com|
722 video\.thedwyers\.co|
723 video\.bruitbruit\.com|
724 peertube\.foxfam\.club|
726 videos\.bugs\.social|
727 peertube\.malbert\.xyz|
728 peertube\.bilange\.ca|
731 peertube\.fedilab\.app|
733 video\.mstddntfdn\.online|
735 peertube\.sl-network\.fr|
736 peertube\.dynlinux\.io|
737 peertube\.david\.durieux\.family|
738 peertube\.linuxrocks\.online|
740 v\.kretschmann\.social|
743 tube\.dragonpsi\.xyz|
744 peertube\.boneheadmedia\.com|
745 videos\.funkwhale\.audio|
747 peertube\.gcaillaut\.fr|
754 peertube\.simounet\.net|
758 peertube\.kerenon\.com|
760 tube\.calculate\.social|
761 peertube\.mckillop\.org|
762 tube\.netzspielplatz\.de|
766 peertube\.stephenson\.cc|
768 peertube\.kajalinifi\.de|
771 peertube\.ffs2play\.fr|
772 peertube\.leboulaire\.ovh|
773 peertube\.tronic-studio\.com|
774 peertube\.public\.cat|
775 peertube\.metalbanana\.net|
777 peertube\.alter-nativ-voll\.de|
779 tube\.worldofhauru\.xyz|
781 peertube\.teleassist\.fr|
784 media\.privacyinternational\.org|
786 video\.halle-leaks\.de|
787 video\.grosskopfgames\.de|
788 peertube\.schaeferit\.de|
789 peertube\.jackbot\.fr|
790 tube\.extinctionrebellion\.fr|
794 peertube\.zergy\.net|
795 peertube\.roflcopter\.fr|
796 peertube\.floss-marketing-school\.com|
798 peertube\.iriseden\.eu|
799 videos\.ubuntu-paris\.org|
800 peertube\.mastodon\.host|
802 peertube\.s2s\.video|
807 peertube\.normandie-libre\.fr|
809 video\.lacaveatonton\.ovh|
811 peertube\.servebeer\.com|
812 peertube\.fedi\.quebec|
817 tube\.unmondemeilleur\.eu|
824 video\.devinberg\.com|
826 peertube\.kosebamse\.com|
827 yunopeertube\.myddns\.me|
828 peertube\.varney\.fr|
829 peertube\.anon-kenkai\.com|
832 videos\.dinofly\.com|
836 video\.heromuster\.com|
837 video\.lemediatv\.fr|
842 pt\.laurentkruger\.fr|
843 video\.monarch-pass\.net|
844 peertube\.artica\.center|
845 video\.alternanet\.fr|
847 fanvid\.stopthatimp\.net|
852 peertube\.mablr\.org|
856 devtube\.dev-wiki\.de|
857 raptube\.antipub\.org|
859 peertube\.mygaia\.org|
861 peertube\.livingutopia\.org|
862 peertube\.the-penguin\.de|
863 tube\.thechangebook\.org|
867 mplayer\.demouliere\.eu|
870 peertube\.zapashcanon\.fr|
871 video\.latavernedejohnjohn\.fr|
872 peertube\.pcservice46\.fr|
873 peertube\.mazzonetto\.eu|
874 video\.irem\.univ-paris-diderot\.fr|
875 video\.livecchi\.cloud|
878 video\.cabane-libre\.org|
879 peertube\.openstreetmap\.fr|
880 videos\.alolise\.org|
886 peertube\.freeforge\.eu|
887 video\.arbitrarion\.com|
888 video\.datsemultimedia\.com|
890 peertube\.ricostrongxxx\.com|
891 docker\.videos\.lecygnenoir\.info|
892 peertube\.togart\.de|
893 tube\.postblue\.info|
894 videos\.domainepublic\.net|
895 peertube\.cyber-tribal\.com|
896 video\.gresille\.org|
897 peertube\.dsmouse\.net|
898 cinema\.yunohost\.support|
899 tube\.theocevaer\.fr|
903 peertube\.metawurst\.space|
906 video\.freeradical\.zone|
909 pt\.kircheneuenburg\.de|
912 videos\.side-ways\.net|
915 video\.taboulisme\.com|
919 video\.monsieur-a\.fr|
920 peertube\.librelois\.fr|
921 videos\.pair2jeux\.tube|
922 videos\.pueseso\.club|
923 peer\.mathdacloud\.ovh|
924 media\.assassinate-you\.net|
926 ptube\.rousset\.nom\.fr|
930 peertube\.makotoworkshop\.org|
931 peertube\.serveur\.slv-valbonne\.fr|
936 pire\.artisanlogiciel\.net|
937 videos\.numerique-en-commun\.fr|
939 video\.die-partei\.social|
941 peertube\.swarm\.solvingmaz\.es|
942 tube\.pericoloso\.ovh|
943 watching\.cypherpunk\.observer|
944 videos\.adhocmusic\.com|
946 peertube\.librelabucm\.org|
947 videos\.numericoop\.fr|
948 peertube\.koehn\.com|
949 peertube\.anarchmusicall\.net|
950 tube\.kampftoast\.de|
952 peertube\.xtenz\.xyz|
955 peertube\.nomagic\.uk|
957 videos\.koumoul\.com|
958 video\.rastapuls\.com|
959 video\.mantlepro\.com|
960 video\.deadsuperhero\.com|
961 peertube\.musicstudio\.pro|
962 peertube\.we-keys\.fr|
963 artitube\.artifaille\.fr|
964 peertube\.ethernia\.net|
968 peertube\.donnadieu\.fr|
969 argos\.aquilenet\.fr|
972 videos\.darckoune\.moe|
973 tube\.traydent\.info|
974 dev\.videos\.lecygnenoir\.info|
975 peertube\.nayya\.org|
977 peertube\.mofgao\.space|
978 video\.lequerrec\.eu|
979 peertube\.amicale\.net|
988 peertube\.heberge\.fr|
990 videos\.cloudfrancois\.fr|
999 videos\.lescommuns\.org|
1003 peertube\.nogafa\.org|
1004 megatube\.lilomoino\.fr|
1005 peertube\.tamanoir\.foucry\.net|
1006 peertube\.devosi\.org|
1007 peertube\.1312\.media|
1008 tube\.bootlicker\.party|
1010 video\.blueline\.mg|
1011 tube\.homecomputing\.fr|
1012 tube\.ouahpiti\.info|
1013 video\.tedomum\.net|
1016 peertube\.gaialabs\.ch|
1019 video\.migennes\.net|
1022 videos\.iut-orsay\.fr|
1023 peertube\.solidev\.net|
1025 video\.passageenseine\.fr|
1026 videos\.festivalparminous\.org|
1027 peertube\.touhoppai\.moe|
1029 peer\.hostux\.social|
1031 peertube\.walkingmountains\.fr|
1033 peertube\.parleur\.net|
1034 peertube\.heraut\.eu|
1035 tube\.aquilenet\.fr|
1036 peertube\.gegeweb\.eu|
1039 tube\.conferences-gesticulees\.net|
1040 peertube\.datagueule\.tv|
1042 tube\.mochi\.academy|
1044 video\.colibris-outilslibres\.org|
1053 _UUID_RE
= r
'[\da-zA-Z]{22}|[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}'
1054 _API_BASE
= 'https://%s/api/v1/videos/%s/%s'
1055 _VALID_URL
= r
'''(?x)
1057 peertube:(?P<host>[^:]+):|
1058 https?://(?P<host_2>%s)/(?:videos/(?:watch|embed)|api/v\d/videos|w)/
1061 ''' % (_INSTANCES_RE
, _UUID_RE
)
1063 'url': 'https://framatube.org/videos/watch/9c9de5e8-0a1e-484a-b099-e80766180a6d',
1064 'md5': '8563064d245a4be5705bddb22bb00a28',
1066 'id': '9c9de5e8-0a1e-484a-b099-e80766180a6d',
1068 'title': 'What is PeerTube?',
1069 'description': 'md5:3fefb8dde2b189186ce0719fda6f7b10',
1070 'thumbnail': r
're:https?://.*\.(?:jpg|png)',
1071 'timestamp': 1538391166,
1072 'upload_date': '20181001',
1073 'uploader': 'Framasoft',
1075 'uploader_url': 'https://framatube.org/accounts/framasoft',
1076 'channel': 'A propos de PeerTube',
1077 'channel_id': '2215',
1078 'channel_url': 'https://framatube.org/video-channels/joinpeertube',
1080 'license': 'Attribution - Share Alike',
1084 'dislike_count': int,
1085 'tags': ['framasoft', 'peertube'],
1086 'categories': ['Science & Technology'],
1089 'url': 'https://peertube2.cpy.re/w/122d093a-1ede-43bd-bd34-59d2931ffc5e',
1091 'id': '122d093a-1ede-43bd-bd34-59d2931ffc5e',
1093 'title': 'E2E tests',
1094 'uploader_id': '37855',
1095 'timestamp': 1589276219,
1096 'upload_date': '20200512',
1097 'uploader': 'chocobozzz',
1100 'url': 'https://peertube2.cpy.re/w/3fbif9S3WmtTP8gGsC5HBd',
1102 'id': '3fbif9S3WmtTP8gGsC5HBd',
1104 'title': 'E2E tests',
1105 'uploader_id': '37855',
1106 'timestamp': 1589276219,
1107 'upload_date': '20200512',
1108 'uploader': 'chocobozzz',
1111 'url': 'https://peertube2.cpy.re/api/v1/videos/3fbif9S3WmtTP8gGsC5HBd',
1113 'id': '3fbif9S3WmtTP8gGsC5HBd',
1115 'title': 'E2E tests',
1116 'uploader_id': '37855',
1117 'timestamp': 1589276219,
1118 'upload_date': '20200512',
1119 'uploader': 'chocobozzz',
1123 'url': 'peertube:spacepub.space:d8943b2d-8280-497b-85ec-bc282ec2afdc',
1125 'id': 'd8943b2d-8280-497b-85ec-bc282ec2afdc',
1127 'title': 'Dot matrix printer shell demo',
1129 'timestamp': 1587401293,
1130 'upload_date': '20200420',
1131 'uploader': 'Drew DeVault',
1134 'url': 'https://peertube.debian.social/videos/watch/0b04f13d-1e18-4f1d-814e-4979aa7c9c44',
1135 'only_matching': True,
1138 'url': 'https://vod.ksite.de/videos/watch/9bb88cd3-9959-46d9-9ab9-33d2bb704c39',
1139 'only_matching': True,
1141 'url': 'https://vod.ksite.de/videos/embed/fed67262-6edb-4d1c-833b-daa9085c71d7',
1142 'only_matching': True,
1144 'url': 'https://peertube.tv/api/v1/videos/c1875674-97d0-4c94-a058-3f7e64c962e8',
1145 'only_matching': True,
1147 'url': 'peertube:framatube.org:b37a5b9f-e6b5-415c-b700-04a5cd6ec205',
1148 'only_matching': True,
1152 def _extract_peertube_url(webpage
, source_url
):
1154 r
'https?://(?P<host>[^/]+)/(?:videos/(?:watch|embed)|w)/(?P<id>%s)'
1155 % PeerTubeIE
._UUID
_RE
, source_url
)
1156 if mobj
and any(p
in webpage
for p
in (
1157 'meta property="og:platform" content="PeerTube"',
1159 'There will be other non JS-based clients to access PeerTube',
1160 '>We are sorry but it seems that PeerTube is not compatible with your web browser.<')):
1161 return 'peertube:%s:%s' % mobj
.group('host', 'id')
1164 def _extract_urls(webpage
, source_url
):
1165 entries
= re
.findall(
1166 r
'''(?x)<iframe[^>]+\bsrc=["\'](?P
<url
>(?
:https?
:)?
//%s/videos
/embed
/%s)'''
1167 % (PeerTubeIE._INSTANCES_RE, PeerTubeIE._UUID_RE), webpage)
1169 peertube_url = PeerTubeIE._extract_peertube_url(webpage, source_url)
1171 entries = [peertube_url]
1174 def _call_api(self, host, video_id, path, note=None, errnote=None, fatal=True):
1175 return self._download_json(
1176 self._API_BASE % (host, video_id, path), video_id,
1177 note=note, errnote=errnote, fatal=fatal)
1179 def _get_subtitles(self, host, video_id):
1180 captions = self._call_api(
1181 host, video_id, 'captions', note='Downloading captions JSON',
1183 if not isinstance(captions, dict):
1185 data = captions.get('data')
1186 if not isinstance(data, list):
1190 language_id = try_get(e, lambda x: x['language']['id'], compat_str)
1191 caption_url = urljoin('https://%s' % host, e.get('captionPath'))
1194 subtitles.setdefault(language_id or 'en', []).append({
1199 def _real_extract(self, url):
1200 mobj = self._match_valid_url(url)
1201 host = mobj.group('host') or mobj.group('host_2')
1202 video_id = mobj.group('id')
1204 video = self._call_api(
1205 host, video_id, '', note='Downloading video JSON')
1207 title = video['name']
1210 files = video.get('files') or []
1211 for playlist in (video.get('streamingPlaylists') or []):
1212 if not isinstance(playlist, dict):
1214 playlist_files = playlist.get('files')
1215 if not (playlist_files and isinstance(playlist_files, list)):
1217 files.extend(playlist_files)
1219 if not isinstance(file_, dict):
1221 file_url = url_or_none(file_.get('fileUrl'))
1224 file_size = int_or_none(file_.get('size'))
1225 format_id = try_get(
1226 file_, lambda x: x['resolution']['label'], compat_str)
1227 f = parse_resolution(format_id)
1230 'format_id': format_id,
1231 'filesize': file_size,
1233 if format_id == '0p':
1234 f['vcodec'] = 'none'
1236 f['fps'] = int_or_none(file_.get('fps'))
1238 self._sort_formats(formats)
1240 description = video.get('description')
1241 if description and len(description) >= 250:
1242 # description is shortened
1243 full_description = self._call_api(
1244 host, video_id, 'description', note='Downloading description JSON',
1247 if isinstance(full_description, dict):
1248 description = str_or_none(full_description.get('description')) or description
1250 subtitles = self.extract_subtitles(host, video_id)
1252 def data(section, field, type_):
1253 return try_get(video, lambda x: x[section][field], type_)
1255 def account_data(field, type_):
1256 return data('account', field, type_)
1258 def channel_data(field, type_):
1259 return data('channel', field, type_)
1261 category = data('category', 'label', compat_str)
1262 categories = [category] if category else None
1264 nsfw = video.get('nsfw')
1266 age_limit = 18 if nsfw else 0
1270 webpage_url = 'https://%s/videos/watch/%s' % (host, video_id)
1275 'description': description,
1276 'thumbnail': urljoin(webpage_url, video.get('thumbnailPath')),
1277 'timestamp': unified_timestamp(video.get('publishedAt')),
1278 'uploader': account_data('displayName', compat_str),
1279 'uploader_id': str_or_none(account_data('id', int)),
1280 'uploader_url': url_or_none(account_data('url', compat_str)),
1281 'channel': channel_data('displayName', compat_str),
1282 'channel_id': str_or_none(channel_data('id', int)),
1283 'channel_url': url_or_none(channel_data('url', compat_str)),
1284 'language': data('language', 'id', compat_str),
1285 'license': data('licence', 'label', compat_str),
1286 'duration': int_or_none(video.get('duration')),
1287 'view_count': int_or_none(video.get('views')),
1288 'like_count': int_or_none(video.get('likes')),
1289 'dislike_count': int_or_none(video.get('dislikes')),
1290 'age_limit': age_limit,
1291 'tags': try_get(video, lambda x: x['tags'], list),
1292 'categories': categories,
1294 'subtitles': subtitles,
1295 'webpage_url': webpage_url,
1299 class PeerTubePlaylistIE(InfoExtractor):
1300 IE_NAME = 'PeerTube:Playlist'
1303 'c': 'video-channels',
1304 'w/p': 'video-playlists',
1306 _VALID_URL = r'''(?x
)
1307 https?
://(?P
<host
>%s)/(?P
<type>(?
:%s))/
1309 ''' % (PeerTubeIE._INSTANCES_RE, '|'.join(_TYPES.keys()))
1311 'url': 'https://peertube.tux.ovh/w/p/3af94cba-95e8-4b74-b37a-807ab6d82526',
1313 'id': '3af94cba-95e8-4b74-b37a-807ab6d82526',
1314 'description': 'playlist',
1315 'timestamp': 1611171863,
1316 'title': 'playlist',
1318 'playlist_mincount': 6,
1320 'url': 'https://peertube.tux.ovh/w/p/wkyqcQBnsvFxtUB2pkYc1e',
1322 'id': 'wkyqcQBnsvFxtUB2pkYc1e',
1323 'description': 'Cette liste de vidéos contient uniquement les jeux qui peuvent être terminés en une seule vidéo.',
1324 'title': 'Let\'s Play',
1325 'timestamp': 1604147331,
1327 'playlist_mincount': 6,
1329 'url': 'https://peertube.debian.social/w/p/hFdJoTuyhNJVa1cDWd1d12',
1331 'id': 'hFdJoTuyhNJVa1cDWd1d12',
1332 'description': 'Diversas palestras do Richard Stallman no Brasil.',
1333 'title': 'Richard Stallman no Brasil',
1334 'timestamp': 1599676222,
1336 'playlist_mincount': 9,
1338 'url': 'https://peertube2.cpy.re/a/chocobozzz/videos',
1341 'timestamp': 1553874564,
1342 'title': 'chocobozzz',
1344 'playlist_mincount': 2,
1346 'url': 'https://framatube.org/c/bf54d359-cfad-4935-9d45-9d6be93f63e8/videos',
1348 'id': 'bf54d359-cfad-4935-9d45-9d6be93f63e8',
1349 'timestamp': 1519917377,
1350 'title': 'Les vidéos de Framasoft',
1352 'playlist_mincount': 345,
1354 'url': 'https://peertube2.cpy.re/c/blender_open_movies@video.blender.org/videos',
1356 'id': 'blender_open_movies@video.blender.org',
1357 'timestamp': 1542287810,
1358 'title': 'Official Blender Open Movies',
1360 'playlist_mincount': 11,
1362 _API_BASE = 'https://%s/api/v1/%s/%s%s'
1365 def call_api(self, host, name, path, base, **kwargs):
1366 return self._download_json(
1367 self._API_BASE % (host, base, name, path), name, **kwargs)
1369 def fetch_page(self, host, id, type, page):
1371 video_data = self.call_api(
1373 f'/videos?sort=-createdAt&start={self._PAGE_SIZE * (page - 1)}&count={self._PAGE_SIZE}&nsfw=both',
1374 type, note=f'Downloading page {page}').get('data', [])
1375 for video in video_data:
1376 shortUUID = video.get('shortUUID') or try_get(video, lambda x: x['video']['shortUUID'])
1377 video_title = video.get('name') or try_get(video, lambda x: x['video']['name'])
1378 yield self.url_result(
1379 f'https://{host}/w/{shortUUID}', PeerTubeIE.ie_key(),
1380 video_id=shortUUID, video_title=video_title)
1382 def _extract_playlist(self, host, type, id):
1383 info = self.call_api(host, id, '', type, note='Downloading playlist information', fatal=False)
1385 playlist_title = info.get('displayName')
1386 playlist_description = info.get('description')
1387 playlist_timestamp = unified_timestamp(info.get('createdAt'))
1388 channel = try_get(info, lambda x: x['ownerAccount']['name']) or info.get('displayName')
1389 channel_id = try_get(info, lambda x: x['ownerAccount']['id']) or info.get('id')
1390 thumbnail = format_field(info, 'thumbnailPath', f'https://{host}%s')
1392 entries = OnDemandPagedList(functools.partial(
1393 self.fetch_page, host, id, type), self._PAGE_SIZE)
1395 return self.playlist_result(
1396 entries, id, playlist_title, playlist_description,
1397 timestamp=playlist_timestamp, channel=channel, channel_id=channel_id, thumbnail=thumbnail)
1399 def _real_extract(self, url):
1400 type, host, id = self._match_valid_url(url).group('type', 'host', 'id')
1401 type = self._TYPES[type]
1402 return self._extract_playlist(host, type, id)