peertube.py 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400
  1. import functools
  2. import re
  3. from .common import InfoExtractor
  4. from ..compat import compat_str
  5. from ..utils import (
  6. format_field,
  7. int_or_none,
  8. parse_resolution,
  9. str_or_none,
  10. try_get,
  11. unified_timestamp,
  12. url_or_none,
  13. urljoin,
  14. OnDemandPagedList,
  15. )
  16. class PeerTubeIE(InfoExtractor):
  17. _INSTANCES_RE = r'''(?:
  18. # Taken from https://instances.joinpeertube.org/instances
  19. 40two\.tube|
  20. a\.metube\.ch|
  21. advtv\.ml|
  22. algorithmic\.tv|
  23. alimulama\.com|
  24. arcana\.fun|
  25. archive\.vidicon\.org|
  26. artefac-paris\.tv|
  27. auf1\.eu|
  28. battlepenguin\.video|
  29. beertube\.epgn\.ch|
  30. befree\.nohost\.me|
  31. bideoak\.argia\.eus|
  32. birkeundnymphe\.de|
  33. bitcointv\.com|
  34. cattube\.org|
  35. clap\.nerv-project\.eu|
  36. climatejustice\.video|
  37. comf\.tube|
  38. conspiracydistillery\.com|
  39. darkvapor\.nohost\.me|
  40. daschauher\.aksel\.rocks|
  41. digitalcourage\.video|
  42. dreiecksnebel\.alex-detsch\.de|
  43. eduvid\.org|
  44. evangelisch\.video|
  45. exo\.tube|
  46. fair\.tube|
  47. fediverse\.tv|
  48. film\.k-prod\.fr|
  49. flim\.txmn\.tk|
  50. fotogramas\.politicaconciencia\.org|
  51. ftsi\.ru|
  52. gary\.vger\.cloud|
  53. graeber\.video|
  54. greatview\.video|
  55. grypstube\.uni-greifswald\.de|
  56. highvoltage\.tv|
  57. hpstube\.fr|
  58. htp\.live|
  59. hyperreal\.tube|
  60. juggling\.digital|
  61. kino\.kompot\.si|
  62. kino\.schuerz\.at|
  63. kinowolnosc\.pl|
  64. kirche\.peertube-host\.de|
  65. kodcast\.com|
  66. kolektiva\.media|
  67. kraut\.zone|
  68. kumi\.tube|
  69. lastbreach\.tv|
  70. lepetitmayennais\.fr\.nf|
  71. lexx\.impa\.me|
  72. libertynode\.tv|
  73. libra\.syntazia\.org|
  74. libremedia\.video|
  75. live\.libratoi\.org|
  76. live\.nanao\.moe|
  77. live\.toobnix\.org|
  78. livegram\.net|
  79. lolitube\.freedomchan\.moe|
  80. lucarne\.balsamine\.be|
  81. maindreieck-tv\.de|
  82. mani\.tube|
  83. manicphase\.me|
  84. media\.fsfe\.org|
  85. media\.gzevd\.de|
  86. media\.inno3\.cricket|
  87. media\.kaitaia\.life|
  88. media\.krashboyz\.org|
  89. media\.over-world\.org|
  90. media\.skewed\.de|
  91. media\.undeadnetwork\.de|
  92. medias\.pingbase\.net|
  93. melsungen\.peertube-host\.de|
  94. mirametube\.fr|
  95. mojotube\.net|
  96. monplaisirtube\.ddns\.net|
  97. mountaintown\.video|
  98. my\.bunny\.cafe|
  99. myfreetube\.de|
  100. mytube\.kn-cloud\.de|
  101. mytube\.madzel\.de|
  102. myworkoutarenapeertube\.cf|
  103. nanawel-peertube\.dyndns\.org|
  104. nastub\.cz|
  105. offenes\.tv|
  106. orgdup\.media|
  107. ovaltube\.codinglab\.ch|
  108. p2ptv\.ru|
  109. p\.eertu\.be|
  110. p\.lu|
  111. peer\.azurs\.fr|
  112. peertube1\.zeteo\.me|
  113. peertube\.020\.pl|
  114. peertube\.0x5e\.eu|
  115. peertube\.alpharius\.io|
  116. peertube\.am-networks\.fr|
  117. peertube\.anduin\.net|
  118. peertube\.anzui\.dev|
  119. peertube\.arbleizez\.bzh|
  120. peertube\.art3mis\.de|
  121. peertube\.atilla\.org|
  122. peertube\.atsuchan\.page|
  123. peertube\.aukfood\.net|
  124. peertube\.aventer\.biz|
  125. peertube\.b38\.rural-it\.org|
  126. peertube\.beeldengeluid\.nl|
  127. peertube\.be|
  128. peertube\.bgzashtita\.es|
  129. peertube\.bitsandlinux\.com|
  130. peertube\.biz|
  131. peertube\.boba\.best|
  132. peertube\.br0\.fr|
  133. peertube\.bridaahost\.ynh\.fr|
  134. peertube\.bubbletea\.dev|
  135. peertube\.bubuit\.net|
  136. peertube\.cabaal\.net|
  137. peertube\.cats-home\.net|
  138. peertube\.chemnitz\.freifunk\.net|
  139. peertube\.chevro\.fr|
  140. peertube\.chrisspiegl\.com|
  141. peertube\.chtisurel\.net|
  142. peertube\.cipherbliss\.com|
  143. peertube\.cloud\.sans\.pub|
  144. peertube\.cpge-brizeux\.fr|
  145. peertube\.ctseuro\.com|
  146. peertube\.cuatrolibertades\.org|
  147. peertube\.cybercirujas\.club|
  148. peertube\.cythin\.com|
  149. peertube\.davigge\.com|
  150. peertube\.dc\.pini\.fr|
  151. peertube\.debian\.social|
  152. peertube\.demonix\.fr|
  153. peertube\.designersethiques\.org|
  154. peertube\.desmu\.fr|
  155. peertube\.devloprog\.org|
  156. peertube\.devol\.it|
  157. peertube\.dtmf\.ca|
  158. peertube\.ecologie\.bzh|
  159. peertube\.eu\.org|
  160. peertube\.european-pirates\.eu|
  161. peertube\.euskarabildua\.eus|
  162. peertube\.fenarinarsa\.com|
  163. peertube\.fomin\.site|
  164. peertube\.forsud\.be|
  165. peertube\.francoispelletier\.org|
  166. peertube\.freenet\.ru|
  167. peertube\.freetalklive\.com|
  168. peertube\.functional\.cafe|
  169. peertube\.gardeludwig\.fr|
  170. peertube\.gargantia\.fr|
  171. peertube\.gcfamily\.fr|
  172. peertube\.genma\.fr|
  173. peertube\.get-racing\.de|
  174. peertube\.gidikroon\.eu|
  175. peertube\.gruezishop\.ch|
  176. peertube\.habets\.house|
  177. peertube\.hackerfraternity\.org|
  178. peertube\.ichigo\.everydayimshuflin\.com|
  179. peertube\.ignifi\.me|
  180. peertube\.inapurna\.org|
  181. peertube\.informaction\.info|
  182. peertube\.interhop\.org|
  183. peertube\.iselfhost\.com|
  184. peertube\.it|
  185. peertube\.jensdiemer\.de|
  186. peertube\.joffreyverd\.fr|
  187. peertube\.kalua\.im|
  188. peertube\.kathryl\.fr|
  189. peertube\.keazilla\.net|
  190. peertube\.klaewyss\.fr|
  191. peertube\.kodcast\.com|
  192. peertube\.kx\.studio|
  193. peertube\.lagvoid\.com|
  194. peertube\.lavallee\.tech|
  195. peertube\.le5emeaxe\.fr|
  196. peertube\.lestutosdeprocessus\.fr|
  197. peertube\.librenet\.co\.za|
  198. peertube\.logilab\.fr|
  199. peertube\.louisematic\.site|
  200. peertube\.luckow\.org|
  201. peertube\.luga\.at|
  202. peertube\.lyceeconnecte\.fr|
  203. peertube\.manalejandro\.com|
  204. peertube\.marud\.fr|
  205. peertube\.mattone\.net|
  206. peertube\.maxweiss\.io|
  207. peertube\.monlycee\.net|
  208. peertube\.mxinfo\.fr|
  209. peertube\.myrasp\.eu|
  210. peertube\.nebelcloud\.de|
  211. peertube\.netzbegruenung\.de|
  212. peertube\.newsocial\.tech|
  213. peertube\.nicolastissot\.fr|
  214. peertube\.nz|
  215. peertube\.offerman\.com|
  216. peertube\.opencloud\.lu|
  217. peertube\.orthus\.link|
  218. peertube\.patapouf\.xyz|
  219. peertube\.pi2\.dev|
  220. peertube\.plataformess\.org|
  221. peertube\.pl|
  222. peertube\.portaesgnos\.org|
  223. peertube\.r2\.enst\.fr|
  224. peertube\.r5c3\.fr|
  225. peertube\.radres\.xyz|
  226. peertube\.red|
  227. peertube\.robonomics\.network|
  228. peertube\.rtnkv\.cloud|
  229. peertube\.runfox\.tk|
  230. peertube\.satoshishop\.de|
  231. peertube\.scic-tetris\.org|
  232. peertube\.securitymadein\.lu|
  233. peertube\.semweb\.pro|
  234. peertube\.social\.my-wan\.de|
  235. peertube\.soykaf\.org|
  236. peertube\.stefofficiel\.me|
  237. peertube\.stream|
  238. peertube\.su|
  239. peertube\.swrs\.net|
  240. peertube\.takeko\.cyou|
  241. peertube\.tangentfox\.com|
  242. peertube\.taxinachtegel\.de|
  243. peertube\.thenewoil\.xyz|
  244. peertube\.ti-fr\.com|
  245. peertube\.tiennot\.net|
  246. peertube\.troback\.com|
  247. peertube\.tspu\.edu\.ru|
  248. peertube\.tux\.ovh|
  249. peertube\.tv|
  250. peertube\.tweb\.tv|
  251. peertube\.ucy\.de|
  252. peertube\.underworld\.fr|
  253. peertube\.us\.to|
  254. peertube\.ventresmous\.fr|
  255. peertube\.vlaki\.cz|
  256. peertube\.w\.utnw\.de|
  257. peertube\.westring\.digital|
  258. peertube\.xwiki\.com|
  259. peertube\.zoz-serv\.org|
  260. peervideo\.ru|
  261. periscope\.numenaute\.org|
  262. perron-tube\.de|
  263. petitlutinartube\.fr|
  264. phijkchu\.com|
  265. pierre\.tube|
  266. piraten\.space|
  267. play\.rosano\.ca|
  268. player\.ojamajo\.moe|
  269. plextube\.nl|
  270. pocketnetpeertube1\.nohost\.me|
  271. pocketnetpeertube3\.nohost\.me|
  272. pocketnetpeertube4\.nohost\.me|
  273. pocketnetpeertube5\.nohost\.me|
  274. pocketnetpeertube6\.nohost\.me|
  275. pt\.24-7\.ro|
  276. pt\.apathy\.top|
  277. pt\.diaspodon\.fr|
  278. pt\.fedi\.tech|
  279. pt\.maciej\.website|
  280. ptb\.lunarviews\.net|
  281. ptmir1\.inter21\.net|
  282. ptmir2\.inter21\.net|
  283. ptmir3\.inter21\.net|
  284. ptmir4\.inter21\.net|
  285. ptmir5\.inter21\.net|
  286. ptube\.horsentiers\.fr|
  287. ptube\.xmanifesto\.club|
  288. queermotion\.org|
  289. re-wizja\.re-medium\.com|
  290. regarder\.sans\.pub|
  291. ruraletv\.ovh|
  292. s1\.gegenstimme\.tv|
  293. s2\.veezee\.tube|
  294. sdmtube\.fr|
  295. sender-fm\.veezee\.tube|
  296. serv1\.wiki-tube\.de|
  297. serv3\.wiki-tube\.de|
  298. sickstream\.net|
  299. sleepy\.tube|
  300. sovran\.video|
  301. spectra\.video|
  302. stream\.elven\.pw|
  303. stream\.k-prod\.fr|
  304. stream\.shahab\.nohost\.me|
  305. streamsource\.video|
  306. studios\.racer159\.com|
  307. testtube\.florimond\.eu|
  308. tgi\.hosted\.spacebear\.ee|
  309. thaitube\.in\.th|
  310. the\.jokertv\.eu|
  311. theater\.ethernia\.net|
  312. thecool\.tube|
  313. tilvids\.com|
  314. toob\.bub\.org|
  315. tpaw\.video|
  316. truetube\.media|
  317. tuba\.lhub\.pl|
  318. tube-aix-marseille\.beta\.education\.fr|
  319. tube-amiens\.beta\.education\.fr|
  320. tube-besancon\.beta\.education\.fr|
  321. tube-bordeaux\.beta\.education\.fr|
  322. tube-clermont-ferrand\.beta\.education\.fr|
  323. tube-corse\.beta\.education\.fr|
  324. tube-creteil\.beta\.education\.fr|
  325. tube-dijon\.beta\.education\.fr|
  326. tube-education\.beta\.education\.fr|
  327. tube-grenoble\.beta\.education\.fr|
  328. tube-lille\.beta\.education\.fr|
  329. tube-limoges\.beta\.education\.fr|
  330. tube-montpellier\.beta\.education\.fr|
  331. tube-nancy\.beta\.education\.fr|
  332. tube-nantes\.beta\.education\.fr|
  333. tube-nice\.beta\.education\.fr|
  334. tube-normandie\.beta\.education\.fr|
  335. tube-orleans-tours\.beta\.education\.fr|
  336. tube-outremer\.beta\.education\.fr|
  337. tube-paris\.beta\.education\.fr|
  338. tube-poitiers\.beta\.education\.fr|
  339. tube-reims\.beta\.education\.fr|
  340. tube-rennes\.beta\.education\.fr|
  341. tube-strasbourg\.beta\.education\.fr|
  342. tube-toulouse\.beta\.education\.fr|
  343. tube-versailles\.beta\.education\.fr|
  344. tube1\.it\.tuwien\.ac\.at|
  345. tube\.abolivier\.bzh|
  346. tube\.ac-amiens\.fr|
  347. tube\.aerztefueraufklaerung\.de|
  348. tube\.alexx\.ml|
  349. tube\.amic37\.fr|
  350. tube\.anufrij\.de|
  351. tube\.apolut\.net|
  352. tube\.arkhalabs\.io|
  353. tube\.arthack\.nz|
  354. tube\.as211696\.net|
  355. tube\.avensio\.de|
  356. tube\.azbyka\.ru|
  357. tube\.azkware\.net|
  358. tube\.bachaner\.fr|
  359. tube\.bmesh\.org|
  360. tube\.borked\.host|
  361. tube\.bstly\.de|
  362. tube\.chaoszone\.tv|
  363. tube\.chatelet\.ovh|
  364. tube\.cloud-libre\.eu|
  365. tube\.cms\.garden|
  366. tube\.cowfee\.moe|
  367. tube\.cryptography\.dog|
  368. tube\.darknight-coffee\.org|
  369. tube\.dev\.lhub\.pl|
  370. tube\.distrilab\.fr|
  371. tube\.dsocialize\.net|
  372. tube\.ebin\.club|
  373. tube\.fdn\.fr|
  374. tube\.florimond\.eu|
  375. tube\.foxarmy\.ml|
  376. tube\.foxden\.party|
  377. tube\.frischesicht\.de|
  378. tube\.futuretic\.fr|
  379. tube\.gnous\.eu|
  380. tube\.grap\.coop|
  381. tube\.graz\.social|
  382. tube\.grin\.hu|
  383. tube\.hackerscop\.org|
  384. tube\.hordearii\.fr|
  385. tube\.jeena\.net|
  386. tube\.kai-stuht\.com|
  387. tube\.kockatoo\.org|
  388. tube\.kotur\.org|
  389. tube\.lacaveatonton\.ovh|
  390. tube\.linkse\.media|
  391. tube\.lokad\.com|
  392. tube\.lucie-philou\.com|
  393. tube\.melonbread\.xyz|
  394. tube\.mfraters\.net|
  395. tube\.motuhake\.xyz|
  396. tube\.mrbesen\.de|
  397. tube\.nah\.re|
  398. tube\.nchoco\.net|
  399. tube\.novg\.net|
  400. tube\.nox-rhea\.org|
  401. tube\.nuagelibre\.fr|
  402. tube\.nx12\.net|
  403. tube\.octaplex\.net|
  404. tube\.odat\.xyz|
  405. tube\.oisux\.org|
  406. tube\.opportunis\.me|
  407. tube\.org\.il|
  408. tube\.ortion\.xyz|
  409. tube\.others\.social|
  410. tube\.picasoft\.net|
  411. tube\.plomlompom\.com|
  412. tube\.pmj\.rocks|
  413. tube\.portes-imaginaire\.org|
  414. tube\.pyngu\.com|
  415. tube\.rebellion\.global|
  416. tube\.rhythms-of-resistance\.org|
  417. tube\.rita\.moe|
  418. tube\.rsi\.cnr\.it|
  419. tube\.s1gm4\.eu|
  420. tube\.saumon\.io|
  421. tube\.schleuss\.online|
  422. tube\.schule\.social|
  423. tube\.seditio\.fr|
  424. tube\.shanti\.cafe|
  425. tube\.shela\.nu|
  426. tube\.skrep\.in|
  427. tube\.sp-codes\.de|
  428. tube\.sp4ke\.com|
  429. tube\.superseriousbusiness\.org|
  430. tube\.systest\.eu|
  431. tube\.tappret\.fr|
  432. tube\.tardis\.world|
  433. tube\.toontoet\.nl|
  434. tube\.tpshd\.de|
  435. tube\.troopers\.agency|
  436. tube\.tylerdavis\.xyz|
  437. tube\.undernet\.uy|
  438. tube\.vigilian-consulting\.nl|
  439. tube\.vraphim\.com|
  440. tube\.wehost\.lgbt|
  441. tube\.wien\.rocks|
  442. tube\.wolfe\.casa|
  443. tube\.xd0\.de|
  444. tube\.xy-space\.de|
  445. tube\.yapbreak\.fr|
  446. tubedu\.org|
  447. tubes\.jodh\.us|
  448. tuktube\.com|
  449. turkum\.me|
  450. tututu\.tube|
  451. tuvideo\.encanarias\.info|
  452. tv1\.cocu\.cc|
  453. tv1\.gomntu\.space|
  454. tv2\.cocu\.cc|
  455. tv\.adn\.life|
  456. tv\.atmx\.ca|
  457. tv\.bitma\.st|
  458. tv\.generallyrubbish\.net\.au|
  459. tv\.lumbung\.space|
  460. tv\.mattchristiansenmedia\.com|
  461. tv\.netwhood\.online|
  462. tv\.neue\.city|
  463. tv\.piejacker\.net|
  464. tv\.pirateradio\.social|
  465. tv\.undersco\.re|
  466. tvox\.ru|
  467. twctube\.twc-zone\.eu|
  468. unfilter\.tube|
  469. v\.basspistol\.org|
  470. v\.kisombrella\.top|
  471. v\.lastorder\.xyz|
  472. v\.lor\.sh|
  473. v\.phreedom\.club|
  474. v\.sil\.sh|
  475. v\.szy\.io|
  476. v\.xxxapex\.com|
  477. veezee\.tube|
  478. vid\.dascoyote\.xyz|
  479. vid\.garwood\.io|
  480. vid\.ncrypt\.at|
  481. vid\.pravdastalina\.info|
  482. vid\.qorg11\.net|
  483. vid\.rajeshtaylor\.com|
  484. vid\.samtripoli\.com|
  485. vid\.werefox\.dev|
  486. vid\.wildeboer\.net|
  487. video-cave-v2\.de|
  488. video\.076\.ne\.jp|
  489. video\.1146\.nohost\.me|
  490. video\.altertek\.org|
  491. video\.anartist\.org|
  492. video\.apps\.thedoodleproject\.net|
  493. video\.artist\.cx|
  494. video\.asgardius\.company|
  495. video\.balsillie\.net|
  496. video\.bards\.online|
  497. video\.binarydad\.com|
  498. video\.blast-info\.fr|
  499. video\.catgirl\.biz|
  500. video\.cigliola\.com|
  501. video\.cm-en-transition\.fr|
  502. video\.cnt\.social|
  503. video\.coales\.co|
  504. video\.codingfield\.com|
  505. video\.comptoir\.net|
  506. video\.comune\.trento\.it|
  507. video\.cpn\.so|
  508. video\.csc49\.fr|
  509. video\.cybre\.town|
  510. video\.demokratischer-sommer\.de|
  511. video\.discord-insoumis\.fr|
  512. video\.dolphincastle\.com|
  513. video\.dresden\.network|
  514. video\.ecole-89\.com|
  515. video\.elgrillolibertario\.org|
  516. video\.emergeheart\.info|
  517. video\.eradicatinglove\.xyz|
  518. video\.ethantheenigma\.me|
  519. video\.exodus-privacy\.eu\.org|
  520. video\.fbxl\.net|
  521. video\.fhtagn\.org|
  522. video\.greenmycity\.eu|
  523. video\.guerredeclasse\.fr|
  524. video\.gyt\.is|
  525. video\.hackers\.town|
  526. video\.hardlimit\.com|
  527. video\.hooli\.co|
  528. video\.igem\.org|
  529. video\.internet-czas-dzialac\.pl|
  530. video\.islameye\.com|
  531. video\.kicik\.fr|
  532. video\.kuba-orlik\.name|
  533. video\.kyushojitsu\.ca|
  534. video\.lavolte\.net|
  535. video\.lespoesiesdheloise\.fr|
  536. video\.liberta\.vip|
  537. video\.liege\.bike|
  538. video\.linc\.systems|
  539. video\.linux\.it|
  540. video\.linuxtrent\.it|
  541. video\.lokal\.social|
  542. video\.lono\.space|
  543. video\.lunasqu\.ee|
  544. video\.lundi\.am|
  545. video\.marcorennmaus\.de|
  546. video\.mass-trespass\.uk|
  547. video\.mugoreve\.fr|
  548. video\.mundodesconocido\.com|
  549. video\.mycrowd\.ca|
  550. video\.nogafam\.es|
  551. video\.odayacres\.farm|
  552. video\.ozgurkon\.org|
  553. video\.p1ng0ut\.social|
  554. video\.p3x\.de|
  555. video\.pcf\.fr|
  556. video\.pony\.gallery|
  557. video\.potate\.space|
  558. video\.pourpenser\.pro|
  559. video\.progressiv\.dev|
  560. video\.resolutions\.it|
  561. video\.rw501\.de|
  562. video\.screamer\.wiki|
  563. video\.sdm-tools\.net|
  564. video\.sftblw\.moe|
  565. video\.shitposter\.club|
  566. video\.skyn3t\.in|
  567. video\.soi\.ch|
  568. video\.stuartbrand\.co\.uk|
  569. video\.thinkof\.name|
  570. video\.toot\.pt|
  571. video\.triplea\.fr|
  572. video\.turbo\.chat|
  573. video\.vaku\.org\.ua|
  574. video\.veloma\.org|
  575. video\.violoncello\.ch|
  576. video\.wilkie\.how|
  577. video\.wsf2021\.info|
  578. videorelay\.co|
  579. videos-passages\.huma-num\.fr|
  580. videos\.3d-wolf\.com|
  581. videos\.ahp-numerique\.fr|
  582. videos\.alexandrebadalo\.pt|
  583. videos\.archigny\.net|
  584. videos\.benjaminbrady\.ie|
  585. videos\.buceoluegoexisto\.com|
  586. videos\.capas\.se|
  587. videos\.casually\.cat|
  588. videos\.cloudron\.io|
  589. videos\.coletivos\.org|
  590. videos\.danksquad\.org|
  591. videos\.denshi\.live|
  592. videos\.fromouter\.space|
  593. videos\.fsci\.in|
  594. videos\.globenet\.org|
  595. videos\.hauspie\.fr|
  596. videos\.hush\.is|
  597. videos\.john-livingston\.fr|
  598. videos\.jordanwarne\.xyz|
  599. videos\.lavoixdessansvoix\.org|
  600. videos\.leslionsfloorball\.fr|
  601. videos\.lucero\.top|
  602. videos\.martyn\.berlin|
  603. videos\.mastodont\.cat|
  604. videos\.monstro1\.com|
  605. videos\.npo\.city|
  606. videos\.optoutpod\.com|
  607. videos\.petch\.rocks|
  608. videos\.pzelawski\.xyz|
  609. videos\.rampin\.org|
  610. videos\.scanlines\.xyz|
  611. videos\.shmalls\.pw|
  612. videos\.sibear\.fr|
  613. videos\.stadtfabrikanten\.org|
  614. videos\.tankernn\.eu|
  615. videos\.testimonia\.org|
  616. videos\.thisishowidontdisappear\.com|
  617. videos\.traumaheilung\.net|
  618. videos\.trom\.tf|
  619. videos\.wakkerewereld\.nu|
  620. videos\.weblib\.re|
  621. videos\.yesil\.club|
  622. vids\.roshless\.me|
  623. vids\.tekdmn\.me|
  624. vidz\.dou\.bet|
  625. vod\.lumikko\.dev|
  626. vs\.uniter\.network|
  627. vulgarisation-informatique\.fr|
  628. watch\.breadtube\.tv|
  629. watch\.deranalyst\.ch|
  630. watch\.ignorance\.eu|
  631. watch\.krazy\.party|
  632. watch\.libertaria\.space|
  633. watch\.rt4mn\.org|
  634. watch\.softinio\.com|
  635. watch\.tubelab\.video|
  636. web-fellow\.de|
  637. webtv\.vandoeuvre\.net|
  638. wechill\.space|
  639. wikileaks\.video|
  640. wiwi\.video|
  641. worldofvids\.com|
  642. wwtube\.net|
  643. www4\.mir\.inter21\.net|
  644. www\.birkeundnymphe\.de|
  645. www\.captain-german\.com|
  646. www\.wiki-tube\.de|
  647. xxivproduction\.video|
  648. xxx\.noho\.st|
  649. # from youtube-dl
  650. peertube\.rainbowswingers\.net|
  651. tube\.stanisic\.nl|
  652. peer\.suiri\.us|
  653. medias\.libox\.fr|
  654. videomensoif\.ynh\.fr|
  655. peertube\.travelpandas\.eu|
  656. peertube\.rachetjay\.fr|
  657. peertube\.montecsys\.fr|
  658. tube\.eskuero\.me|
  659. peer\.tube|
  660. peertube\.umeahackerspace\.se|
  661. tube\.nx-pod\.de|
  662. video\.monsieurbidouille\.fr|
  663. tube\.openalgeria\.org|
  664. vid\.lelux\.fi|
  665. video\.anormallostpod\.ovh|
  666. tube\.crapaud-fou\.org|
  667. peertube\.stemy\.me|
  668. lostpod\.space|
  669. exode\.me|
  670. peertube\.snargol\.com|
  671. vis\.ion\.ovh|
  672. videosdulib\.re|
  673. v\.mbius\.io|
  674. videos\.judrey\.eu|
  675. peertube\.osureplayviewer\.xyz|
  676. peertube\.mathieufamily\.ovh|
  677. www\.videos-libr\.es|
  678. fightforinfo\.com|
  679. peertube\.fediverse\.ru|
  680. peertube\.oiseauroch\.fr|
  681. video\.nesven\.eu|
  682. v\.bearvideo\.win|
  683. video\.qoto\.org|
  684. justporn\.cc|
  685. video\.vny\.fr|
  686. peervideo\.club|
  687. tube\.taker\.fr|
  688. peertube\.chantierlibre\.org|
  689. tube\.ipfixe\.info|
  690. tube\.kicou\.info|
  691. tube\.dodsorf\.as|
  692. videobit\.cc|
  693. video\.yukari\.moe|
  694. videos\.elbinario\.net|
  695. hkvideo\.live|
  696. pt\.tux\.tf|
  697. www\.hkvideo\.live|
  698. FIGHTFORINFO\.com|
  699. pt\.765racing\.com|
  700. peertube\.gnumeria\.eu\.org|
  701. nordenmedia\.com|
  702. peertube\.co\.uk|
  703. tube\.darfweb\.eu|
  704. tube\.kalah-france\.org|
  705. 0ch\.in|
  706. vod\.mochi\.academy|
  707. film\.node9\.org|
  708. peertube\.hatthieves\.es|
  709. video\.fitchfamily\.org|
  710. peertube\.ddns\.net|
  711. video\.ifuncle\.kr|
  712. video\.fdlibre\.eu|
  713. tube\.22decembre\.eu|
  714. peertube\.harmoniescreatives\.com|
  715. tube\.fabrigli\.fr|
  716. video\.thedwyers\.co|
  717. video\.bruitbruit\.com|
  718. peertube\.foxfam\.club|
  719. peer\.philoxweb\.be|
  720. videos\.bugs\.social|
  721. peertube\.malbert\.xyz|
  722. peertube\.bilange\.ca|
  723. libretube\.net|
  724. diytelevision\.com|
  725. peertube\.fedilab\.app|
  726. libre\.video|
  727. video\.mstddntfdn\.online|
  728. us\.tv|
  729. peertube\.sl-network\.fr|
  730. peertube\.dynlinux\.io|
  731. peertube\.david\.durieux\.family|
  732. peertube\.linuxrocks\.online|
  733. peerwatch\.xyz|
  734. v\.kretschmann\.social|
  735. tube\.otter\.sh|
  736. yt\.is\.nota\.live|
  737. tube\.dragonpsi\.xyz|
  738. peertube\.boneheadmedia\.com|
  739. videos\.funkwhale\.audio|
  740. watch\.44con\.com|
  741. peertube\.gcaillaut\.fr|
  742. peertube\.icu|
  743. pony\.tube|
  744. spacepub\.space|
  745. tube\.stbr\.io|
  746. v\.mom-gay\.faith|
  747. tube\.port0\.xyz|
  748. peertube\.simounet\.net|
  749. play\.jergefelt\.se|
  750. peertube\.zeteo\.me|
  751. tube\.danq\.me|
  752. peertube\.kerenon\.com|
  753. tube\.fab-l3\.org|
  754. tube\.calculate\.social|
  755. peertube\.mckillop\.org|
  756. tube\.netzspielplatz\.de|
  757. vod\.ksite\.de|
  758. peertube\.laas\.fr|
  759. tube\.govital\.net|
  760. peertube\.stephenson\.cc|
  761. bistule\.nohost\.me|
  762. peertube\.kajalinifi\.de|
  763. video\.ploud\.jp|
  764. video\.omniatv\.com|
  765. peertube\.ffs2play\.fr|
  766. peertube\.leboulaire\.ovh|
  767. peertube\.tronic-studio\.com|
  768. peertube\.public\.cat|
  769. peertube\.metalbanana\.net|
  770. video\.1000i100\.fr|
  771. peertube\.alter-nativ-voll\.de|
  772. tube\.pasa\.tf|
  773. tube\.worldofhauru\.xyz|
  774. pt\.kamp\.site|
  775. peertube\.teleassist\.fr|
  776. videos\.mleduc\.xyz|
  777. conf\.tube|
  778. media\.privacyinternational\.org|
  779. pt\.forty-two\.nl|
  780. video\.halle-leaks\.de|
  781. video\.grosskopfgames\.de|
  782. peertube\.schaeferit\.de|
  783. peertube\.jackbot\.fr|
  784. tube\.extinctionrebellion\.fr|
  785. peertube\.f-si\.org|
  786. video\.subak\.ovh|
  787. videos\.koweb\.fr|
  788. peertube\.zergy\.net|
  789. peertube\.roflcopter\.fr|
  790. peertube\.floss-marketing-school\.com|
  791. vloggers\.social|
  792. peertube\.iriseden\.eu|
  793. videos\.ubuntu-paris\.org|
  794. peertube\.mastodon\.host|
  795. armstube\.com|
  796. peertube\.s2s\.video|
  797. peertube\.lol|
  798. tube\.open-plug\.eu|
  799. open\.tube|
  800. peertube\.ch|
  801. peertube\.normandie-libre\.fr|
  802. peertube\.slat\.org|
  803. video\.lacaveatonton\.ovh|
  804. peertube\.uno|
  805. peertube\.servebeer\.com|
  806. peertube\.fedi\.quebec|
  807. tube\.h3z\.jp|
  808. tube\.plus200\.com|
  809. peertube\.eric\.ovh|
  810. tube\.metadocs\.cc|
  811. tube\.unmondemeilleur\.eu|
  812. gouttedeau\.space|
  813. video\.antirep\.net|
  814. nrop\.cant\.at|
  815. tube\.ksl-bmx\.de|
  816. tube\.plaf\.fr|
  817. tube\.tchncs\.de|
  818. video\.devinberg\.com|
  819. hitchtube\.fr|
  820. peertube\.kosebamse\.com|
  821. yunopeertube\.myddns\.me|
  822. peertube\.varney\.fr|
  823. peertube\.anon-kenkai\.com|
  824. tube\.maiti\.info|
  825. tubee\.fr|
  826. videos\.dinofly\.com|
  827. toobnix\.org|
  828. videotape\.me|
  829. voca\.tube|
  830. video\.heromuster\.com|
  831. video\.lemediatv\.fr|
  832. video\.up\.edu\.ph|
  833. balafon\.video|
  834. video\.ivel\.fr|
  835. thickrips\.cloud|
  836. pt\.laurentkruger\.fr|
  837. video\.monarch-pass\.net|
  838. peertube\.artica\.center|
  839. video\.alternanet\.fr|
  840. indymotion\.fr|
  841. fanvid\.stopthatimp\.net|
  842. video\.farci\.org|
  843. v\.lesterpig\.com|
  844. video\.okaris\.de|
  845. tube\.pawelko\.net|
  846. peertube\.mablr\.org|
  847. tube\.fede\.re|
  848. pytu\.be|
  849. evertron\.tv|
  850. devtube\.dev-wiki\.de|
  851. raptube\.antipub\.org|
  852. video\.selea\.se|
  853. peertube\.mygaia\.org|
  854. video\.oh14\.de|
  855. peertube\.livingutopia\.org|
  856. peertube\.the-penguin\.de|
  857. tube\.thechangebook\.org|
  858. tube\.anjara\.eu|
  859. pt\.pube\.tk|
  860. video\.samedi\.pm|
  861. mplayer\.demouliere\.eu|
  862. widemus\.de|
  863. peertube\.me|
  864. peertube\.zapashcanon\.fr|
  865. video\.latavernedejohnjohn\.fr|
  866. peertube\.pcservice46\.fr|
  867. peertube\.mazzonetto\.eu|
  868. video\.irem\.univ-paris-diderot\.fr|
  869. video\.livecchi\.cloud|
  870. alttube\.fr|
  871. video\.coop\.tools|
  872. video\.cabane-libre\.org|
  873. peertube\.openstreetmap\.fr|
  874. videos\.alolise\.org|
  875. irrsinn\.video|
  876. video\.antopie\.org|
  877. scitech\.video|
  878. tube2\.nemsia\.org|
  879. video\.amic37\.fr|
  880. peertube\.freeforge\.eu|
  881. video\.arbitrarion\.com|
  882. video\.datsemultimedia\.com|
  883. stoptrackingus\.tv|
  884. peertube\.ricostrongxxx\.com|
  885. docker\.videos\.lecygnenoir\.info|
  886. peertube\.togart\.de|
  887. tube\.postblue\.info|
  888. videos\.domainepublic\.net|
  889. peertube\.cyber-tribal\.com|
  890. video\.gresille\.org|
  891. peertube\.dsmouse\.net|
  892. cinema\.yunohost\.support|
  893. tube\.theocevaer\.fr|
  894. repro\.video|
  895. tube\.4aem\.com|
  896. quaziinc\.com|
  897. peertube\.metawurst\.space|
  898. videos\.wakapo\.com|
  899. video\.ploud\.fr|
  900. video\.freeradical\.zone|
  901. tube\.valinor\.fr|
  902. refuznik\.video|
  903. pt\.kircheneuenburg\.de|
  904. peertube\.asrun\.eu|
  905. peertube\.lagob\.fr|
  906. videos\.side-ways\.net|
  907. 91video\.online|
  908. video\.valme\.io|
  909. video\.taboulisme\.com|
  910. videos-libr\.es|
  911. tv\.mooh\.fr|
  912. nuage\.acostey\.fr|
  913. video\.monsieur-a\.fr|
  914. peertube\.librelois\.fr|
  915. videos\.pair2jeux\.tube|
  916. videos\.pueseso\.club|
  917. peer\.mathdacloud\.ovh|
  918. media\.assassinate-you\.net|
  919. vidcommons\.org|
  920. ptube\.rousset\.nom\.fr|
  921. tube\.cyano\.at|
  922. videos\.squat\.net|
  923. video\.iphodase\.fr|
  924. peertube\.makotoworkshop\.org|
  925. peertube\.serveur\.slv-valbonne\.fr|
  926. vault\.mle\.party|
  927. hostyour\.tv|
  928. videos\.hack2g2\.fr|
  929. libre\.tube|
  930. pire\.artisanlogiciel\.net|
  931. videos\.numerique-en-commun\.fr|
  932. video\.netsyms\.com|
  933. video\.die-partei\.social|
  934. video\.writeas\.org|
  935. peertube\.swarm\.solvingmaz\.es|
  936. tube\.pericoloso\.ovh|
  937. watching\.cypherpunk\.observer|
  938. videos\.adhocmusic\.com|
  939. tube\.rfc1149\.net|
  940. peertube\.librelabucm\.org|
  941. videos\.numericoop\.fr|
  942. peertube\.koehn\.com|
  943. peertube\.anarchmusicall\.net|
  944. tube\.kampftoast\.de|
  945. vid\.y-y\.li|
  946. peertube\.xtenz\.xyz|
  947. diode\.zone|
  948. tube\.egf\.mn|
  949. peertube\.nomagic\.uk|
  950. visionon\.tv|
  951. videos\.koumoul\.com|
  952. video\.rastapuls\.com|
  953. video\.mantlepro\.com|
  954. video\.deadsuperhero\.com|
  955. peertube\.musicstudio\.pro|
  956. peertube\.we-keys\.fr|
  957. artitube\.artifaille\.fr|
  958. peertube\.ethernia\.net|
  959. tube\.midov\.pl|
  960. peertube\.fr|
  961. watch\.snoot\.tube|
  962. peertube\.donnadieu\.fr|
  963. argos\.aquilenet\.fr|
  964. tube\.nemsia\.org|
  965. tube\.bruniau\.net|
  966. videos\.darckoune\.moe|
  967. tube\.traydent\.info|
  968. dev\.videos\.lecygnenoir\.info|
  969. peertube\.nayya\.org|
  970. peertube\.live|
  971. peertube\.mofgao\.space|
  972. video\.lequerrec\.eu|
  973. peertube\.amicale\.net|
  974. aperi\.tube|
  975. tube\.ac-lyon\.fr|
  976. video\.lw1\.at|
  977. www\.yiny\.org|
  978. videos\.pofilo\.fr|
  979. tube\.lou\.lt|
  980. choob\.h\.etbus\.ch|
  981. tube\.hoga\.fr|
  982. peertube\.heberge\.fr|
  983. video\.obermui\.de|
  984. videos\.cloudfrancois\.fr|
  985. betamax\.video|
  986. video\.typica\.us|
  987. tube\.piweb\.be|
  988. video\.blender\.org|
  989. peertube\.cat|
  990. tube\.kdy\.ch|
  991. pe\.ertu\.be|
  992. peertube\.social|
  993. videos\.lescommuns\.org|
  994. tv\.datamol\.org|
  995. videonaute\.fr|
  996. dialup\.express|
  997. peertube\.nogafa\.org|
  998. megatube\.lilomoino\.fr|
  999. peertube\.tamanoir\.foucry\.net|
  1000. peertube\.devosi\.org|
  1001. peertube\.1312\.media|
  1002. tube\.bootlicker\.party|
  1003. skeptikon\.fr|
  1004. video\.blueline\.mg|
  1005. tube\.homecomputing\.fr|
  1006. tube\.ouahpiti\.info|
  1007. video\.tedomum\.net|
  1008. video\.g3l\.org|
  1009. fontube\.fr|
  1010. peertube\.gaialabs\.ch|
  1011. tube\.kher\.nl|
  1012. peertube\.qtg\.fr|
  1013. video\.migennes\.net|
  1014. tube\.p2p\.legal|
  1015. troll\.tv|
  1016. videos\.iut-orsay\.fr|
  1017. peertube\.solidev\.net|
  1018. videos\.cemea\.org|
  1019. video\.passageenseine\.fr|
  1020. videos\.festivalparminous\.org|
  1021. peertube\.touhoppai\.moe|
  1022. sikke\.fi|
  1023. peer\.hostux\.social|
  1024. share\.tube|
  1025. peertube\.walkingmountains\.fr|
  1026. videos\.benpro\.fr|
  1027. peertube\.parleur\.net|
  1028. peertube\.heraut\.eu|
  1029. tube\.aquilenet\.fr|
  1030. peertube\.gegeweb\.eu|
  1031. framatube\.org|
  1032. thinkerview\.video|
  1033. tube\.conferences-gesticulees\.net|
  1034. peertube\.datagueule\.tv|
  1035. video\.lqdn\.fr|
  1036. tube\.mochi\.academy|
  1037. media\.zat\.im|
  1038. video\.colibris-outilslibres\.org|
  1039. tube\.svnet\.fr|
  1040. peertube\.video|
  1041. peertube2\.cpy\.re|
  1042. peertube3\.cpy\.re|
  1043. videos\.tcit\.fr|
  1044. peertube\.cpy\.re|
  1045. canard\.tube
  1046. )'''
  1047. _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}'
  1048. _API_BASE = 'https://%s/api/v1/videos/%s/%s'
  1049. _VALID_URL = r'''(?x)
  1050. (?:
  1051. peertube:(?P<host>[^:]+):|
  1052. https?://(?P<host_2>%s)/(?:videos/(?:watch|embed)|api/v\d/videos|w)/
  1053. )
  1054. (?P<id>%s)
  1055. ''' % (_INSTANCES_RE, _UUID_RE)
  1056. _EMBED_REGEX = [r'''(?x)<iframe[^>]+\bsrc=["\'](?P<url>(?:https?:)?//{_INSTANCES_RE}/videos/embed/{cls._UUID_RE})''']
  1057. _TESTS = [{
  1058. 'url': 'https://framatube.org/videos/watch/9c9de5e8-0a1e-484a-b099-e80766180a6d',
  1059. 'md5': '8563064d245a4be5705bddb22bb00a28',
  1060. 'info_dict': {
  1061. 'id': '9c9de5e8-0a1e-484a-b099-e80766180a6d',
  1062. 'ext': 'mp4',
  1063. 'title': 'What is PeerTube?',
  1064. 'description': 'md5:3fefb8dde2b189186ce0719fda6f7b10',
  1065. 'thumbnail': r're:https?://.*\.(?:jpg|png)',
  1066. 'timestamp': 1538391166,
  1067. 'upload_date': '20181001',
  1068. 'uploader': 'Framasoft',
  1069. 'uploader_id': '3',
  1070. 'uploader_url': 'https://framatube.org/accounts/framasoft',
  1071. 'channel': 'A propos de PeerTube',
  1072. 'channel_id': '2215',
  1073. 'channel_url': 'https://framatube.org/video-channels/joinpeertube',
  1074. 'language': 'en',
  1075. 'license': 'Attribution - Share Alike',
  1076. 'duration': 113,
  1077. 'view_count': int,
  1078. 'like_count': int,
  1079. 'dislike_count': int,
  1080. 'tags': ['framasoft', 'peertube'],
  1081. 'categories': ['Science & Technology'],
  1082. }
  1083. }, {
  1084. 'url': 'https://peertube2.cpy.re/w/122d093a-1ede-43bd-bd34-59d2931ffc5e',
  1085. 'info_dict': {
  1086. 'id': '122d093a-1ede-43bd-bd34-59d2931ffc5e',
  1087. 'ext': 'mp4',
  1088. 'title': 'E2E tests',
  1089. 'uploader_id': '37855',
  1090. 'timestamp': 1589276219,
  1091. 'upload_date': '20200512',
  1092. 'uploader': 'chocobozzz',
  1093. }
  1094. }, {
  1095. 'url': 'https://peertube2.cpy.re/w/3fbif9S3WmtTP8gGsC5HBd',
  1096. 'info_dict': {
  1097. 'id': '3fbif9S3WmtTP8gGsC5HBd',
  1098. 'ext': 'mp4',
  1099. 'title': 'E2E tests',
  1100. 'uploader_id': '37855',
  1101. 'timestamp': 1589276219,
  1102. 'upload_date': '20200512',
  1103. 'uploader': 'chocobozzz',
  1104. },
  1105. }, {
  1106. 'url': 'https://peertube2.cpy.re/api/v1/videos/3fbif9S3WmtTP8gGsC5HBd',
  1107. 'info_dict': {
  1108. 'id': '3fbif9S3WmtTP8gGsC5HBd',
  1109. 'ext': 'mp4',
  1110. 'title': 'E2E tests',
  1111. 'uploader_id': '37855',
  1112. 'timestamp': 1589276219,
  1113. 'upload_date': '20200512',
  1114. 'uploader': 'chocobozzz',
  1115. },
  1116. }, {
  1117. # Issue #26002
  1118. 'url': 'peertube:spacepub.space:d8943b2d-8280-497b-85ec-bc282ec2afdc',
  1119. 'info_dict': {
  1120. 'id': 'd8943b2d-8280-497b-85ec-bc282ec2afdc',
  1121. 'ext': 'mp4',
  1122. 'title': 'Dot matrix printer shell demo',
  1123. 'uploader_id': '3',
  1124. 'timestamp': 1587401293,
  1125. 'upload_date': '20200420',
  1126. 'uploader': 'Drew DeVault',
  1127. }
  1128. }, {
  1129. 'url': 'https://peertube.debian.social/videos/watch/0b04f13d-1e18-4f1d-814e-4979aa7c9c44',
  1130. 'only_matching': True,
  1131. }, {
  1132. # nsfw
  1133. 'url': 'https://vod.ksite.de/videos/watch/9bb88cd3-9959-46d9-9ab9-33d2bb704c39',
  1134. 'only_matching': True,
  1135. }, {
  1136. 'url': 'https://vod.ksite.de/videos/embed/fed67262-6edb-4d1c-833b-daa9085c71d7',
  1137. 'only_matching': True,
  1138. }, {
  1139. 'url': 'https://peertube.tv/api/v1/videos/c1875674-97d0-4c94-a058-3f7e64c962e8',
  1140. 'only_matching': True,
  1141. }, {
  1142. 'url': 'peertube:framatube.org:b37a5b9f-e6b5-415c-b700-04a5cd6ec205',
  1143. 'only_matching': True,
  1144. }]
  1145. @staticmethod
  1146. def _extract_peertube_url(webpage, source_url):
  1147. mobj = re.match(
  1148. r'https?://(?P<host>[^/]+)/(?:videos/(?:watch|embed)|w)/(?P<id>%s)'
  1149. % PeerTubeIE._UUID_RE, source_url)
  1150. if mobj and any(p in webpage for p in (
  1151. 'meta property="og:platform" content="PeerTube"',
  1152. '<title>PeerTube<',
  1153. 'There will be other non JS-based clients to access PeerTube',
  1154. '>We are sorry but it seems that PeerTube is not compatible with your web browser.<')):
  1155. return 'peertube:%s:%s' % mobj.group('host', 'id')
  1156. @classmethod
  1157. def _extract_embed_urls(cls, url, webpage):
  1158. embeds = tuple(super()._extract_embed_urls(url, webpage))
  1159. if embeds:
  1160. return embeds
  1161. peertube_url = cls._extract_peertube_url(webpage, url)
  1162. if peertube_url:
  1163. return [peertube_url]
  1164. def _call_api(self, host, video_id, path, note=None, errnote=None, fatal=True):
  1165. return self._download_json(
  1166. self._API_BASE % (host, video_id, path), video_id,
  1167. note=note, errnote=errnote, fatal=fatal)
  1168. def _get_subtitles(self, host, video_id):
  1169. captions = self._call_api(
  1170. host, video_id, 'captions', note='Downloading captions JSON',
  1171. fatal=False)
  1172. if not isinstance(captions, dict):
  1173. return
  1174. data = captions.get('data')
  1175. if not isinstance(data, list):
  1176. return
  1177. subtitles = {}
  1178. for e in data:
  1179. language_id = try_get(e, lambda x: x['language']['id'], compat_str)
  1180. caption_url = urljoin('https://%s' % host, e.get('captionPath'))
  1181. if not caption_url:
  1182. continue
  1183. subtitles.setdefault(language_id or 'en', []).append({
  1184. 'url': caption_url,
  1185. })
  1186. return subtitles
  1187. def _real_extract(self, url):
  1188. mobj = self._match_valid_url(url)
  1189. host = mobj.group('host') or mobj.group('host_2')
  1190. video_id = mobj.group('id')
  1191. video = self._call_api(
  1192. host, video_id, '', note='Downloading video JSON')
  1193. title = video['name']
  1194. formats = []
  1195. files = video.get('files') or []
  1196. for playlist in (video.get('streamingPlaylists') or []):
  1197. if not isinstance(playlist, dict):
  1198. continue
  1199. playlist_files = playlist.get('files')
  1200. if not (playlist_files and isinstance(playlist_files, list)):
  1201. continue
  1202. files.extend(playlist_files)
  1203. for file_ in files:
  1204. if not isinstance(file_, dict):
  1205. continue
  1206. file_url = url_or_none(file_.get('fileUrl'))
  1207. if not file_url:
  1208. continue
  1209. file_size = int_or_none(file_.get('size'))
  1210. format_id = try_get(
  1211. file_, lambda x: x['resolution']['label'], compat_str)
  1212. f = parse_resolution(format_id)
  1213. f.update({
  1214. 'url': file_url,
  1215. 'format_id': format_id,
  1216. 'filesize': file_size,
  1217. })
  1218. if format_id == '0p':
  1219. f['vcodec'] = 'none'
  1220. else:
  1221. f['fps'] = int_or_none(file_.get('fps'))
  1222. formats.append(f)
  1223. description = video.get('description')
  1224. if description and len(description) >= 250:
  1225. # description is shortened
  1226. full_description = self._call_api(
  1227. host, video_id, 'description', note='Downloading description JSON',
  1228. fatal=False)
  1229. if isinstance(full_description, dict):
  1230. description = str_or_none(full_description.get('description')) or description
  1231. subtitles = self.extract_subtitles(host, video_id)
  1232. def data(section, field, type_):
  1233. return try_get(video, lambda x: x[section][field], type_)
  1234. def account_data(field, type_):
  1235. return data('account', field, type_)
  1236. def channel_data(field, type_):
  1237. return data('channel', field, type_)
  1238. category = data('category', 'label', compat_str)
  1239. categories = [category] if category else None
  1240. nsfw = video.get('nsfw')
  1241. if nsfw is bool:
  1242. age_limit = 18 if nsfw else 0
  1243. else:
  1244. age_limit = None
  1245. webpage_url = 'https://%s/videos/watch/%s' % (host, video_id)
  1246. return {
  1247. 'id': video_id,
  1248. 'title': title,
  1249. 'description': description,
  1250. 'thumbnail': urljoin(webpage_url, video.get('thumbnailPath')),
  1251. 'timestamp': unified_timestamp(video.get('publishedAt')),
  1252. 'uploader': account_data('displayName', compat_str),
  1253. 'uploader_id': str_or_none(account_data('id', int)),
  1254. 'uploader_url': url_or_none(account_data('url', compat_str)),
  1255. 'channel': channel_data('displayName', compat_str),
  1256. 'channel_id': str_or_none(channel_data('id', int)),
  1257. 'channel_url': url_or_none(channel_data('url', compat_str)),
  1258. 'language': data('language', 'id', compat_str),
  1259. 'license': data('licence', 'label', compat_str),
  1260. 'duration': int_or_none(video.get('duration')),
  1261. 'view_count': int_or_none(video.get('views')),
  1262. 'like_count': int_or_none(video.get('likes')),
  1263. 'dislike_count': int_or_none(video.get('dislikes')),
  1264. 'age_limit': age_limit,
  1265. 'tags': try_get(video, lambda x: x['tags'], list),
  1266. 'categories': categories,
  1267. 'formats': formats,
  1268. 'subtitles': subtitles,
  1269. 'webpage_url': webpage_url,
  1270. }
  1271. class PeerTubePlaylistIE(InfoExtractor):
  1272. IE_NAME = 'PeerTube:Playlist'
  1273. _TYPES = {
  1274. 'a': 'accounts',
  1275. 'c': 'video-channels',
  1276. 'w/p': 'video-playlists',
  1277. }
  1278. _VALID_URL = r'''(?x)
  1279. https?://(?P<host>%s)/(?P<type>(?:%s))/
  1280. (?P<id>[^/]+)
  1281. ''' % (PeerTubeIE._INSTANCES_RE, '|'.join(_TYPES.keys()))
  1282. _TESTS = [{
  1283. 'url': 'https://peertube.tux.ovh/w/p/3af94cba-95e8-4b74-b37a-807ab6d82526',
  1284. 'info_dict': {
  1285. 'id': '3af94cba-95e8-4b74-b37a-807ab6d82526',
  1286. 'description': 'playlist',
  1287. 'timestamp': 1611171863,
  1288. 'title': 'playlist',
  1289. },
  1290. 'playlist_mincount': 6,
  1291. }, {
  1292. 'url': 'https://peertube.tux.ovh/w/p/wkyqcQBnsvFxtUB2pkYc1e',
  1293. 'info_dict': {
  1294. 'id': 'wkyqcQBnsvFxtUB2pkYc1e',
  1295. 'description': 'Cette liste de vidéos contient uniquement les jeux qui peuvent être terminés en une seule vidéo.',
  1296. 'title': 'Let\'s Play',
  1297. 'timestamp': 1604147331,
  1298. },
  1299. 'playlist_mincount': 6,
  1300. }, {
  1301. 'url': 'https://peertube.debian.social/w/p/hFdJoTuyhNJVa1cDWd1d12',
  1302. 'info_dict': {
  1303. 'id': 'hFdJoTuyhNJVa1cDWd1d12',
  1304. 'description': 'Diversas palestras do Richard Stallman no Brasil.',
  1305. 'title': 'Richard Stallman no Brasil',
  1306. 'timestamp': 1599676222,
  1307. },
  1308. 'playlist_mincount': 9,
  1309. }, {
  1310. 'url': 'https://peertube2.cpy.re/a/chocobozzz/videos',
  1311. 'info_dict': {
  1312. 'id': 'chocobozzz',
  1313. 'timestamp': 1553874564,
  1314. 'title': 'chocobozzz',
  1315. },
  1316. 'playlist_mincount': 2,
  1317. }, {
  1318. 'url': 'https://framatube.org/c/bf54d359-cfad-4935-9d45-9d6be93f63e8/videos',
  1319. 'info_dict': {
  1320. 'id': 'bf54d359-cfad-4935-9d45-9d6be93f63e8',
  1321. 'timestamp': 1519917377,
  1322. 'title': 'Les vidéos de Framasoft',
  1323. },
  1324. 'playlist_mincount': 345,
  1325. }, {
  1326. 'url': 'https://peertube2.cpy.re/c/blender_open_movies@video.blender.org/videos',
  1327. 'info_dict': {
  1328. 'id': 'blender_open_movies@video.blender.org',
  1329. 'timestamp': 1542287810,
  1330. 'title': 'Official Blender Open Movies',
  1331. },
  1332. 'playlist_mincount': 11,
  1333. }]
  1334. _API_BASE = 'https://%s/api/v1/%s/%s%s'
  1335. _PAGE_SIZE = 30
  1336. def call_api(self, host, name, path, base, **kwargs):
  1337. return self._download_json(
  1338. self._API_BASE % (host, base, name, path), name, **kwargs)
  1339. def fetch_page(self, host, id, type, page):
  1340. page += 1
  1341. video_data = self.call_api(
  1342. host, id,
  1343. f'/videos?sort=-createdAt&start={self._PAGE_SIZE * (page - 1)}&count={self._PAGE_SIZE}&nsfw=both',
  1344. type, note=f'Downloading page {page}').get('data', [])
  1345. for video in video_data:
  1346. shortUUID = video.get('shortUUID') or try_get(video, lambda x: x['video']['shortUUID'])
  1347. video_title = video.get('name') or try_get(video, lambda x: x['video']['name'])
  1348. yield self.url_result(
  1349. f'https://{host}/w/{shortUUID}', PeerTubeIE.ie_key(),
  1350. video_id=shortUUID, video_title=video_title)
  1351. def _extract_playlist(self, host, type, id):
  1352. info = self.call_api(host, id, '', type, note='Downloading playlist information', fatal=False)
  1353. playlist_title = info.get('displayName')
  1354. playlist_description = info.get('description')
  1355. playlist_timestamp = unified_timestamp(info.get('createdAt'))
  1356. channel = try_get(info, lambda x: x['ownerAccount']['name']) or info.get('displayName')
  1357. channel_id = try_get(info, lambda x: x['ownerAccount']['id']) or info.get('id')
  1358. thumbnail = format_field(info, 'thumbnailPath', f'https://{host}%s')
  1359. entries = OnDemandPagedList(functools.partial(
  1360. self.fetch_page, host, id, type), self._PAGE_SIZE)
  1361. return self.playlist_result(
  1362. entries, id, playlist_title, playlist_description,
  1363. timestamp=playlist_timestamp, channel=channel, channel_id=channel_id, thumbnail=thumbnail)
  1364. def _real_extract(self, url):
  1365. type, host, id = self._match_valid_url(url).group('type', 'host', 'id')
  1366. type = self._TYPES[type]
  1367. return self._extract_playlist(host, type, id)