Compare commits
1117 Commits
2014.04.01
...
2014.09.01
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff6ade294c | ||
|
|
11fc065c57 | ||
|
|
94388f50b3 | ||
|
|
a444648202 | ||
|
|
7ca2e11f24 | ||
|
|
563f6dea59 | ||
|
|
e4039057be | ||
|
|
11342b54d6 | ||
|
|
9b330db7f0 | ||
|
|
d740f7e16f | ||
|
|
07e7dc4bdc | ||
|
|
4c59dc4c34 | ||
|
|
7260ea0705 | ||
|
|
35b1e44567 | ||
|
|
c9ea760e31 | ||
|
|
9ebf22b7d9 | ||
|
|
2582bebe06 | ||
|
|
c9cc0bf57b | ||
|
|
61edcfb0a2 | ||
|
|
a8be56ce3d | ||
|
|
329818484c | ||
|
|
8bdfddf641 | ||
|
|
36d65b61d4 | ||
|
|
7d48c06f27 | ||
|
|
d169e36f5c | ||
|
|
2d7af09487 | ||
|
|
48d4681efc | ||
|
|
9ea9b61448 | ||
|
|
04b4aa4a7b | ||
|
|
5a3f0d9aee | ||
|
|
1ed5b5c9c8 | ||
|
|
d10548b691 | ||
|
|
e990510e6b | ||
|
|
55f7bd2dcc | ||
|
|
f931e25959 | ||
|
|
ca9cd290c7 | ||
|
|
49e23e8b6a | ||
|
|
ae7246e7d5 | ||
|
|
43fd392413 | ||
|
|
3e7c12240c | ||
|
|
7eb21356f9 | ||
|
|
f30a38be8b | ||
|
|
2aebbccefc | ||
|
|
b170935a8f | ||
|
|
35241d05d1 | ||
|
|
be2dd0651e | ||
|
|
6a400a6339 | ||
|
|
7b53af7f70 | ||
|
|
ca7b3246b6 | ||
|
|
9c4c233b84 | ||
|
|
8a6c59865d | ||
|
|
1d57b2520c | ||
|
|
17b0b8a166 | ||
|
|
12c82cf9cb | ||
|
|
0bafcf6f46 | ||
|
|
bbc9dc56f6 | ||
|
|
72c65d39ff | ||
|
|
676e3ecf24 | ||
|
|
78272a076e | ||
|
|
723e04d0be | ||
|
|
08a36c3569 | ||
|
|
37709fae89 | ||
|
|
a81e4eb69d | ||
|
|
8e72edfb19 | ||
|
|
863f08a92e | ||
|
|
de2d9f5f1b | ||
|
|
a520c11241 | ||
|
|
b94744d157 | ||
|
|
753727cded | ||
|
|
daebaab692 | ||
|
|
3524cc25ca | ||
|
|
29a7e1f261 | ||
|
|
df53b6358d | ||
|
|
f1a9d64eea | ||
|
|
27f774862d | ||
|
|
b759a0d4d2 | ||
|
|
22a6f15061 | ||
|
|
259454525f | ||
|
|
ce6815aad3 | ||
|
|
4e408e479b | ||
|
|
a9d3890fcb | ||
|
|
2857084000 | ||
|
|
7798fad535 | ||
|
|
baf2907501 | ||
|
|
3c765c68c4 | ||
|
|
29153f49b3 | ||
|
|
071a236c5a | ||
|
|
10437550f4 | ||
|
|
2929b3e71d | ||
|
|
22449fa624 | ||
|
|
d36d3f420c | ||
|
|
60ac04e57c | ||
|
|
a7680bf330 | ||
|
|
6d3d3fc083 | ||
|
|
aff216edf4 | ||
|
|
1cb6dcdbbe | ||
|
|
3f514a353e | ||
|
|
da9ec3b932 | ||
|
|
191b7cbba9 | ||
|
|
e8c59b9642 | ||
|
|
6abb066128 | ||
|
|
8f1ea7cbb6 | ||
|
|
a204c85408 | ||
|
|
15a1f4b8fe | ||
|
|
c7bee2a725 | ||
|
|
dbc1366b50 | ||
|
|
704df56da7 | ||
|
|
33ac271ba7 | ||
|
|
0963f92f23 | ||
|
|
9a66c1079c | ||
|
|
f971dcbba0 | ||
|
|
0990305d2a | ||
|
|
bcc069a937 | ||
|
|
34708e1bb6 | ||
|
|
829476b80a | ||
|
|
1dd70fe330 | ||
|
|
067e922295 | ||
|
|
c28df2478f | ||
|
|
241f7a8ade | ||
|
|
b252735910 | ||
|
|
7adcbe7594 | ||
|
|
8d31fa3cce | ||
|
|
1f06864e9a | ||
|
|
348ae0a79e | ||
|
|
528d455632 | ||
|
|
ba5d51b340 | ||
|
|
7833d941bb | ||
|
|
a2360a4c80 | ||
|
|
a7cacbca2b | ||
|
|
c6b4132a0a | ||
|
|
ad260c90ab | ||
|
|
b8313f07bc | ||
|
|
92a17d28ac | ||
|
|
5f90042bd6 | ||
|
|
9480d1a566 | ||
|
|
36b0079f23 | ||
|
|
28028629b9 | ||
|
|
11f75cac3d | ||
|
|
e673db0194 | ||
|
|
ebab4520ff | ||
|
|
a71d1414eb | ||
|
|
423817c468 | ||
|
|
51ed9fce09 | ||
|
|
d43aeb1d00 | ||
|
|
4d805e063c | ||
|
|
24e5e24166 | ||
|
|
4d54ef20a2 | ||
|
|
54036b3991 | ||
|
|
e5402ac120 | ||
|
|
f56f8399c7 | ||
|
|
cf0c5fa3a1 | ||
|
|
8c2ccefae6 | ||
|
|
1f8b6af773 | ||
|
|
8f9b683eeb | ||
|
|
b5f4775b38 | ||
|
|
01d906ffe9 | ||
|
|
614582bcc4 | ||
|
|
e1ab5000b2 | ||
|
|
a5ed3e571e | ||
|
|
10eaeb20c5 | ||
|
|
fa8deaf38b | ||
|
|
6857590059 | ||
|
|
a3db22ebdf | ||
|
|
c8e9a235d9 | ||
|
|
30b871b0ca | ||
|
|
eb9da9b732 | ||
|
|
d769be6c96 | ||
|
|
a54bda3ae2 | ||
|
|
00558d9414 | ||
|
|
49f3c16543 | ||
|
|
2ef6fcb5d8 | ||
|
|
38fc045253 | ||
|
|
af1fd929c6 | ||
|
|
b7b04c9234 | ||
|
|
bc0bb6fd30 | ||
|
|
430826c9d4 | ||
|
|
68909f0c4e | ||
|
|
9d048a17d8 | ||
|
|
492641d10a | ||
|
|
2b9faf5542 | ||
|
|
ed2d6a1960 | ||
|
|
be843678b1 | ||
|
|
c71dfccc98 | ||
|
|
1a9ccac7c1 | ||
|
|
e330d59abb | ||
|
|
394df6d7d0 | ||
|
|
218f754940 | ||
|
|
a053c3493a | ||
|
|
50b294aab8 | ||
|
|
756b046f3e | ||
|
|
388ac0b18a | ||
|
|
ad06434bd3 | ||
|
|
bd9820c937 | ||
|
|
deda8ac376 | ||
|
|
e05f693942 | ||
|
|
b27295d2ab | ||
|
|
ace52c5713 | ||
|
|
e62e150f64 | ||
|
|
c44c0a775d | ||
|
|
5fcf2dbed0 | ||
|
|
91dff03217 | ||
|
|
a200f4cee2 | ||
|
|
ea6e8d5454 | ||
|
|
83d35817f5 | ||
|
|
76beff70a8 | ||
|
|
61882bf7c6 | ||
|
|
cab317a680 | ||
|
|
73159f99cc | ||
|
|
c15235cd07 | ||
|
|
12c3ec3382 | ||
|
|
55db73efdf | ||
|
|
af40ac054a | ||
|
|
a36819731b | ||
|
|
181c8655c7 | ||
|
|
3b95347bb6 | ||
|
|
3b88ee9a7d | ||
|
|
55c49908d2 | ||
|
|
db9b0b67b7 | ||
|
|
35f76e0061 | ||
|
|
3f338cd6de | ||
|
|
1d01f26ab1 | ||
|
|
266c71f971 | ||
|
|
e8ee972c6e | ||
|
|
f83dda12ad | ||
|
|
696d49815e | ||
|
|
fe556f1b0c | ||
|
|
d5638d974f | ||
|
|
938dd254e5 | ||
|
|
6493f5d704 | ||
|
|
cd6b48365e | ||
|
|
4d9bd478f9 | ||
|
|
165250ff5e | ||
|
|
83317f6938 | ||
|
|
c1d293cfa6 | ||
|
|
49807b4ac6 | ||
|
|
c990bb3633 | ||
|
|
af8322d2f9 | ||
|
|
df866e7f2a | ||
|
|
664718ff63 | ||
|
|
3258263371 | ||
|
|
3cfafc4a9b | ||
|
|
6f600ff5d6 | ||
|
|
90e075da3a | ||
|
|
9572013de9 | ||
|
|
3a5beb0ca1 | ||
|
|
a6da7b6b96 | ||
|
|
173a7026d5 | ||
|
|
40a90862f4 | ||
|
|
511c4325dc | ||
|
|
85a699246a | ||
|
|
4dc5286e13 | ||
|
|
c767dc74b8 | ||
|
|
56ca04f662 | ||
|
|
eb3680123a | ||
|
|
f5273890ee | ||
|
|
c7a088a816 | ||
|
|
fb17b60811 | ||
|
|
1e58804260 | ||
|
|
31bf213032 | ||
|
|
1cccc41ddc | ||
|
|
a91cf27767 | ||
|
|
64d02399d8 | ||
|
|
5961017202 | ||
|
|
d9760fd43c | ||
|
|
d42b2d2985 | ||
|
|
cccfab6412 | ||
|
|
4665664c92 | ||
|
|
0adc996bc3 | ||
|
|
b42a2a720b | ||
|
|
37edd7dd4a | ||
|
|
f87b3500c5 | ||
|
|
66420a2db4 | ||
|
|
6b8492a782 | ||
|
|
6de0595eb8 | ||
|
|
e48a2c646d | ||
|
|
0f831a1a92 | ||
|
|
1ce464aba9 | ||
|
|
6994e70651 | ||
|
|
3e510af38d | ||
|
|
5ecd7b0a92 | ||
|
|
a229909fa6 | ||
|
|
548f31d99c | ||
|
|
78b296b0ff | ||
|
|
be79b07907 | ||
|
|
5537dce84d | ||
|
|
493987fefe | ||
|
|
c97797a737 | ||
|
|
8d7d9d3452 | ||
|
|
7a5e7b303c | ||
|
|
61aabb9d70 | ||
|
|
62af3a0eb5 | ||
|
|
60064c53f1 | ||
|
|
98eb1c3fa2 | ||
|
|
201e9eaa0e | ||
|
|
9afa6ede21 | ||
|
|
f4776371ae | ||
|
|
328a20bf9c | ||
|
|
5622f29ae4 | ||
|
|
b4f23afbd1 | ||
|
|
0138968a6a | ||
|
|
c3f0b12b0f | ||
|
|
4f31d0f2b7 | ||
|
|
bff74bdd1a | ||
|
|
10b04ff7f4 | ||
|
|
1f7ccb9014 | ||
|
|
c7b3209668 | ||
|
|
895ba7d1dd | ||
|
|
a2a1b0baa2 | ||
|
|
8646eb790e | ||
|
|
27ace98f51 | ||
|
|
a00d73c8c8 | ||
|
|
f036a6328e | ||
|
|
31bb8d3f51 | ||
|
|
4958ae2058 | ||
|
|
7e8d73c183 | ||
|
|
65bc504db8 | ||
|
|
0fc74a0d91 | ||
|
|
8d2cc6fbb1 | ||
|
|
a954584f63 | ||
|
|
cb3ff6fb01 | ||
|
|
71aa656d13 | ||
|
|
366b1f3cfe | ||
|
|
64ce58db38 | ||
|
|
11b85ce62e | ||
|
|
1220352ff7 | ||
|
|
8f3034d871 | ||
|
|
7fa547ab02 | ||
|
|
3182f3e2dc | ||
|
|
cbf915f3f6 | ||
|
|
b490b8849a | ||
|
|
5d2519e5bf | ||
|
|
c3415d1bac | ||
|
|
36f3542883 | ||
|
|
4cb71e9b6a | ||
|
|
4bc7009e8a | ||
|
|
16f8e9df8a | ||
|
|
b081cebefa | ||
|
|
916c145217 | ||
|
|
4192b51c7c | ||
|
|
052421ff09 | ||
|
|
4e99f48817 | ||
|
|
a11165ecc6 | ||
|
|
fbb2fc5580 | ||
|
|
2fe3d240cc | ||
|
|
42f4dcfe41 | ||
|
|
892e3192fb | ||
|
|
7272eab9d0 | ||
|
|
ebe832dc37 | ||
|
|
825abb8175 | ||
|
|
8944ec0109 | ||
|
|
c084c93402 | ||
|
|
8c778adc39 | ||
|
|
71b6065009 | ||
|
|
7e660ac113 | ||
|
|
d799b47b82 | ||
|
|
b7f8116406 | ||
|
|
6db274e057 | ||
|
|
0c92b57398 | ||
|
|
becafcbf0f | ||
|
|
92a86f4c1a | ||
|
|
dfe029a62c | ||
|
|
b0472057a3 | ||
|
|
c081b35c27 | ||
|
|
9f43890bcd | ||
|
|
94a20aa5f8 | ||
|
|
94e8df3a7e | ||
|
|
37e64addc8 | ||
|
|
d82ba23ba5 | ||
|
|
0fd7fd71b4 | ||
|
|
eae12e3fe3 | ||
|
|
798a2cad4f | ||
|
|
41c0849429 | ||
|
|
a4e5af1184 | ||
|
|
b090af5922 | ||
|
|
388841f819 | ||
|
|
1a2ecbfbc4 | ||
|
|
38e292b112 | ||
|
|
c4f731262d | ||
|
|
07cc63f386 | ||
|
|
e42a692f00 | ||
|
|
6ec7538bb4 | ||
|
|
2871d489a9 | ||
|
|
1771ddd85d | ||
|
|
5198bf68fc | ||
|
|
e00fc35dbe | ||
|
|
8904e979df | ||
|
|
53eb217661 | ||
|
|
9dcb8f3fc7 | ||
|
|
1e8ac8364b | ||
|
|
754d8a035e | ||
|
|
f1f725c6a0 | ||
|
|
06c155420f | ||
|
|
7dabd2ac45 | ||
|
|
df8ba0d2cf | ||
|
|
ff1956e07b | ||
|
|
caf5a8817b | ||
|
|
a850fde1d8 | ||
|
|
0e6ebc13d1 | ||
|
|
6f5342a201 | ||
|
|
264a7044f5 | ||
|
|
1a30deca50 | ||
|
|
d8624e6a80 | ||
|
|
4f95d455ed | ||
|
|
468d19a9c1 | ||
|
|
9aeaf730ad | ||
|
|
db964a33a1 | ||
|
|
da8fb85859 | ||
|
|
54330a1c3c | ||
|
|
9732d77ed2 | ||
|
|
199ece7eb8 | ||
|
|
1997eb0078 | ||
|
|
eef4a7a304 | ||
|
|
246168bd72 | ||
|
|
7fbf54dc62 | ||
|
|
351f373865 | ||
|
|
72e785f36a | ||
|
|
727d2930f2 | ||
|
|
c13bf7c836 | ||
|
|
f3308e138d | ||
|
|
29546b345b | ||
|
|
2c57c7fa5a | ||
|
|
b6ea11b967 | ||
|
|
b8c74d606a | ||
|
|
a5d524ef46 | ||
|
|
cceb5ec237 | ||
|
|
71a6eaff83 | ||
|
|
7fd48d0413 | ||
|
|
1b38b5be86 | ||
|
|
decf2ae400 | ||
|
|
0d989011ff | ||
|
|
01b4b74574 | ||
|
|
70f767dc65 | ||
|
|
e75c24e889 | ||
|
|
0cb2056304 | ||
|
|
8adec2b9e0 | ||
|
|
604f292ab7 | ||
|
|
23d3c422ab | ||
|
|
0c1ffe980d | ||
|
|
5e95cb27d6 | ||
|
|
3b86f936c5 | ||
|
|
e0942e37aa | ||
|
|
c45a6caa95 | ||
|
|
61bbddbaa6 | ||
|
|
5425626790 | ||
|
|
5dc3552d85 | ||
|
|
3fbd27f73e | ||
|
|
0382ecb78d | ||
|
|
72edb6fc8c | ||
|
|
66149e3f2b | ||
|
|
6e74521d98 | ||
|
|
cf01013161 | ||
|
|
1e179c7528 | ||
|
|
530ed178b7 | ||
|
|
74aa18f68f | ||
|
|
d9222264a8 | ||
|
|
ca14211e93 | ||
|
|
b1d65c3369 | ||
|
|
b4c538b02b | ||
|
|
13059bceb2 | ||
|
|
d8894e24a4 | ||
|
|
3b09757bac | ||
|
|
2f97f76877 | ||
|
|
43f0537c06 | ||
|
|
a816da0dc3 | ||
|
|
7bb49d1057 | ||
|
|
1aa42fedee | ||
|
|
66aa382eae | ||
|
|
ee90ddab94 | ||
|
|
172240c0a4 | ||
|
|
ad25aee245 | ||
|
|
bd1f325b42 | ||
|
|
00a82ea805 | ||
|
|
b1b01841af | ||
|
|
816930c485 | ||
|
|
76233cda34 | ||
|
|
9dcea39985 | ||
|
|
10d00a756a | ||
|
|
eb50741129 | ||
|
|
3804b01276 | ||
|
|
b1298d8e06 | ||
|
|
c065fd35ae | ||
|
|
6a46dc8db7 | ||
|
|
36cb99f958 | ||
|
|
81650f95e2 | ||
|
|
34dbcb8505 | ||
|
|
c993c829e2 | ||
|
|
0d90e0f067 | ||
|
|
678f58de4b | ||
|
|
c961a0e63e | ||
|
|
aaefb347c0 | ||
|
|
09018e19a5 | ||
|
|
345e37831c | ||
|
|
00ac799b68 | ||
|
|
133af9385b | ||
|
|
40c696e5c6 | ||
|
|
d6d5028922 | ||
|
|
38ad119f97 | ||
|
|
4e415288d7 | ||
|
|
fada438acf | ||
|
|
1df0ae2170 | ||
|
|
d96b9d40f0 | ||
|
|
fa19dfccf9 | ||
|
|
cdc22cb886 | ||
|
|
04c77a54b0 | ||
|
|
64a8c39a1f | ||
|
|
3d55f2806e | ||
|
|
1eb867f33f | ||
|
|
e93f4f7578 | ||
|
|
45ead916d1 | ||
|
|
3a0879c8c8 | ||
|
|
ebf361ce18 | ||
|
|
953b358668 | ||
|
|
3dfd25b3aa | ||
|
|
6f66eedc5d | ||
|
|
4094b6e36d | ||
|
|
c09cbf0ed9 | ||
|
|
391d53e1dd | ||
|
|
f64ebfe3e5 | ||
|
|
fc040bfd05 | ||
|
|
c8bf86d50d | ||
|
|
61989fb5e9 | ||
|
|
6f9d4d542f | ||
|
|
b3a8878080 | ||
|
|
f4d66a99cf | ||
|
|
537ba6f381 | ||
|
|
411f691b21 | ||
|
|
d6aa1967ad | ||
|
|
6e1e0e4b5b | ||
|
|
3941669d69 | ||
|
|
1aac03797e | ||
|
|
459af43494 | ||
|
|
f4f7e3cf41 | ||
|
|
1fd015516e | ||
|
|
76bafa8ffe | ||
|
|
8d5797b00f | ||
|
|
7571c02c8a | ||
|
|
49cbe7c8e3 | ||
|
|
ba4133c9eb | ||
|
|
b67f1840a1 | ||
|
|
165c46690f | ||
|
|
16bc9ab601 | ||
|
|
15ce1338b4 | ||
|
|
0ff30c5333 | ||
|
|
6feb2d5e80 | ||
|
|
1e07fea200 | ||
|
|
7aeb67b39b | ||
|
|
93881db22a | ||
|
|
64ed7a38f9 | ||
|
|
2fd466fcfc | ||
|
|
dc2fc73691 | ||
|
|
c4808c6009 | ||
|
|
c67f584eb3 | ||
|
|
29f6ed78e8 | ||
|
|
7807ee664d | ||
|
|
d518d06efd | ||
|
|
25a0cc44b9 | ||
|
|
825cdcec3c | ||
|
|
41b610acab | ||
|
|
0364fa8b65 | ||
|
|
849086a1ae | ||
|
|
36fbc6887f | ||
|
|
a8a98e43f2 | ||
|
|
57bdc730e2 | ||
|
|
31a196d7f5 | ||
|
|
9b27e6c3b4 | ||
|
|
62f1f9507f | ||
|
|
ee8dda41ae | ||
|
|
01ba178097 | ||
|
|
78ff59d052 | ||
|
|
f3f1cd6b3b | ||
|
|
803540e811 | ||
|
|
458ade6361 | ||
|
|
a69969ee05 | ||
|
|
f2b8db57eb | ||
|
|
331ae266ff | ||
|
|
4242001863 | ||
|
|
78338f71ca | ||
|
|
f5172a3084 | ||
|
|
c7df67edbd | ||
|
|
d410fee91d | ||
|
|
ba7aa464de | ||
|
|
8333034dce | ||
|
|
637b6af80f | ||
|
|
1044f8afd2 | ||
|
|
2f775107f9 | ||
|
|
85342674b2 | ||
|
|
fd69098a45 | ||
|
|
8867f908fc | ||
|
|
b7c33124c8 | ||
|
|
89a8c423c7 | ||
|
|
cea2582df2 | ||
|
|
e423e0baaa | ||
|
|
60b2dd1285 | ||
|
|
36ddd8b3f7 | ||
|
|
7575d52a73 | ||
|
|
9a2dc4f7ac | ||
|
|
c5cd249e41 | ||
|
|
8940c1c058 | ||
|
|
27ec04b232 | ||
|
|
d2824416aa | ||
|
|
18061bbab0 | ||
|
|
4ecbbcbcea | ||
|
|
55c97a03e1 | ||
|
|
98aeac6ea9 | ||
|
|
8bfb6723cb | ||
|
|
a20575e8ae | ||
|
|
7724572519 | ||
|
|
d763637f6a | ||
|
|
c26e9ac4b2 | ||
|
|
896bf55352 | ||
|
|
a23ba9b53c | ||
|
|
38a9339baf | ||
|
|
def8b4039f | ||
|
|
a14e1538fe | ||
|
|
5f28a1acad | ||
|
|
25e9953c6f | ||
|
|
f9df094ca5 | ||
|
|
b60a469023 | ||
|
|
7012631257 | ||
|
|
e6c9f80c48 | ||
|
|
895ce482b1 | ||
|
|
e5da4021eb | ||
|
|
2371053565 | ||
|
|
33bf9033e0 | ||
|
|
35eacd0dae | ||
|
|
96bef88f5f | ||
|
|
5524b242a7 | ||
|
|
a013eba65f | ||
|
|
36755d40b4 | ||
|
|
7d568f5ab8 | ||
|
|
a7207cd580 | ||
|
|
e8ef659cd9 | ||
|
|
b0adbe98fb | ||
|
|
0c361c41b8 | ||
|
|
e66ab17a36 | ||
|
|
cb437dc2ad | ||
|
|
0d933b2ad5 | ||
|
|
c5469e046a | ||
|
|
4d2f143ce5 | ||
|
|
8f93030c85 | ||
|
|
fdb9aebead | ||
|
|
3141feb73b | ||
|
|
9706f3f802 | ||
|
|
d5e944359e | ||
|
|
826ec77fb2 | ||
|
|
2656f4eb6a | ||
|
|
2b88feedf7 | ||
|
|
23566e0d78 | ||
|
|
828553b614 | ||
|
|
3048e82a94 | ||
|
|
09ffa08ba1 | ||
|
|
e0b4cc489f | ||
|
|
15e423407f | ||
|
|
702e522044 | ||
|
|
77abae55df | ||
|
|
617c0b2239 | ||
|
|
814d4257df | ||
|
|
23ae281b31 | ||
|
|
94128d6b0d | ||
|
|
059009c592 | ||
|
|
9cc977f104 | ||
|
|
1c0ade7afa | ||
|
|
f2741c8d3a | ||
|
|
6ab8f3584a | ||
|
|
8ae5ce1726 | ||
|
|
eb92077720 | ||
|
|
90e0fd4bad | ||
|
|
05741e05d9 | ||
|
|
9aa6637644 | ||
|
|
d30d28156d | ||
|
|
be6d722904 | ||
|
|
d551980823 | ||
|
|
f0a6c3d2bc | ||
|
|
4e0fb1280a | ||
|
|
24f5251cce | ||
|
|
ac1390eee8 | ||
|
|
4a5b4d34dc | ||
|
|
63adb0cc61 | ||
|
|
3c80377b69 | ||
|
|
24577db241 | ||
|
|
566bd96da8 | ||
|
|
ebdb64d605 | ||
|
|
a6ffb92f0b | ||
|
|
3217377b3c | ||
|
|
24da5893fc | ||
|
|
087ca2cb07 | ||
|
|
b4e7447458 | ||
|
|
a45e6aadd7 | ||
|
|
70e322695d | ||
|
|
6a15923b77 | ||
|
|
7ffad0af5a | ||
|
|
0e3ae92441 | ||
|
|
b3ae826f7a | ||
|
|
dede691aca | ||
|
|
fb6a5b965b | ||
|
|
6340716b3a | ||
|
|
b675b32e6b | ||
|
|
6a3fa81ffb | ||
|
|
df53a98f2b | ||
|
|
db23d8d2a2 | ||
|
|
0d69795014 | ||
|
|
3374f3fdc2 | ||
|
|
4bf0727b1f | ||
|
|
263bd4ec50 | ||
|
|
b7e8b6e37a | ||
|
|
ceb7a17f34 | ||
|
|
1a2f2e1e66 | ||
|
|
6803016858 | ||
|
|
9b7c4fd981 | ||
|
|
dc31942f42 | ||
|
|
1f6b8f3115 | ||
|
|
9c7b79acd9 | ||
|
|
9168308579 | ||
|
|
37e3cbe22e | ||
|
|
7e8fdb1aae | ||
|
|
386ba39cac | ||
|
|
236d0cd07c | ||
|
|
ed86f38a11 | ||
|
|
6db80ad2db | ||
|
|
14470ac87b | ||
|
|
0cdf576d86 | ||
|
|
4ffeca4ea2 | ||
|
|
211fd6c674 | ||
|
|
6ebb46c106 | ||
|
|
0f97c9a06f | ||
|
|
77fb72646f | ||
|
|
aae74e3832 | ||
|
|
894e730911 | ||
|
|
63961d87a6 | ||
|
|
87fe568c28 | ||
|
|
46531b374d | ||
|
|
9e8753911c | ||
|
|
5c6b1e578c | ||
|
|
8f0c8fb452 | ||
|
|
b702ecebf0 | ||
|
|
950dc95e97 | ||
|
|
d9dd3584e1 | ||
|
|
15a9f36849 | ||
|
|
d0087d4ff2 | ||
|
|
cc5ada6f4c | ||
|
|
dfb2e1a325 | ||
|
|
65bab327b4 | ||
|
|
9eeb7abc6b | ||
|
|
c70df21099 | ||
|
|
418424e5f5 | ||
|
|
8477466125 | ||
|
|
865dbd4a26 | ||
|
|
b1e6f55912 | ||
|
|
4d78f3b770 | ||
|
|
7f739999e9 | ||
|
|
0f8a01d4f3 | ||
|
|
e2bf499b14 | ||
|
|
7cf4547ab6 | ||
|
|
8ae980807a | ||
|
|
eec4d8ef96 | ||
|
|
610134730a | ||
|
|
212a5e28ba | ||
|
|
1c783bca88 | ||
|
|
ac73651f66 | ||
|
|
ee1a7032d5 | ||
|
|
e5ceb3bfda | ||
|
|
c2ef29234c | ||
|
|
1a1826c1af | ||
|
|
c7c6d43fe1 | ||
|
|
2902d44f99 | ||
|
|
d6e4ba287b | ||
|
|
7ed806d241 | ||
|
|
dd06c95e43 | ||
|
|
e5c3a4b549 | ||
|
|
f50ee8d1c3 | ||
|
|
0e67ab0d8e | ||
|
|
1d0668ed5a | ||
|
|
d415299a80 | ||
|
|
77541837e5 | ||
|
|
48fbb1003d | ||
|
|
e3a6576f35 | ||
|
|
89bb8e97ee | ||
|
|
3442b30ab2 | ||
|
|
375696b1b1 | ||
|
|
4ea5c7b70d | ||
|
|
305d068362 | ||
|
|
a231ce87b5 | ||
|
|
a84d20fc14 | ||
|
|
9e30092361 | ||
|
|
10d5c7aa5f | ||
|
|
412f356e04 | ||
|
|
8dfa187b8a | ||
|
|
c1ed1f7055 | ||
|
|
1514f74967 | ||
|
|
2e8323e3f7 | ||
|
|
69f8364042 | ||
|
|
79981f039b | ||
|
|
34d863f3fc | ||
|
|
91994c2c81 | ||
|
|
3ee4b60d56 | ||
|
|
76e92371ac | ||
|
|
08af0205f9 | ||
|
|
a725fb1f43 | ||
|
|
05ee2b6dad | ||
|
|
b74feacac5 | ||
|
|
426b52fc5d | ||
|
|
5c30b26846 | ||
|
|
f07b74fc18 | ||
|
|
a5a45015ba | ||
|
|
beee53de06 | ||
|
|
8712f2bea7 | ||
|
|
ea102818c9 | ||
|
|
0a871f6880 | ||
|
|
481efc84a8 | ||
|
|
01ed5c9be3 | ||
|
|
ad3bc6acd5 | ||
|
|
5afa7f8bee | ||
|
|
ec8deefc27 | ||
|
|
a2d5a4ee64 | ||
|
|
dffcc2ea0c | ||
|
|
1800eeefed | ||
|
|
d7e7dedbde | ||
|
|
d19bb9c0aa | ||
|
|
3ef79a974a | ||
|
|
bc6800fbed | ||
|
|
65314dccf8 | ||
|
|
feb7221209 | ||
|
|
56a94d8cbb | ||
|
|
24e6ec8ac8 | ||
|
|
87724af7a8 | ||
|
|
b65c3e77e8 | ||
|
|
5301304bf2 | ||
|
|
948bcc60df | ||
|
|
25dfe0eb10 | ||
|
|
8e71456a81 | ||
|
|
ccdd34ed78 | ||
|
|
26d886354f | ||
|
|
a172b258ac | ||
|
|
7b93c2c204 | ||
|
|
57c7411f46 | ||
|
|
d0a122348e | ||
|
|
e4cbb5f382 | ||
|
|
c1bce22f23 | ||
|
|
e3abbbe301 | ||
|
|
55b36e3710 | ||
|
|
877bea9ce1 | ||
|
|
33c7ff861e | ||
|
|
749fe60c1e | ||
|
|
63b31b059c | ||
|
|
1476b497eb | ||
|
|
e399853d0c | ||
|
|
fdb205b19e | ||
|
|
fbe8053120 | ||
|
|
ea783d01e1 | ||
|
|
b7d73595dc | ||
|
|
e97e53eeed | ||
|
|
342f630dbf | ||
|
|
69c8fb9e5d | ||
|
|
5f0f8013ac | ||
|
|
b5368acee8 | ||
|
|
f71959fcf5 | ||
|
|
5c9f3b8b16 | ||
|
|
bebd6f9308 | ||
|
|
84a2806c16 | ||
|
|
d0111a7409 | ||
|
|
aab8874c55 | ||
|
|
fcf5b01746 | ||
|
|
4de9e9a6db | ||
|
|
0067d6c4be | ||
|
|
2099125333 | ||
|
|
b48f147d5a | ||
|
|
4f3e943080 | ||
|
|
7558830fa3 | ||
|
|
867274e997 | ||
|
|
6515778305 | ||
|
|
3b1dfc0f2f | ||
|
|
d664de44b7 | ||
|
|
bbe99d26ec | ||
|
|
50fc59968e | ||
|
|
b8b01bb92a | ||
|
|
eb45133451 | ||
|
|
10c0e2d818 | ||
|
|
669f0e7cda | ||
|
|
32fd27ec98 | ||
|
|
0c13f378de | ||
|
|
0049594efb | ||
|
|
113c7d3eb0 | ||
|
|
549371fc99 | ||
|
|
957f27e5bb | ||
|
|
1f8c19767b | ||
|
|
a383a98af6 | ||
|
|
acd69589a5 | ||
|
|
b30b8698ea | ||
|
|
f1f25be6db | ||
|
|
deab8c1960 | ||
|
|
c57f775710 | ||
|
|
e75cafe9fb | ||
|
|
33ab8453c4 | ||
|
|
ebd3c7b370 | ||
|
|
29645a1d44 | ||
|
|
22d99a801a | ||
|
|
57b8d84cd9 | ||
|
|
65e4ad5bfe | ||
|
|
98b7d476d9 | ||
|
|
201e3c99b9 | ||
|
|
8a7a4a9796 | ||
|
|
df297c8794 | ||
|
|
3f53a75f02 | ||
|
|
7c360e3a04 | ||
|
|
d2176c8011 | ||
|
|
aa92f06308 | ||
|
|
e00c9cf599 | ||
|
|
ba60a3ebe0 | ||
|
|
efb7e11988 | ||
|
|
a55c8b7aac | ||
|
|
a980bc4324 | ||
|
|
4b10aadffc | ||
|
|
5bec574859 | ||
|
|
d11271dd29 | ||
|
|
1d9d26d09b | ||
|
|
c0292e8ab7 | ||
|
|
f44e5d8b43 | ||
|
|
6ea74538e3 | ||
|
|
24b8924b46 | ||
|
|
86a3c67112 | ||
|
|
8be874370d | ||
|
|
aec74dd95a | ||
|
|
6890574256 | ||
|
|
d03745c684 | ||
|
|
28746fbd59 | ||
|
|
0321213c11 | ||
|
|
3f0aae4244 | ||
|
|
48099643cc | ||
|
|
621f33c9d0 | ||
|
|
f07a9f6f43 | ||
|
|
e51880fd32 | ||
|
|
88ce273da4 | ||
|
|
b9ba5dfa28 | ||
|
|
4086f11929 | ||
|
|
478c2c6193 | ||
|
|
d2d6481afb | ||
|
|
43acb120f3 | ||
|
|
e8f2025edf | ||
|
|
a4eb9578af | ||
|
|
fa35cdad02 | ||
|
|
d1b9c912a4 | ||
|
|
edec83a025 | ||
|
|
c0a7c60815 | ||
|
|
117a7d1944 | ||
|
|
a40e0dd434 | ||
|
|
188b086dd9 | ||
|
|
1f27d2c0e1 | ||
|
|
7560096db5 | ||
|
|
282cb9c7ba | ||
|
|
3a9d6790ad | ||
|
|
0610a3e0b2 | ||
|
|
7f9c31df88 | ||
|
|
3fa6b6e293 | ||
|
|
3c50b99ab4 | ||
|
|
52fadd5fb2 | ||
|
|
5367fe7f4d | ||
|
|
427588f6e7 | ||
|
|
51745be312 | ||
|
|
d7f1e7c88f | ||
|
|
4145a257be | ||
|
|
525dc9809e | ||
|
|
1bf3210816 | ||
|
|
e6c6d10d99 | ||
|
|
f270256e06 | ||
|
|
f401c6f69f | ||
|
|
b075d25bed | ||
|
|
3d1bb6b4dd | ||
|
|
1db2666916 | ||
|
|
8f5c0218d8 | ||
|
|
d7666dff82 | ||
|
|
2d4c98dbd1 | ||
|
|
fd50bf623c | ||
|
|
d360a14678 | ||
|
|
d0f2ab6969 | ||
|
|
de906ef543 | ||
|
|
2fb3deeca1 | ||
|
|
66398056f1 | ||
|
|
77477fa4c9 | ||
|
|
a169e18ce1 | ||
|
|
381640e3ac | ||
|
|
37e3410137 | ||
|
|
97b5196960 | ||
|
|
6a4f3528c8 | ||
|
|
b9c76aa1a9 | ||
|
|
0d3070d364 | ||
|
|
7753cadbfa | ||
|
|
3950450342 | ||
|
|
c82b1fdad6 | ||
|
|
b0fb63abe8 | ||
|
|
3ab34c603e | ||
|
|
7d6413341a | ||
|
|
140012d0f6 | ||
|
|
4be9f8c814 | ||
|
|
5c802bac37 | ||
|
|
6c30ff756a | ||
|
|
62749e4708 | ||
|
|
6b7dee4b38 | ||
|
|
ef2041eb4e | ||
|
|
29e3e682af | ||
|
|
f983c44199 | ||
|
|
e4db19511a | ||
|
|
c47d21da80 | ||
|
|
269aecd0c0 | ||
|
|
aafddb2b0a | ||
|
|
6262ac8ac5 | ||
|
|
89938c719e | ||
|
|
ec0fafbb19 | ||
|
|
a5863bdf33 | ||
|
|
b58ddb32ba | ||
|
|
b9e12a8140 | ||
|
|
104aa7388a | ||
|
|
c3855d28b0 | ||
|
|
734f90bb41 | ||
|
|
91a6addeeb | ||
|
|
9afb76c5ad | ||
|
|
dfb2cb5cfd | ||
|
|
650d688d10 | ||
|
|
0ba77818f3 | ||
|
|
09baa7da7e | ||
|
|
85e787f51d | ||
|
|
2a9e1e453a | ||
|
|
ee1e199685 | ||
|
|
17c5a00774 | ||
|
|
15c0e8e7b2 | ||
|
|
cca37fba48 | ||
|
|
9d0993ec4a | ||
|
|
342f33bf9e | ||
|
|
7cd3bc5f99 | ||
|
|
931055e6cb | ||
|
|
d0e4cf82f1 | ||
|
|
6f88df2c57 | ||
|
|
4479bf2762 | ||
|
|
1ff7c0f7d8 | ||
|
|
610e47c87e | ||
|
|
50f566076f | ||
|
|
92810ff497 | ||
|
|
60ccc59a1c | ||
|
|
91745595d3 | ||
|
|
d6e40507d0 | ||
|
|
deed48b472 | ||
|
|
e4d41bfca5 | ||
|
|
a355b70f27 | ||
|
|
f8514f6186 | ||
|
|
e09b8fcd9d | ||
|
|
7d1b527ff9 | ||
|
|
f943c7b622 | ||
|
|
676eb3f2dd | ||
|
|
98b7cf1ace | ||
|
|
c465afd736 | ||
|
|
b84d6e7fc4 | ||
|
|
2efd5d78c1 | ||
|
|
c8edf47b3a | ||
|
|
3b4c26a428 | ||
|
|
1525148114 | ||
|
|
9e0c5791c1 | ||
|
|
29a1ab2afc | ||
|
|
fa387d2d99 | ||
|
|
6d0d573eca | ||
|
|
bb799e811b | ||
|
|
04ee53eca1 | ||
|
|
659eb98a53 | ||
|
|
ca6aada48e | ||
|
|
43df5a7e71 | ||
|
|
88f1c6de7b | ||
|
|
65a40ab82b | ||
|
|
4b9cced103 | ||
|
|
5c38625259 | ||
|
|
6344fa04bb | ||
|
|
e3ced9ed61 | ||
|
|
5075d598bc | ||
|
|
68eb8e90e6 | ||
|
|
d3a96346c4 | ||
|
|
0e518e2fea | ||
|
|
1e0a235f39 | ||
|
|
9ad400f75e | ||
|
|
3537b93d8a | ||
|
|
56eca2e956 | ||
|
|
2ad4d1ba07 | ||
|
|
4853de808b | ||
|
|
6ff5f12218 | ||
|
|
52a180684f | ||
|
|
b21e25702f | ||
|
|
983af2600f | ||
|
|
f34e6a2cd6 | ||
|
|
a9f304031b | ||
|
|
9271bc8355 | ||
|
|
d1b3e3dd75 | ||
|
|
968ed2a777 | ||
|
|
24de5d2556 | ||
|
|
d26e981df4 | ||
|
|
e45d40b171 | ||
|
|
4a419b8851 | ||
|
|
5fbd672c38 | ||
|
|
bec1fad223 | ||
|
|
177fed41bc | ||
|
|
b900e7cba4 | ||
|
|
14cb4979f0 | ||
|
|
69e61e30fe | ||
|
|
cce929eaac | ||
|
|
b6cfde99b7 | ||
|
|
1be99f052d | ||
|
|
2410c43d83 | ||
|
|
aea6e7fc3c | ||
|
|
91a76c40c0 | ||
|
|
d2b194607c | ||
|
|
f6177462db | ||
|
|
9ddaf4ef8c | ||
|
|
97b5573848 | ||
|
|
18c95c1ab0 | ||
|
|
0479c625a4 | ||
|
|
f659951e22 | ||
|
|
5853a7316e | ||
|
|
a612753db9 | ||
|
|
784763c565 | ||
|
|
39c68260c0 | ||
|
|
149254d0d5 | ||
|
|
0c14e2fbe3 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -26,5 +26,6 @@ updates_key.pem
|
|||||||
*.m4a
|
*.m4a
|
||||||
*.m4v
|
*.m4v
|
||||||
*.part
|
*.part
|
||||||
|
*.swp
|
||||||
test/testdata
|
test/testdata
|
||||||
.tox
|
.tox
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ python:
|
|||||||
- "2.6"
|
- "2.6"
|
||||||
- "2.7"
|
- "2.7"
|
||||||
- "3.3"
|
- "3.3"
|
||||||
|
- "3.4"
|
||||||
script: nosetests test --verbose
|
script: nosetests test --verbose
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
|||||||
14
CHANGELOG
14
CHANGELOG
@@ -1,14 +0,0 @@
|
|||||||
2013.01.02 Codename: GIULIA
|
|
||||||
|
|
||||||
* Add support for ComedyCentral clips <nto>
|
|
||||||
* Corrected Vimeo description fetching <Nick Daniels>
|
|
||||||
* Added the --no-post-overwrites argument <Barbu Paul - Gheorghe>
|
|
||||||
* --verbose offers more environment info
|
|
||||||
* New info_dict field: uploader_id
|
|
||||||
* New updates system, with signature checking
|
|
||||||
* New IEs: NBA, JustinTV, FunnyOrDie, TweetReel, Steam, Ustream
|
|
||||||
* Fixed IEs: BlipTv
|
|
||||||
* Fixed for Python 3 IEs: Xvideo, Youku, XNXX, Dailymotion, Vimeo, InfoQ
|
|
||||||
* Simplified IEs and test code
|
|
||||||
* Various (Python 3 and other) fixes
|
|
||||||
* Revamped and expanded tests
|
|
||||||
@@ -3,5 +3,4 @@ include test/*.py
|
|||||||
include test/*.json
|
include test/*.json
|
||||||
include youtube-dl.bash-completion
|
include youtube-dl.bash-completion
|
||||||
include youtube-dl.1
|
include youtube-dl.1
|
||||||
recursive-include docs *
|
recursive-include docs Makefile conf.py *.rst
|
||||||
prune docs/_build
|
|
||||||
|
|||||||
16
Makefile
16
Makefile
@@ -1,15 +1,15 @@
|
|||||||
all: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-completion
|
all: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-completion
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf youtube-dl.1 youtube-dl.bash-completion README.txt MANIFEST build/ dist/ .coverage cover/ youtube-dl.tar.gz
|
rm -rf youtube-dl.1.temp.md youtube-dl.1 youtube-dl.bash-completion README.txt MANIFEST build/ dist/ .coverage cover/ youtube-dl.tar.gz
|
||||||
|
|
||||||
cleanall: clean
|
cleanall: clean
|
||||||
rm -f youtube-dl youtube-dl.exe
|
rm -f youtube-dl youtube-dl.exe
|
||||||
|
|
||||||
PREFIX=/usr/local
|
PREFIX ?= /usr/local
|
||||||
BINDIR=$(PREFIX)/bin
|
BINDIR ?= $(PREFIX)/bin
|
||||||
MANDIR=$(PREFIX)/man
|
MANDIR ?= $(PREFIX)/man
|
||||||
PYTHON=/usr/bin/env python
|
PYTHON ?= /usr/bin/env python
|
||||||
|
|
||||||
# set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
|
# set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
|
||||||
ifeq ($(PREFIX),/usr)
|
ifeq ($(PREFIX),/usr)
|
||||||
@@ -55,7 +55,9 @@ README.txt: README.md
|
|||||||
pandoc -f markdown -t plain README.md -o README.txt
|
pandoc -f markdown -t plain README.md -o README.txt
|
||||||
|
|
||||||
youtube-dl.1: README.md
|
youtube-dl.1: README.md
|
||||||
pandoc -s -f markdown -t man README.md -o youtube-dl.1
|
python devscripts/prepare_manpage.py >youtube-dl.1.temp.md
|
||||||
|
pandoc -s -f markdown -t man youtube-dl.1.temp.md -o youtube-dl.1
|
||||||
|
rm -f youtube-dl.1.temp.md
|
||||||
|
|
||||||
youtube-dl.bash-completion: youtube_dl/*.py youtube_dl/*/*.py devscripts/bash-completion.in
|
youtube-dl.bash-completion: youtube_dl/*.py youtube_dl/*/*.py devscripts/bash-completion.in
|
||||||
python devscripts/bash-completion.py
|
python devscripts/bash-completion.py
|
||||||
@@ -75,6 +77,6 @@ youtube-dl.tar.gz: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-
|
|||||||
--exclude 'docs/_build' \
|
--exclude 'docs/_build' \
|
||||||
-- \
|
-- \
|
||||||
bin devscripts test youtube_dl docs \
|
bin devscripts test youtube_dl docs \
|
||||||
CHANGELOG LICENSE README.md README.txt \
|
LICENSE README.md README.txt \
|
||||||
Makefile MANIFEST.in youtube-dl.1 youtube-dl.bash-completion setup.py \
|
Makefile MANIFEST.in youtube-dl.1 youtube-dl.bash-completion setup.py \
|
||||||
youtube-dl
|
youtube-dl
|
||||||
|
|||||||
195
README.md
195
README.md
@@ -1,11 +1,32 @@
|
|||||||
% YOUTUBE-DL(1)
|
|
||||||
|
|
||||||
# NAME
|
|
||||||
youtube-dl - download videos from youtube.com or other video platforms
|
youtube-dl - download videos from youtube.com or other video platforms
|
||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
**youtube-dl** [OPTIONS] URL [URL...]
|
**youtube-dl** [OPTIONS] URL [URL...]
|
||||||
|
|
||||||
|
# INSTALLATION
|
||||||
|
|
||||||
|
To install it right away for all UNIX users (Linux, OS X, etc.), type:
|
||||||
|
|
||||||
|
sudo curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
|
||||||
|
sudo chmod a+x /usr/local/bin/youtube-dl
|
||||||
|
|
||||||
|
If you do not have curl, you can alternatively use a recent wget:
|
||||||
|
|
||||||
|
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
|
||||||
|
sudo chmod a+x /usr/local/bin/youtube-dl
|
||||||
|
|
||||||
|
Windows users can [download a .exe file](https://yt-dl.org/latest/youtube-dl.exe) and place it in their home directory or any other location on their [PATH](http://en.wikipedia.org/wiki/PATH_%28variable%29).
|
||||||
|
|
||||||
|
OS X users can install **youtube-dl** with [Homebrew](http://brew.sh/).
|
||||||
|
|
||||||
|
brew install youtube-dl
|
||||||
|
|
||||||
|
You can also use pip:
|
||||||
|
|
||||||
|
sudo pip install youtube-dl
|
||||||
|
|
||||||
|
Alternatively, refer to the developer instructions below for how to check out and work with the git repository. For further options, including PGP signatures, see https://rg3.github.io/youtube-dl/download.html .
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
**youtube-dl** is a small command-line program to download videos from
|
**youtube-dl** is a small command-line program to download videos from
|
||||||
YouTube.com and a few more sites. It requires the Python interpreter, version
|
YouTube.com and a few more sites. It requires the Python interpreter, version
|
||||||
@@ -25,12 +46,6 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
playlist or the command line) if an error
|
playlist or the command line) if an error
|
||||||
occurs
|
occurs
|
||||||
--dump-user-agent display the current browser identification
|
--dump-user-agent display the current browser identification
|
||||||
--user-agent UA specify a custom user agent
|
|
||||||
--referer REF specify a custom referer, use if the video
|
|
||||||
access is restricted to one domain
|
|
||||||
--add-header FIELD:VALUE specify a custom HTTP header and its value,
|
|
||||||
separated by a colon ':'. You can use this
|
|
||||||
option multiple times
|
|
||||||
--list-extractors List all supported extractors and the URLs
|
--list-extractors List all supported extractors and the URLs
|
||||||
they would handle
|
they would handle
|
||||||
--extractor-descriptions Output descriptions of all supported
|
--extractor-descriptions Output descriptions of all supported
|
||||||
@@ -38,34 +53,22 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
--proxy URL Use the specified HTTP/HTTPS proxy. Pass in
|
--proxy URL Use the specified HTTP/HTTPS proxy. Pass in
|
||||||
an empty string (--proxy "") for direct
|
an empty string (--proxy "") for direct
|
||||||
connection
|
connection
|
||||||
--no-check-certificate Suppress HTTPS certificate validation.
|
|
||||||
--prefer-insecure Use an unencrypted connection to retrieve
|
|
||||||
information about the video. (Currently
|
|
||||||
supported only for YouTube)
|
|
||||||
--cache-dir DIR Location in the filesystem where youtube-dl
|
|
||||||
can store some downloaded information
|
|
||||||
permanently. By default $XDG_CACHE_HOME
|
|
||||||
/youtube-dl or ~/.cache/youtube-dl . At the
|
|
||||||
moment, only YouTube player files (for
|
|
||||||
videos with obfuscated signatures) are
|
|
||||||
cached, but that may change.
|
|
||||||
--no-cache-dir Disable filesystem caching
|
|
||||||
--socket-timeout None Time to wait before giving up, in seconds
|
--socket-timeout None Time to wait before giving up, in seconds
|
||||||
--bidi-workaround Work around terminals that lack
|
|
||||||
bidirectional text support. Requires bidiv
|
|
||||||
or fribidi executable in PATH
|
|
||||||
--default-search PREFIX Use this prefix for unqualified URLs. For
|
--default-search PREFIX Use this prefix for unqualified URLs. For
|
||||||
example "gvsearch2:" downloads two videos
|
example "gvsearch2:" downloads two videos
|
||||||
from google videos for youtube-dl "large
|
from google videos for youtube-dl "large
|
||||||
apple". By default (with value "auto")
|
apple". Use the value "auto" to let
|
||||||
youtube-dl guesses.
|
youtube-dl guess ("auto_warning" to emit a
|
||||||
|
warning when guessing). "error" just throws
|
||||||
|
an error. The default value "fixup_error"
|
||||||
|
repairs broken URLs, but emits an error if
|
||||||
|
this is not possible instead of searching.
|
||||||
--ignore-config Do not read configuration files. When given
|
--ignore-config Do not read configuration files. When given
|
||||||
in the global configuration file /etc
|
in the global configuration file /etc
|
||||||
/youtube-dl.conf: do not read the user
|
/youtube-dl.conf: do not read the user
|
||||||
configuration in ~/.config/youtube-dl.conf
|
configuration in ~/.config/youtube-dl.conf
|
||||||
(%APPDATA%/youtube-dl/config.txt on
|
(%APPDATA%/youtube-dl/config.txt on
|
||||||
Windows)
|
Windows)
|
||||||
--encoding ENCODING Force the specified encoding (experimental)
|
|
||||||
|
|
||||||
## Video Selection:
|
## Video Selection:
|
||||||
--playlist-start NUMBER playlist video to start at (default is 1)
|
--playlist-start NUMBER playlist video to start at (default is 1)
|
||||||
@@ -111,9 +114,9 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
of SIZE.
|
of SIZE.
|
||||||
|
|
||||||
## Filesystem Options:
|
## Filesystem Options:
|
||||||
-t, --title use title in file name (default)
|
-a, --batch-file FILE file containing URLs to download ('-' for
|
||||||
|
stdin)
|
||||||
--id use only video ID in file name
|
--id use only video ID in file name
|
||||||
-l, --literal [deprecated] alias of --title
|
|
||||||
-A, --auto-number number downloaded files starting from 00000
|
-A, --auto-number number downloaded files starting from 00000
|
||||||
-o, --output TEMPLATE output filename template. Use %(title)s to
|
-o, --output TEMPLATE output filename template. Use %(title)s to
|
||||||
get the title, %(uploader)s for the
|
get the title, %(uploader)s for the
|
||||||
@@ -146,18 +149,15 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
--restrict-filenames Restrict filenames to only ASCII
|
--restrict-filenames Restrict filenames to only ASCII
|
||||||
characters, and avoid "&" and spaces in
|
characters, and avoid "&" and spaces in
|
||||||
filenames
|
filenames
|
||||||
-a, --batch-file FILE file containing URLs to download ('-' for
|
-t, --title [deprecated] use title in file name
|
||||||
stdin)
|
(default)
|
||||||
--load-info FILE json file containing the video information
|
-l, --literal [deprecated] alias of --title
|
||||||
(created with the "--write-json" option)
|
|
||||||
-w, --no-overwrites do not overwrite files
|
-w, --no-overwrites do not overwrite files
|
||||||
-c, --continue force resume of partially downloaded files.
|
-c, --continue force resume of partially downloaded files.
|
||||||
By default, youtube-dl will resume
|
By default, youtube-dl will resume
|
||||||
downloads if possible.
|
downloads if possible.
|
||||||
--no-continue do not resume partially downloaded files
|
--no-continue do not resume partially downloaded files
|
||||||
(restart from beginning)
|
(restart from beginning)
|
||||||
--cookies FILE file to read cookies from and dump cookie
|
|
||||||
jar in
|
|
||||||
--no-part do not use .part files
|
--no-part do not use .part files
|
||||||
--no-mtime do not use the Last-modified header to set
|
--no-mtime do not use the Last-modified header to set
|
||||||
the file modification time
|
the file modification time
|
||||||
@@ -167,6 +167,19 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
--write-annotations write video annotations to a .annotation
|
--write-annotations write video annotations to a .annotation
|
||||||
file
|
file
|
||||||
--write-thumbnail write thumbnail image to disk
|
--write-thumbnail write thumbnail image to disk
|
||||||
|
--load-info FILE json file containing the video information
|
||||||
|
(created with the "--write-json" option)
|
||||||
|
--cookies FILE file to read cookies from and dump cookie
|
||||||
|
jar in
|
||||||
|
--cache-dir DIR Location in the filesystem where youtube-dl
|
||||||
|
can store some downloaded information
|
||||||
|
permanently. By default $XDG_CACHE_HOME
|
||||||
|
/youtube-dl or ~/.cache/youtube-dl . At the
|
||||||
|
moment, only YouTube player files (for
|
||||||
|
videos with obfuscated signatures) are
|
||||||
|
cached, but that may change.
|
||||||
|
--no-cache-dir Disable filesystem caching
|
||||||
|
--rm-cache-dir Delete all filesystem cache files
|
||||||
|
|
||||||
## Verbosity / Simulation Options:
|
## Verbosity / Simulation Options:
|
||||||
-q, --quiet activates quiet mode
|
-q, --quiet activates quiet mode
|
||||||
@@ -196,6 +209,22 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
problems
|
problems
|
||||||
--print-traffic Display sent and read HTTP traffic
|
--print-traffic Display sent and read HTTP traffic
|
||||||
|
|
||||||
|
## Workarounds:
|
||||||
|
--encoding ENCODING Force the specified encoding (experimental)
|
||||||
|
--no-check-certificate Suppress HTTPS certificate validation.
|
||||||
|
--prefer-insecure Use an unencrypted connection to retrieve
|
||||||
|
information about the video. (Currently
|
||||||
|
supported only for YouTube)
|
||||||
|
--user-agent UA specify a custom user agent
|
||||||
|
--referer REF specify a custom referer, use if the video
|
||||||
|
access is restricted to one domain
|
||||||
|
--add-header FIELD:VALUE specify a custom HTTP header and its value,
|
||||||
|
separated by a colon ':'. You can use this
|
||||||
|
option multiple times
|
||||||
|
--bidi-workaround Work around terminals that lack
|
||||||
|
bidirectional text support. Requires bidiv
|
||||||
|
or fribidi executable in PATH
|
||||||
|
|
||||||
## Video Format Options:
|
## Video Format Options:
|
||||||
-f, --format FORMAT video format code, specify the order of
|
-f, --format FORMAT video format code, specify the order of
|
||||||
preference using slashes: "-f 22/17/18".
|
preference using slashes: "-f 22/17/18".
|
||||||
@@ -226,6 +255,7 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
## Authentication Options:
|
## Authentication Options:
|
||||||
-u, --username USERNAME account username
|
-u, --username USERNAME account username
|
||||||
-p, --password PASSWORD account password
|
-p, --password PASSWORD account password
|
||||||
|
-2, --twofactor TWOFACTOR two-factor auth code
|
||||||
-n, --netrc use .netrc authentication data
|
-n, --netrc use .netrc authentication data
|
||||||
--video-password PASSWORD video password (vimeo, smotri)
|
--video-password PASSWORD video password (vimeo, smotri)
|
||||||
|
|
||||||
@@ -241,7 +271,7 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
128K (default 5)
|
128K (default 5)
|
||||||
--recode-video FORMAT Encode the video to another format if
|
--recode-video FORMAT Encode the video to another format if
|
||||||
necessary (currently supported:
|
necessary (currently supported:
|
||||||
mp4|flv|ogg|webm)
|
mp4|flv|ogg|webm|mkv)
|
||||||
-k, --keep-video keeps the video file on disk after the
|
-k, --keep-video keeps the video file on disk after the
|
||||||
post-processing; the video is erased by
|
post-processing; the video is erased by
|
||||||
default
|
default
|
||||||
@@ -250,6 +280,7 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
default
|
default
|
||||||
--embed-subs embed subtitles in the video (only for mp4
|
--embed-subs embed subtitles in the video (only for mp4
|
||||||
videos)
|
videos)
|
||||||
|
--embed-thumbnail embed thumbnail in the audio as cover art
|
||||||
--add-metadata write metadata to the video file
|
--add-metadata write metadata to the video file
|
||||||
--xattrs write metadata to the video file's xattrs
|
--xattrs write metadata to the video file's xattrs
|
||||||
(using dublin core and xdg standards)
|
(using dublin core and xdg standards)
|
||||||
@@ -257,6 +288,10 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
postprocessors (default)
|
postprocessors (default)
|
||||||
--prefer-ffmpeg Prefer ffmpeg over avconv for running the
|
--prefer-ffmpeg Prefer ffmpeg over avconv for running the
|
||||||
postprocessors
|
postprocessors
|
||||||
|
--exec CMD Execute a command on the file after
|
||||||
|
downloading, similar to find's -exec
|
||||||
|
syntax. Example: --exec 'adb push {}
|
||||||
|
/sdcard/Music/ && rm {}'
|
||||||
|
|
||||||
# CONFIGURATION
|
# CONFIGURATION
|
||||||
|
|
||||||
@@ -281,10 +316,12 @@ The current default template is `%(title)s-%(id)s.%(ext)s`.
|
|||||||
|
|
||||||
In some cases, you don't want special characters such as 中, spaces, or &, such as when transferring the downloaded filename to a Windows system or the filename through an 8bit-unsafe channel. In these cases, add the `--restrict-filenames` flag to get a shorter title:
|
In some cases, you don't want special characters such as 中, spaces, or &, such as when transferring the downloaded filename to a Windows system or the filename through an 8bit-unsafe channel. In these cases, add the `--restrict-filenames` flag to get a shorter title:
|
||||||
|
|
||||||
$ youtube-dl --get-filename -o "%(title)s.%(ext)s" BaW_jenozKc
|
```bash
|
||||||
youtube-dl test video ''_ä↭𝕐.mp4 # All kinds of weird characters
|
$ youtube-dl --get-filename -o "%(title)s.%(ext)s" BaW_jenozKc
|
||||||
$ youtube-dl --get-filename -o "%(title)s.%(ext)s" BaW_jenozKc --restrict-filenames
|
youtube-dl test video ''_ä↭𝕐.mp4 # All kinds of weird characters
|
||||||
youtube-dl_test_video_.mp4 # A simple file name
|
$ youtube-dl --get-filename -o "%(title)s.%(ext)s" BaW_jenozKc --restrict-filenames
|
||||||
|
youtube-dl_test_video_.mp4 # A simple file name
|
||||||
|
```
|
||||||
|
|
||||||
# VIDEO SELECTION
|
# VIDEO SELECTION
|
||||||
|
|
||||||
@@ -295,14 +332,16 @@ Videos can be filtered by their upload date using the options `--date`, `--dateb
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
# Download only the videos uploaded in the last 6 months
|
```bash
|
||||||
$ youtube-dl --dateafter now-6months
|
# Download only the videos uploaded in the last 6 months
|
||||||
|
$ youtube-dl --dateafter now-6months
|
||||||
|
|
||||||
# Download only the videos uploaded on January 1, 1970
|
# Download only the videos uploaded on January 1, 1970
|
||||||
$ youtube-dl --date 19700101
|
$ youtube-dl --date 19700101
|
||||||
|
|
||||||
$ # will only download the videos uploaded in the 200x decade
|
$ # will only download the videos uploaded in the 200x decade
|
||||||
$ youtube-dl --dateafter 20000101 --datebefore 20091231
|
$ youtube-dl --dateafter 20000101 --datebefore 20091231
|
||||||
|
```
|
||||||
|
|
||||||
# FAQ
|
# FAQ
|
||||||
|
|
||||||
@@ -371,7 +410,67 @@ If you want to create a build of youtube-dl yourself, you'll need
|
|||||||
|
|
||||||
### Adding support for a new site
|
### Adding support for a new site
|
||||||
|
|
||||||
If you want to add support for a new site, copy *any* [recently modified](https://github.com/rg3/youtube-dl/commits/master/youtube_dl/extractor) file in `youtube_dl/extractor`, add an import in [`youtube_dl/extractor/__init__.py`](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/__init__.py). Have a look at [`youtube_dl/common/extractor/common.py`](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py) for possible helper methods and a [detailed description of what your extractor should return](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py#L38). Don't forget to run the tests with `python test/test_download.py TestDownload.test_YourExtractor`! For a detailed tutorial, refer to [this blog post](http://filippo.io/add-support-for-a-new-video-site-to-youtube-dl/).
|
If you want to add support for a new site, you can follow this quick list (assuming your service is called `yourextractor`):
|
||||||
|
|
||||||
|
1. [Fork this repository](https://github.com/rg3/youtube-dl/fork)
|
||||||
|
2. Check out the source code with `git clone git@github.com:YOUR_GITHUB_USERNAME/youtube-dl.git`
|
||||||
|
3. Start a new git branch with `cd youtube-dl; git checkout -b yourextractor`
|
||||||
|
4. Start with this simple template and save it to `youtube_dl/extractor/yourextractor.py`:
|
||||||
|
```python
|
||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class YourExtractorIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?yourextractor\.com/watch/(?P<id>[0-9]+)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://yourextractor.com/watch/42',
|
||||||
|
'md5': 'TODO: md5 sum of the first 10KiB of the video file',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '42',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Video title goes here',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
# TODO more properties, either as:
|
||||||
|
# * A value
|
||||||
|
# * MD5 checksum; start the string with md5:
|
||||||
|
# * A regular expression; start the string with re:
|
||||||
|
# * Any Python type (for example int or float)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
# TODO more code goes here, for example ...
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
title = self._html_search_regex(r'<h1>(.*?)</h1>', webpage, 'title')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
# TODO more properties (see youtube_dl/extractor/common.py)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
5. Add an import in [`youtube_dl/extractor/__init__.py`](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/__init__.py).
|
||||||
|
6. Run `python test/test_download.py TestDownload.test_YourExtractor`. This *should fail* at first, but you can continually re-run it until you're done. If you decide to add more than one test, then rename ``_TEST`` to ``_TESTS`` and make it into a list of dictionaries. The tests will be then be named `TestDownload.test_YourExtractor`, `TestDownload.test_YourExtractor_1`, `TestDownload.test_YourExtractor_2`, etc.
|
||||||
|
7. Have a look at [`youtube_dl/common/extractor/common.py`](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py) for possible helper methods and a [detailed description of what your extractor should return](https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py#L38). Add tests and code for as many as you want.
|
||||||
|
8. If you can, check the code with [pyflakes](https://pypi.python.org/pypi/pyflakes) (a good idea) and [pep8](https://pypi.python.org/pypi/pep8) (optional, ignore E501).
|
||||||
|
9. When the tests pass, [add](https://www.kernel.org/pub/software/scm/git/docs/git-add.html) the new files and [commit](https://www.kernel.org/pub/software/scm/git/docs/git-commit.html) them and [push](https://www.kernel.org/pub/software/scm/git/docs/git-push.html) the result, like this:
|
||||||
|
|
||||||
|
$ git add youtube_dl/extractor/__init__.py
|
||||||
|
$ git add youtube_dl/extractor/yourextractor.py
|
||||||
|
$ git commit -m '[yourextractor] Add new extractor'
|
||||||
|
$ git push origin yourextractor
|
||||||
|
|
||||||
|
10. Finally, [create a pull request](https://help.github.com/articles/creating-a-pull-request). We'll then review and merge it.
|
||||||
|
|
||||||
|
In any case, thank you very much for your contributions!
|
||||||
|
|
||||||
# BUGS
|
# BUGS
|
||||||
|
|
||||||
@@ -397,7 +496,7 @@ If your report is shorter than two lines, it is almost certainly missing some of
|
|||||||
|
|
||||||
For bug reports, this means that your report should contain the *complete* output of youtube-dl when called with the -v flag. The error message you get for (most) bugs even says so, but you would not believe how many of our bug reports do not contain this information.
|
For bug reports, this means that your report should contain the *complete* output of youtube-dl when called with the -v flag. The error message you get for (most) bugs even says so, but you would not believe how many of our bug reports do not contain this information.
|
||||||
|
|
||||||
Site support requests must contain an example URL. An example URL is a URL you might want to download, like http://www.youtube.com/watch?v=BaW_jenozKc . There should be an obvious video present. Except under very special circumstances, the main page of a video service (e.g. http://www.youtube.com/ ) is *not* an example URL.
|
Site support requests **must contain an example URL**. An example URL is a URL you might want to download, like http://www.youtube.com/watch?v=BaW_jenozKc . There should be an obvious video present. Except under very special circumstances, the main page of a video service (e.g. http://www.youtube.com/ ) is *not* an example URL.
|
||||||
|
|
||||||
### Are you using the latest version?
|
### Are you using the latest version?
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ header = oldreadme[:oldreadme.index('# OPTIONS')]
|
|||||||
footer = oldreadme[oldreadme.index('# CONFIGURATION'):]
|
footer = oldreadme[oldreadme.index('# CONFIGURATION'):]
|
||||||
|
|
||||||
options = helptext[helptext.index(' General Options:') + 19:]
|
options = helptext[helptext.index(' General Options:') + 19:]
|
||||||
options = re.sub(r'^ (\w.+)$', r'## \1', options, flags=re.M)
|
options = re.sub(r'(?m)^ (\w.+)$', r'## \1', options)
|
||||||
options = '# OPTIONS\n' + options + '\n'
|
options = '# OPTIONS\n' + options + '\n'
|
||||||
|
|
||||||
with io.open(README_FILE, 'w', encoding='utf-8') as f:
|
with io.open(README_FILE, 'w', encoding='utf-8') as f:
|
||||||
|
|||||||
20
devscripts/prepare_manpage.py
Normal file
20
devscripts/prepare_manpage.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
import io
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
README_FILE = os.path.join(ROOT_DIR, 'README.md')
|
||||||
|
|
||||||
|
with io.open(README_FILE, encoding='utf-8') as f:
|
||||||
|
readme = f.read()
|
||||||
|
|
||||||
|
PREFIX = '%YOUTUBE-DL(1)\n\n# NAME\n'
|
||||||
|
readme = re.sub(r'(?s)# INSTALLATION.*?(?=# DESCRIPTION)', '', readme)
|
||||||
|
readme = PREFIX + readme
|
||||||
|
|
||||||
|
if sys.version_info < (3, 0):
|
||||||
|
print(readme.encode('utf-8'))
|
||||||
|
else:
|
||||||
|
print(readme)
|
||||||
@@ -45,9 +45,9 @@ fi
|
|||||||
/bin/echo -e "\n### Changing version in version.py..."
|
/bin/echo -e "\n### Changing version in version.py..."
|
||||||
sed -i "s/__version__ = '.*'/__version__ = '$version'/" youtube_dl/version.py
|
sed -i "s/__version__ = '.*'/__version__ = '$version'/" youtube_dl/version.py
|
||||||
|
|
||||||
/bin/echo -e "\n### Committing CHANGELOG README.md and youtube_dl/version.py..."
|
/bin/echo -e "\n### Committing README.md and youtube_dl/version.py..."
|
||||||
make README.md
|
make README.md
|
||||||
git add CHANGELOG README.md youtube_dl/version.py
|
git add README.md youtube_dl/version.py
|
||||||
git commit -m "release $version"
|
git commit -m "release $version"
|
||||||
|
|
||||||
/bin/echo -e "\n### Now tagging, signing and pushing..."
|
/bin/echo -e "\n### Now tagging, signing and pushing..."
|
||||||
|
|||||||
@@ -74,13 +74,19 @@ class FakeYDL(YoutubeDL):
|
|||||||
old_report_warning(message)
|
old_report_warning(message)
|
||||||
self.report_warning = types.MethodType(report_warning, self)
|
self.report_warning = types.MethodType(report_warning, self)
|
||||||
|
|
||||||
def gettestcases():
|
|
||||||
|
def gettestcases(include_onlymatching=False):
|
||||||
for ie in youtube_dl.extractor.gen_extractors():
|
for ie in youtube_dl.extractor.gen_extractors():
|
||||||
t = getattr(ie, '_TEST', None)
|
t = getattr(ie, '_TEST', None)
|
||||||
if t:
|
if t:
|
||||||
t['name'] = type(ie).__name__[:-len('IE')]
|
assert not hasattr(ie, '_TESTS'), \
|
||||||
yield t
|
'%s has _TEST and _TESTS' % type(ie).__name__
|
||||||
for t in getattr(ie, '_TESTS', []):
|
tests = [t]
|
||||||
|
else:
|
||||||
|
tests = getattr(ie, '_TESTS', [])
|
||||||
|
for t in tests:
|
||||||
|
if not include_onlymatching and t.get('only_matching', False):
|
||||||
|
continue
|
||||||
t['name'] = type(ie).__name__[:-len('IE')]
|
t['name'] = type(ie).__name__[:-len('IE')]
|
||||||
yield t
|
yield t
|
||||||
|
|
||||||
@@ -96,12 +102,16 @@ def expect_info_dict(self, expected_dict, got_dict):
|
|||||||
match_rex = re.compile(match_str)
|
match_rex = re.compile(match_str)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
isinstance(got, compat_str) and match_rex.match(got),
|
isinstance(got, compat_str),
|
||||||
|
u'Expected a %s object, but got %s for field %s' % (
|
||||||
|
compat_str.__name__, type(got).__name__, info_field))
|
||||||
|
self.assertTrue(
|
||||||
|
match_rex.match(got),
|
||||||
u'field %s (value: %r) should match %r' % (info_field, got, match_str))
|
u'field %s (value: %r) should match %r' % (info_field, got, match_str))
|
||||||
elif isinstance(expected, type):
|
elif isinstance(expected, type):
|
||||||
got = got_dict.get(info_field)
|
got = got_dict.get(info_field)
|
||||||
self.assertTrue(isinstance(got, expected),
|
self.assertTrue(isinstance(got, expected),
|
||||||
u'Expected type %r, but got value %r of type %r' % (expected, got, type(got)))
|
u'Expected type %r for field %s, but got value %r of type %r' % (expected, info_field, got, type(got)))
|
||||||
else:
|
else:
|
||||||
if isinstance(expected, compat_str) and expected.startswith('md5:'):
|
if isinstance(expected, compat_str) and expected.startswith('md5:'):
|
||||||
got = 'md5:' + md5(got_dict.get(info_field))
|
got = 'md5:' + md5(got_dict.get(info_field))
|
||||||
@@ -111,8 +121,9 @@ def expect_info_dict(self, expected_dict, got_dict):
|
|||||||
u'invalid value for field %s, expected %r, got %r' % (info_field, expected, got))
|
u'invalid value for field %s, expected %r, got %r' % (info_field, expected, got))
|
||||||
|
|
||||||
# Check for the presence of mandatory fields
|
# Check for the presence of mandatory fields
|
||||||
for key in ('id', 'url', 'title', 'ext'):
|
if got_dict.get('_type') != 'playlist':
|
||||||
self.assertTrue(got_dict.get(key), 'Missing mandatory field %s' % key)
|
for key in ('id', 'url', 'title', 'ext'):
|
||||||
|
self.assertTrue(got_dict.get(key), 'Missing mandatory field %s' % key)
|
||||||
# Check for mandatory fields that are automatically set by YoutubeDL
|
# Check for mandatory fields that are automatically set by YoutubeDL
|
||||||
for key in ['webpage_url', 'extractor', 'extractor_key']:
|
for key in ['webpage_url', 'extractor', 'extractor_key']:
|
||||||
self.assertTrue(got_dict.get(key), u'Missing field: %s' % key)
|
self.assertTrue(got_dict.get(key), u'Missing field: %s' % key)
|
||||||
@@ -128,3 +139,24 @@ def expect_info_dict(self, expected_dict, got_dict):
|
|||||||
missing_keys,
|
missing_keys,
|
||||||
'Missing keys in test definition: %s' % (
|
'Missing keys in test definition: %s' % (
|
||||||
', '.join(sorted(missing_keys))))
|
', '.join(sorted(missing_keys))))
|
||||||
|
|
||||||
|
|
||||||
|
def assertRegexpMatches(self, text, regexp, msg=None):
|
||||||
|
if hasattr(self, 'assertRegexp'):
|
||||||
|
return self.assertRegexp(text, regexp, msg)
|
||||||
|
else:
|
||||||
|
m = re.match(regexp, text)
|
||||||
|
if not m:
|
||||||
|
note = 'Regexp didn\'t match: %r not found in %r' % (regexp, text)
|
||||||
|
if msg is None:
|
||||||
|
msg = note
|
||||||
|
else:
|
||||||
|
msg = note + ', ' + msg
|
||||||
|
self.assertTrue(m, msg)
|
||||||
|
|
||||||
|
|
||||||
|
def assertGreaterEqual(self, got, expected, msg=None):
|
||||||
|
if not (got >= expected):
|
||||||
|
if msg is None:
|
||||||
|
msg = '%r not greater than or equal to %r' % (got, expected)
|
||||||
|
self.assertTrue(got >= expected, msg)
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
"rejecttitle": null,
|
"rejecttitle": null,
|
||||||
"retries": 10,
|
"retries": 10,
|
||||||
"simulate": false,
|
"simulate": false,
|
||||||
"skip_download": false,
|
|
||||||
"subtitleslang": null,
|
"subtitleslang": null,
|
||||||
"subtitlesformat": "srt",
|
"subtitlesformat": "srt",
|
||||||
"test": true,
|
"test": true,
|
||||||
|
|||||||
1
test/swftests/.gitignore
vendored
Normal file
1
test/swftests/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.swf
|
||||||
19
test/swftests/ArrayAccess.as
Normal file
19
test/swftests/ArrayAccess.as
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// input: [["a", "b", "c", "d"]]
|
||||||
|
// output: ["c", "b", "a", "d"]
|
||||||
|
|
||||||
|
package {
|
||||||
|
public class ArrayAccess {
|
||||||
|
public static function main(ar:Array):Array {
|
||||||
|
var aa:ArrayAccess = new ArrayAccess();
|
||||||
|
return aa.f(ar, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function f(ar:Array, num:Number):Array{
|
||||||
|
var x:String = ar[0];
|
||||||
|
var y:String = ar[num % ar.length];
|
||||||
|
ar[0] = y;
|
||||||
|
ar[num] = x;
|
||||||
|
return ar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
test/swftests/ClassCall.as
Normal file
17
test/swftests/ClassCall.as
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
// input: []
|
||||||
|
// output: 121
|
||||||
|
|
||||||
|
package {
|
||||||
|
public class ClassCall {
|
||||||
|
public static function main():int{
|
||||||
|
var f:OtherClass = new OtherClass();
|
||||||
|
return f.func(100,20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OtherClass {
|
||||||
|
public function func(x: int, y: int):int {
|
||||||
|
return x+y+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
test/swftests/ClassConstruction.as
Normal file
15
test/swftests/ClassConstruction.as
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
// input: []
|
||||||
|
// output: 0
|
||||||
|
|
||||||
|
package {
|
||||||
|
public class ClassConstruction {
|
||||||
|
public static function main():int{
|
||||||
|
var f:Foo = new Foo();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
|
||||||
|
}
|
||||||
13
test/swftests/LocalVars.as
Normal file
13
test/swftests/LocalVars.as
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// input: [1, 2]
|
||||||
|
// output: 3
|
||||||
|
|
||||||
|
package {
|
||||||
|
public class LocalVars {
|
||||||
|
public static function main(a:int, b:int):int{
|
||||||
|
var c:int = a + b + b;
|
||||||
|
var d:int = c - b;
|
||||||
|
var e:int = d;
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
test/swftests/PrivateCall.as
Normal file
21
test/swftests/PrivateCall.as
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
// input: []
|
||||||
|
// output: 9
|
||||||
|
|
||||||
|
package {
|
||||||
|
public class PrivateCall {
|
||||||
|
public static function main():int{
|
||||||
|
var f:OtherClass = new OtherClass();
|
||||||
|
return f.func();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OtherClass {
|
||||||
|
private function pf():int {
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function func():int {
|
||||||
|
return this.pf();
|
||||||
|
}
|
||||||
|
}
|
||||||
13
test/swftests/StaticAssignment.as
Normal file
13
test/swftests/StaticAssignment.as
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// input: [1]
|
||||||
|
// output: 1
|
||||||
|
|
||||||
|
package {
|
||||||
|
public class StaticAssignment {
|
||||||
|
public static var v:int;
|
||||||
|
|
||||||
|
public static function main(a:int):int{
|
||||||
|
v = a;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
test/swftests/StaticRetrieval.as
Normal file
16
test/swftests/StaticRetrieval.as
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// input: []
|
||||||
|
// output: 1
|
||||||
|
|
||||||
|
package {
|
||||||
|
public class StaticRetrieval {
|
||||||
|
public static var v:int;
|
||||||
|
|
||||||
|
public static function main():int{
|
||||||
|
if (v) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ import sys
|
|||||||
import unittest
|
import unittest
|
||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
from test.helper import FakeYDL
|
from test.helper import FakeYDL, assertRegexpMatches
|
||||||
from youtube_dl import YoutubeDL
|
from youtube_dl import YoutubeDL
|
||||||
from youtube_dl.extractor import YoutubeIE
|
from youtube_dl.extractor import YoutubeIE
|
||||||
|
|
||||||
@@ -26,16 +26,27 @@ class YDL(FakeYDL):
|
|||||||
self.msgs.append(msg)
|
self.msgs.append(msg)
|
||||||
|
|
||||||
|
|
||||||
|
def _make_result(formats, **kwargs):
|
||||||
|
res = {
|
||||||
|
'formats': formats,
|
||||||
|
'id': 'testid',
|
||||||
|
'title': 'testttitle',
|
||||||
|
'extractor': 'testex',
|
||||||
|
}
|
||||||
|
res.update(**kwargs)
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
class TestFormatSelection(unittest.TestCase):
|
class TestFormatSelection(unittest.TestCase):
|
||||||
def test_prefer_free_formats(self):
|
def test_prefer_free_formats(self):
|
||||||
# Same resolution => download webm
|
# Same resolution => download webm
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = True
|
ydl.params['prefer_free_formats'] = True
|
||||||
formats = [
|
formats = [
|
||||||
{'ext': 'webm', 'height': 460},
|
{'ext': 'webm', 'height': 460, 'url': 'x'},
|
||||||
{'ext': 'mp4', 'height': 460},
|
{'ext': 'mp4', 'height': 460, 'url': 'y'},
|
||||||
]
|
]
|
||||||
info_dict = {'formats': formats, 'extractor': 'test'}
|
info_dict = _make_result(formats)
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
yie._sort_formats(info_dict['formats'])
|
yie._sort_formats(info_dict['formats'])
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
@@ -46,8 +57,8 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = True
|
ydl.params['prefer_free_formats'] = True
|
||||||
formats = [
|
formats = [
|
||||||
{'ext': 'webm', 'height': 720},
|
{'ext': 'webm', 'height': 720, 'url': 'a'},
|
||||||
{'ext': 'mp4', 'height': 1080},
|
{'ext': 'mp4', 'height': 1080, 'url': 'b'},
|
||||||
]
|
]
|
||||||
info_dict['formats'] = formats
|
info_dict['formats'] = formats
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
@@ -56,13 +67,13 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['ext'], 'mp4')
|
self.assertEqual(downloaded['ext'], 'mp4')
|
||||||
|
|
||||||
# No prefer_free_formats => prefer mp4 and flv for greater compatibilty
|
# No prefer_free_formats => prefer mp4 and flv for greater compatibility
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = False
|
ydl.params['prefer_free_formats'] = False
|
||||||
formats = [
|
formats = [
|
||||||
{'ext': 'webm', 'height': 720},
|
{'ext': 'webm', 'height': 720, 'url': '_'},
|
||||||
{'ext': 'mp4', 'height': 720},
|
{'ext': 'mp4', 'height': 720, 'url': '_'},
|
||||||
{'ext': 'flv', 'height': 720},
|
{'ext': 'flv', 'height': 720, 'url': '_'},
|
||||||
]
|
]
|
||||||
info_dict['formats'] = formats
|
info_dict['formats'] = formats
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
@@ -74,8 +85,8 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.params['prefer_free_formats'] = False
|
ydl.params['prefer_free_formats'] = False
|
||||||
formats = [
|
formats = [
|
||||||
{'ext': 'flv', 'height': 720},
|
{'ext': 'flv', 'height': 720, 'url': '_'},
|
||||||
{'ext': 'webm', 'height': 720},
|
{'ext': 'webm', 'height': 720, 'url': '_'},
|
||||||
]
|
]
|
||||||
info_dict['formats'] = formats
|
info_dict['formats'] = formats
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
@@ -91,8 +102,7 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
{'format_id': 'great', 'url': 'http://example.com/great', 'preference': 3},
|
{'format_id': 'great', 'url': 'http://example.com/great', 'preference': 3},
|
||||||
{'format_id': 'excellent', 'url': 'http://example.com/exc', 'preference': 4},
|
{'format_id': 'excellent', 'url': 'http://example.com/exc', 'preference': 4},
|
||||||
]
|
]
|
||||||
info_dict = {
|
info_dict = _make_result(formats)
|
||||||
'formats': formats, 'extractor': 'test', 'id': 'testvid'}
|
|
||||||
|
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
@@ -120,12 +130,12 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
|
|
||||||
def test_format_selection(self):
|
def test_format_selection(self):
|
||||||
formats = [
|
formats = [
|
||||||
{'format_id': '35', 'ext': 'mp4', 'preference': 1},
|
{'format_id': '35', 'ext': 'mp4', 'preference': 1, 'url': '_'},
|
||||||
{'format_id': '45', 'ext': 'webm', 'preference': 2},
|
{'format_id': '45', 'ext': 'webm', 'preference': 2, 'url': '_'},
|
||||||
{'format_id': '47', 'ext': 'webm', 'preference': 3},
|
{'format_id': '47', 'ext': 'webm', 'preference': 3, 'url': '_'},
|
||||||
{'format_id': '2', 'ext': 'flv', 'preference': 4},
|
{'format_id': '2', 'ext': 'flv', 'preference': 4, 'url': '_'},
|
||||||
]
|
]
|
||||||
info_dict = {'formats': formats, 'extractor': 'test'}
|
info_dict = _make_result(formats)
|
||||||
|
|
||||||
ydl = YDL({'format': '20/47'})
|
ydl = YDL({'format': '20/47'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
@@ -154,12 +164,12 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
|
|
||||||
def test_format_selection_audio(self):
|
def test_format_selection_audio(self):
|
||||||
formats = [
|
formats = [
|
||||||
{'format_id': 'audio-low', 'ext': 'webm', 'preference': 1, 'vcodec': 'none'},
|
{'format_id': 'audio-low', 'ext': 'webm', 'preference': 1, 'vcodec': 'none', 'url': '_'},
|
||||||
{'format_id': 'audio-mid', 'ext': 'webm', 'preference': 2, 'vcodec': 'none'},
|
{'format_id': 'audio-mid', 'ext': 'webm', 'preference': 2, 'vcodec': 'none', 'url': '_'},
|
||||||
{'format_id': 'audio-high', 'ext': 'flv', 'preference': 3, 'vcodec': 'none'},
|
{'format_id': 'audio-high', 'ext': 'flv', 'preference': 3, 'vcodec': 'none', 'url': '_'},
|
||||||
{'format_id': 'vid', 'ext': 'mp4', 'preference': 4},
|
{'format_id': 'vid', 'ext': 'mp4', 'preference': 4, 'url': '_'},
|
||||||
]
|
]
|
||||||
info_dict = {'formats': formats, 'extractor': 'test'}
|
info_dict = _make_result(formats)
|
||||||
|
|
||||||
ydl = YDL({'format': 'bestaudio'})
|
ydl = YDL({'format': 'bestaudio'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
@@ -172,10 +182,10 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
self.assertEqual(downloaded['format_id'], 'audio-low')
|
self.assertEqual(downloaded['format_id'], 'audio-low')
|
||||||
|
|
||||||
formats = [
|
formats = [
|
||||||
{'format_id': 'vid-low', 'ext': 'mp4', 'preference': 1},
|
{'format_id': 'vid-low', 'ext': 'mp4', 'preference': 1, 'url': '_'},
|
||||||
{'format_id': 'vid-high', 'ext': 'mp4', 'preference': 2},
|
{'format_id': 'vid-high', 'ext': 'mp4', 'preference': 2, 'url': '_'},
|
||||||
]
|
]
|
||||||
info_dict = {'formats': formats, 'extractor': 'test'}
|
info_dict = _make_result(formats)
|
||||||
|
|
||||||
ydl = YDL({'format': 'bestaudio/worstaudio/best'})
|
ydl = YDL({'format': 'bestaudio/worstaudio/best'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
@@ -184,11 +194,11 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
|
|
||||||
def test_format_selection_video(self):
|
def test_format_selection_video(self):
|
||||||
formats = [
|
formats = [
|
||||||
{'format_id': 'dash-video-low', 'ext': 'mp4', 'preference': 1, 'acodec': 'none'},
|
{'format_id': 'dash-video-low', 'ext': 'mp4', 'preference': 1, 'acodec': 'none', 'url': '_'},
|
||||||
{'format_id': 'dash-video-high', 'ext': 'mp4', 'preference': 2, 'acodec': 'none'},
|
{'format_id': 'dash-video-high', 'ext': 'mp4', 'preference': 2, 'acodec': 'none', 'url': '_'},
|
||||||
{'format_id': 'vid', 'ext': 'mp4', 'preference': 3},
|
{'format_id': 'vid', 'ext': 'mp4', 'preference': 3, 'url': '_'},
|
||||||
]
|
]
|
||||||
info_dict = {'formats': formats, 'extractor': 'test'}
|
info_dict = _make_result(formats)
|
||||||
|
|
||||||
ydl = YDL({'format': 'bestvideo'})
|
ydl = YDL({'format': 'bestvideo'})
|
||||||
ydl.process_ie_result(info_dict.copy())
|
ydl.process_ie_result(info_dict.copy())
|
||||||
@@ -211,16 +221,18 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
'138', '137', '248', '136', '247', '135', '246',
|
'138', '137', '248', '136', '247', '135', '246',
|
||||||
'245', '244', '134', '243', '133', '242', '160',
|
'245', '244', '134', '243', '133', '242', '160',
|
||||||
# Dash audio
|
# Dash audio
|
||||||
'141', '172', '140', '139', '171',
|
'141', '172', '140', '171', '139',
|
||||||
]
|
]
|
||||||
|
|
||||||
for f1id, f2id in zip(order, order[1:]):
|
for f1id, f2id in zip(order, order[1:]):
|
||||||
f1 = YoutubeIE._formats[f1id].copy()
|
f1 = YoutubeIE._formats[f1id].copy()
|
||||||
f1['format_id'] = f1id
|
f1['format_id'] = f1id
|
||||||
|
f1['url'] = 'url:' + f1id
|
||||||
f2 = YoutubeIE._formats[f2id].copy()
|
f2 = YoutubeIE._formats[f2id].copy()
|
||||||
f2['format_id'] = f2id
|
f2['format_id'] = f2id
|
||||||
|
f2['url'] = 'url:' + f2id
|
||||||
|
|
||||||
info_dict = {'formats': [f1, f2], 'extractor': 'youtube'}
|
info_dict = _make_result([f1, f2], extractor='youtube')
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
yie._sort_formats(info_dict['formats'])
|
yie._sort_formats(info_dict['formats'])
|
||||||
@@ -228,7 +240,7 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
self.assertEqual(downloaded['format_id'], f1id)
|
self.assertEqual(downloaded['format_id'], f1id)
|
||||||
|
|
||||||
info_dict = {'formats': [f2, f1], 'extractor': 'youtube'}
|
info_dict = _make_result([f2, f1], extractor='youtube')
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
yie = YoutubeIE(ydl)
|
yie = YoutubeIE(ydl)
|
||||||
yie._sort_formats(info_dict['formats'])
|
yie._sort_formats(info_dict['formats'])
|
||||||
@@ -262,6 +274,12 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
# Replace missing fields with 'NA'
|
# Replace missing fields with 'NA'
|
||||||
self.assertEqual(fname('%(uploader_date)s-%(id)s.%(ext)s'), 'NA-1234.mp4')
|
self.assertEqual(fname('%(uploader_date)s-%(id)s.%(ext)s'), 'NA-1234.mp4')
|
||||||
|
|
||||||
|
def test_format_note(self):
|
||||||
|
ydl = YoutubeDL()
|
||||||
|
self.assertEqual(ydl._format_note({}), '')
|
||||||
|
assertRegexpMatches(self, ydl._format_note({
|
||||||
|
'vbr': 10,
|
||||||
|
}), '^\s*10k$')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from youtube_dl import YoutubeDL
|
|||||||
|
|
||||||
|
|
||||||
def _download_restricted(url, filename, age):
|
def _download_restricted(url, filename, age):
|
||||||
""" Returns true iff the file has been downloaded """
|
""" Returns true if the file has been downloaded """
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
'age_limit': age,
|
'age_limit': age,
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ from youtube_dl.extractor import (
|
|||||||
FacebookIE,
|
FacebookIE,
|
||||||
gen_extractors,
|
gen_extractors,
|
||||||
JustinTVIE,
|
JustinTVIE,
|
||||||
PBSIE,
|
|
||||||
YoutubeIE,
|
YoutubeIE,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -49,6 +48,7 @@ class TestAllURLsMatching(unittest.TestCase):
|
|||||||
self.assertMatch('http://youtu.be/BaW_jenozKc', ['youtube'])
|
self.assertMatch('http://youtu.be/BaW_jenozKc', ['youtube'])
|
||||||
self.assertMatch('http://www.youtube.com/v/BaW_jenozKc', ['youtube'])
|
self.assertMatch('http://www.youtube.com/v/BaW_jenozKc', ['youtube'])
|
||||||
self.assertMatch('https://youtube.googleapis.com/v/BaW_jenozKc', ['youtube'])
|
self.assertMatch('https://youtube.googleapis.com/v/BaW_jenozKc', ['youtube'])
|
||||||
|
self.assertMatch('http://www.cleanvideosearch.com/media/action/yt/watch?videoId=8v_4O44sfjM', ['youtube'])
|
||||||
|
|
||||||
def test_youtube_channel_matching(self):
|
def test_youtube_channel_matching(self):
|
||||||
assertChannel = lambda url: self.assertMatch(url, ['youtube:channel'])
|
assertChannel = lambda url: self.assertMatch(url, ['youtube:channel'])
|
||||||
@@ -68,28 +68,25 @@ class TestAllURLsMatching(unittest.TestCase):
|
|||||||
def test_youtube_show_matching(self):
|
def test_youtube_show_matching(self):
|
||||||
self.assertMatch('http://www.youtube.com/show/airdisasters', ['youtube:show'])
|
self.assertMatch('http://www.youtube.com/show/airdisasters', ['youtube:show'])
|
||||||
|
|
||||||
def test_youtube_truncated(self):
|
|
||||||
self.assertMatch('http://www.youtube.com/watch?', ['youtube:truncated_url'])
|
|
||||||
|
|
||||||
def test_youtube_search_matching(self):
|
def test_youtube_search_matching(self):
|
||||||
self.assertMatch('http://www.youtube.com/results?search_query=making+mustard', ['youtube:search_url'])
|
self.assertMatch('http://www.youtube.com/results?search_query=making+mustard', ['youtube:search_url'])
|
||||||
self.assertMatch('https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video', ['youtube:search_url'])
|
self.assertMatch('https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video', ['youtube:search_url'])
|
||||||
|
|
||||||
def test_justin_tv_channelid_matching(self):
|
def test_justin_tv_channelid_matching(self):
|
||||||
self.assertTrue(JustinTVIE.suitable(u"justin.tv/vanillatv"))
|
self.assertTrue(JustinTVIE.suitable('justin.tv/vanillatv'))
|
||||||
self.assertTrue(JustinTVIE.suitable(u"twitch.tv/vanillatv"))
|
self.assertTrue(JustinTVIE.suitable('twitch.tv/vanillatv'))
|
||||||
self.assertTrue(JustinTVIE.suitable(u"www.justin.tv/vanillatv"))
|
self.assertTrue(JustinTVIE.suitable('www.justin.tv/vanillatv'))
|
||||||
self.assertTrue(JustinTVIE.suitable(u"www.twitch.tv/vanillatv"))
|
self.assertTrue(JustinTVIE.suitable('www.twitch.tv/vanillatv'))
|
||||||
self.assertTrue(JustinTVIE.suitable(u"http://www.justin.tv/vanillatv"))
|
self.assertTrue(JustinTVIE.suitable('http://www.justin.tv/vanillatv'))
|
||||||
self.assertTrue(JustinTVIE.suitable(u"http://www.twitch.tv/vanillatv"))
|
self.assertTrue(JustinTVIE.suitable('http://www.twitch.tv/vanillatv'))
|
||||||
self.assertTrue(JustinTVIE.suitable(u"http://www.justin.tv/vanillatv/"))
|
self.assertTrue(JustinTVIE.suitable('http://www.justin.tv/vanillatv/'))
|
||||||
self.assertTrue(JustinTVIE.suitable(u"http://www.twitch.tv/vanillatv/"))
|
self.assertTrue(JustinTVIE.suitable('http://www.twitch.tv/vanillatv/'))
|
||||||
|
|
||||||
def test_justintv_videoid_matching(self):
|
def test_justintv_videoid_matching(self):
|
||||||
self.assertTrue(JustinTVIE.suitable(u"http://www.twitch.tv/vanillatv/b/328087483"))
|
self.assertTrue(JustinTVIE.suitable('http://www.twitch.tv/vanillatv/b/328087483'))
|
||||||
|
|
||||||
def test_justin_tv_chapterid_matching(self):
|
def test_justin_tv_chapterid_matching(self):
|
||||||
self.assertTrue(JustinTVIE.suitable(u"http://www.twitch.tv/tsm_theoddone/c/2349361"))
|
self.assertTrue(JustinTVIE.suitable('http://www.twitch.tv/tsm_theoddone/c/2349361'))
|
||||||
|
|
||||||
def test_youtube_extract(self):
|
def test_youtube_extract(self):
|
||||||
assertExtractId = lambda url, id: self.assertEqual(YoutubeIE.extract_id(url), id)
|
assertExtractId = lambda url, id: self.assertEqual(YoutubeIE.extract_id(url), id)
|
||||||
@@ -102,16 +99,19 @@ class TestAllURLsMatching(unittest.TestCase):
|
|||||||
|
|
||||||
def test_facebook_matching(self):
|
def test_facebook_matching(self):
|
||||||
self.assertTrue(FacebookIE.suitable('https://www.facebook.com/Shiniknoh#!/photo.php?v=10153317450565268'))
|
self.assertTrue(FacebookIE.suitable('https://www.facebook.com/Shiniknoh#!/photo.php?v=10153317450565268'))
|
||||||
|
self.assertTrue(FacebookIE.suitable('https://www.facebook.com/cindyweather?fref=ts#!/photo.php?v=10152183998945793'))
|
||||||
|
|
||||||
def test_no_duplicates(self):
|
def test_no_duplicates(self):
|
||||||
ies = gen_extractors()
|
ies = gen_extractors()
|
||||||
for tc in gettestcases():
|
for tc in gettestcases(include_onlymatching=True):
|
||||||
url = tc['url']
|
url = tc['url']
|
||||||
for ie in ies:
|
for ie in ies:
|
||||||
if type(ie).__name__ in ('GenericIE', tc['name'] + 'IE'):
|
if type(ie).__name__ in ('GenericIE', tc['name'] + 'IE'):
|
||||||
self.assertTrue(ie.suitable(url), '%s should match URL %r' % (type(ie).__name__, url))
|
self.assertTrue(ie.suitable(url), '%s should match URL %r' % (type(ie).__name__, url))
|
||||||
else:
|
else:
|
||||||
self.assertFalse(ie.suitable(url), '%s should not match URL %r' % (type(ie).__name__, url))
|
self.assertFalse(
|
||||||
|
ie.suitable(url),
|
||||||
|
'%s should not match URL %r . That URL belongs to %s.' % (type(ie).__name__, url, tc['name']))
|
||||||
|
|
||||||
def test_keywords(self):
|
def test_keywords(self):
|
||||||
self.assertMatch(':ytsubs', ['youtube:subscriptions'])
|
self.assertMatch(':ytsubs', ['youtube:subscriptions'])
|
||||||
@@ -143,16 +143,12 @@ class TestAllURLsMatching(unittest.TestCase):
|
|||||||
self.assertMatch('http://video.pbs.org/viralplayer/2365173446/', ['PBS'])
|
self.assertMatch('http://video.pbs.org/viralplayer/2365173446/', ['PBS'])
|
||||||
self.assertMatch('http://video.pbs.org/widget/partnerplayer/980042464/', ['PBS'])
|
self.assertMatch('http://video.pbs.org/widget/partnerplayer/980042464/', ['PBS'])
|
||||||
|
|
||||||
def test_ComedyCentralShows(self):
|
def test_yahoo_https(self):
|
||||||
|
# https://github.com/rg3/youtube-dl/issues/2701
|
||||||
self.assertMatch(
|
self.assertMatch(
|
||||||
'http://thedailyshow.cc.com/extended-interviews/xm3fnq/andrew-napolitano-extended-interview',
|
'https://screen.yahoo.com/smartwatches-latest-wearable-gadgets-163745379-cbs.html',
|
||||||
['ComedyCentralShows'])
|
['Yahoo'])
|
||||||
self.assertMatch(
|
|
||||||
'http://thecolbertreport.cc.com/videos/29w6fx/-realhumanpraise-for-fox-news',
|
|
||||||
['ComedyCentralShows'])
|
|
||||||
self.assertMatch(
|
|
||||||
'http://thecolbertreport.cc.com/videos/gh6urb/neil-degrasse-tyson-pt--1?xrs=eml_col_031114',
|
|
||||||
['ComedyCentralShows'])
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import unittest
|
|||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
from test.helper import (
|
from test.helper import (
|
||||||
|
assertGreaterEqual,
|
||||||
get_params,
|
get_params,
|
||||||
gettestcases,
|
gettestcases,
|
||||||
expect_info_dict,
|
expect_info_dict,
|
||||||
md5,
|
|
||||||
try_rm,
|
try_rm,
|
||||||
report_warning,
|
report_warning,
|
||||||
)
|
)
|
||||||
@@ -24,11 +24,11 @@ import socket
|
|||||||
import youtube_dl.YoutubeDL
|
import youtube_dl.YoutubeDL
|
||||||
from youtube_dl.utils import (
|
from youtube_dl.utils import (
|
||||||
compat_http_client,
|
compat_http_client,
|
||||||
compat_str,
|
|
||||||
compat_urllib_error,
|
compat_urllib_error,
|
||||||
compat_HTTPError,
|
compat_HTTPError,
|
||||||
DownloadError,
|
DownloadError,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
format_bytes,
|
||||||
UnavailableVideoError,
|
UnavailableVideoError,
|
||||||
)
|
)
|
||||||
from youtube_dl.extractor import get_info_extractor
|
from youtube_dl.extractor import get_info_extractor
|
||||||
@@ -65,15 +65,21 @@ def generator(test_case):
|
|||||||
def test_template(self):
|
def test_template(self):
|
||||||
ie = youtube_dl.extractor.get_info_extractor(test_case['name'])
|
ie = youtube_dl.extractor.get_info_extractor(test_case['name'])
|
||||||
other_ies = [get_info_extractor(ie_key) for ie_key in test_case.get('add_ie', [])]
|
other_ies = [get_info_extractor(ie_key) for ie_key in test_case.get('add_ie', [])]
|
||||||
|
is_playlist = any(k.startswith('playlist') for k in test_case)
|
||||||
|
test_cases = test_case.get(
|
||||||
|
'playlist', [] if is_playlist else [test_case])
|
||||||
|
|
||||||
def print_skipping(reason):
|
def print_skipping(reason):
|
||||||
print('Skipping %s: %s' % (test_case['name'], reason))
|
print('Skipping %s: %s' % (test_case['name'], reason))
|
||||||
if not ie.working():
|
if not ie.working():
|
||||||
print_skipping('IE marked as not _WORKING')
|
print_skipping('IE marked as not _WORKING')
|
||||||
return
|
return
|
||||||
if 'playlist' not in test_case:
|
|
||||||
info_dict = test_case.get('info_dict', {})
|
for tc in test_cases:
|
||||||
if not test_case.get('file') and not (info_dict.get('id') and info_dict.get('ext')):
|
info_dict = tc.get('info_dict', {})
|
||||||
|
if not tc.get('file') and not (info_dict.get('id') and info_dict.get('ext')):
|
||||||
raise Exception('Test definition incorrect. The output file cannot be known. Are both \'id\' and \'ext\' keys present?')
|
raise Exception('Test definition incorrect. The output file cannot be known. Are both \'id\' and \'ext\' keys present?')
|
||||||
|
|
||||||
if 'skip' in test_case:
|
if 'skip' in test_case:
|
||||||
print_skipping(test_case['skip'])
|
print_skipping(test_case['skip'])
|
||||||
return
|
return
|
||||||
@@ -83,6 +89,9 @@ def generator(test_case):
|
|||||||
return
|
return
|
||||||
|
|
||||||
params = get_params(test_case.get('params', {}))
|
params = get_params(test_case.get('params', {}))
|
||||||
|
if is_playlist and 'playlist' not in test_case:
|
||||||
|
params.setdefault('extract_flat', True)
|
||||||
|
params.setdefault('skip_download', True)
|
||||||
|
|
||||||
ydl = YoutubeDL(params)
|
ydl = YoutubeDL(params)
|
||||||
ydl.add_default_info_extractors()
|
ydl.add_default_info_extractors()
|
||||||
@@ -95,9 +104,11 @@ def generator(test_case):
|
|||||||
def get_tc_filename(tc):
|
def get_tc_filename(tc):
|
||||||
return tc.get('file') or ydl.prepare_filename(tc.get('info_dict', {}))
|
return tc.get('file') or ydl.prepare_filename(tc.get('info_dict', {}))
|
||||||
|
|
||||||
test_cases = test_case.get('playlist', [test_case])
|
res_dict = None
|
||||||
def try_rm_tcs_files():
|
def try_rm_tcs_files(tcs=None):
|
||||||
for tc in test_cases:
|
if tcs is None:
|
||||||
|
tcs = test_cases
|
||||||
|
for tc in tcs:
|
||||||
tc_filename = get_tc_filename(tc)
|
tc_filename = get_tc_filename(tc)
|
||||||
try_rm(tc_filename)
|
try_rm(tc_filename)
|
||||||
try_rm(tc_filename + '.part')
|
try_rm(tc_filename + '.part')
|
||||||
@@ -107,7 +118,10 @@ def generator(test_case):
|
|||||||
try_num = 1
|
try_num = 1
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
ydl.download([test_case['url']])
|
# We're not using .download here sine that is just a shim
|
||||||
|
# for outside error handling, and returns the exit code
|
||||||
|
# instead of the result dict.
|
||||||
|
res_dict = ydl.extract_info(test_case['url'])
|
||||||
except (DownloadError, ExtractorError) as err:
|
except (DownloadError, ExtractorError) as err:
|
||||||
# Check if the exception is not a network related one
|
# Check if the exception is not a network related one
|
||||||
if not err.exc_info[0] in (compat_urllib_error.URLError, socket.timeout, UnavailableVideoError, compat_http_client.BadStatusLine) or (err.exc_info[0] == compat_HTTPError and err.exc_info[1].code == 503):
|
if not err.exc_info[0] in (compat_urllib_error.URLError, socket.timeout, UnavailableVideoError, compat_http_client.BadStatusLine) or (err.exc_info[0] == compat_HTTPError and err.exc_info[1].code == 503):
|
||||||
@@ -123,22 +137,62 @@ def generator(test_case):
|
|||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if is_playlist:
|
||||||
|
self.assertEqual(res_dict['_type'], 'playlist')
|
||||||
|
expect_info_dict(self, test_case.get('info_dict', {}), res_dict)
|
||||||
|
if 'playlist_mincount' in test_case:
|
||||||
|
assertGreaterEqual(
|
||||||
|
self,
|
||||||
|
len(res_dict['entries']),
|
||||||
|
test_case['playlist_mincount'],
|
||||||
|
'Expected at least %d in playlist %s, but got only %d' % (
|
||||||
|
test_case['playlist_mincount'], test_case['url'],
|
||||||
|
len(res_dict['entries'])))
|
||||||
|
if 'playlist_count' in test_case:
|
||||||
|
self.assertEqual(
|
||||||
|
len(res_dict['entries']),
|
||||||
|
test_case['playlist_count'],
|
||||||
|
'Expected %d entries in playlist %s, but got %d.' % (
|
||||||
|
test_case['playlist_count'],
|
||||||
|
test_case['url'],
|
||||||
|
len(res_dict['entries']),
|
||||||
|
))
|
||||||
|
if 'playlist_duration_sum' in test_case:
|
||||||
|
got_duration = sum(e['duration'] for e in res_dict['entries'])
|
||||||
|
self.assertEqual(
|
||||||
|
test_case['playlist_duration_sum'], got_duration)
|
||||||
|
|
||||||
for tc in test_cases:
|
for tc in test_cases:
|
||||||
tc_filename = get_tc_filename(tc)
|
tc_filename = get_tc_filename(tc)
|
||||||
if not test_case.get('params', {}).get('skip_download', False):
|
if not test_case.get('params', {}).get('skip_download', False):
|
||||||
self.assertTrue(os.path.exists(tc_filename), msg='Missing file ' + tc_filename)
|
self.assertTrue(os.path.exists(tc_filename), msg='Missing file ' + tc_filename)
|
||||||
self.assertTrue(tc_filename in finished_hook_called)
|
self.assertTrue(tc_filename in finished_hook_called)
|
||||||
|
expected_minsize = tc.get('file_minsize', 10000)
|
||||||
|
if expected_minsize is not None:
|
||||||
|
if params.get('test'):
|
||||||
|
expected_minsize = max(expected_minsize, 10000)
|
||||||
|
got_fsize = os.path.getsize(tc_filename)
|
||||||
|
assertGreaterEqual(
|
||||||
|
self, got_fsize, expected_minsize,
|
||||||
|
'Expected %s to be at least %s, but it\'s only %s ' %
|
||||||
|
(tc_filename, format_bytes(expected_minsize),
|
||||||
|
format_bytes(got_fsize)))
|
||||||
|
if 'md5' in tc:
|
||||||
|
md5_for_file = _file_md5(tc_filename)
|
||||||
|
self.assertEqual(md5_for_file, tc['md5'])
|
||||||
info_json_fn = os.path.splitext(tc_filename)[0] + '.info.json'
|
info_json_fn = os.path.splitext(tc_filename)[0] + '.info.json'
|
||||||
self.assertTrue(os.path.exists(info_json_fn))
|
self.assertTrue(os.path.exists(info_json_fn))
|
||||||
if 'md5' in tc:
|
|
||||||
md5_for_file = _file_md5(tc_filename)
|
|
||||||
self.assertEqual(md5_for_file, tc['md5'])
|
|
||||||
with io.open(info_json_fn, encoding='utf-8') as infof:
|
with io.open(info_json_fn, encoding='utf-8') as infof:
|
||||||
info_dict = json.load(infof)
|
info_dict = json.load(infof)
|
||||||
|
|
||||||
expect_info_dict(self, tc.get('info_dict', {}), info_dict)
|
expect_info_dict(self, tc.get('info_dict', {}), info_dict)
|
||||||
finally:
|
finally:
|
||||||
try_rm_tcs_files()
|
try_rm_tcs_files()
|
||||||
|
if is_playlist and res_dict is not None:
|
||||||
|
# Remove all other files that may have been extracted if the
|
||||||
|
# extractor returns full results even with extract_flat
|
||||||
|
res_tcs = [{'info_dict': e} for e in res_dict['entries']]
|
||||||
|
try_rm_tcs_files(res_tcs)
|
||||||
|
|
||||||
return test_template
|
return test_template
|
||||||
|
|
||||||
|
|||||||
@@ -1,319 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
# Allow direct execution
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import unittest
|
|
||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
||||||
|
|
||||||
from test.helper import (
|
|
||||||
expect_info_dict,
|
|
||||||
FakeYDL,
|
|
||||||
)
|
|
||||||
|
|
||||||
from youtube_dl.extractor import (
|
|
||||||
AcademicEarthCourseIE,
|
|
||||||
DailymotionPlaylistIE,
|
|
||||||
DailymotionUserIE,
|
|
||||||
VimeoChannelIE,
|
|
||||||
VimeoUserIE,
|
|
||||||
VimeoAlbumIE,
|
|
||||||
VimeoGroupsIE,
|
|
||||||
UstreamChannelIE,
|
|
||||||
SoundcloudSetIE,
|
|
||||||
SoundcloudUserIE,
|
|
||||||
LivestreamIE,
|
|
||||||
NHLVideocenterIE,
|
|
||||||
BambuserChannelIE,
|
|
||||||
BandcampAlbumIE,
|
|
||||||
SmotriCommunityIE,
|
|
||||||
SmotriUserIE,
|
|
||||||
IviCompilationIE,
|
|
||||||
ImdbListIE,
|
|
||||||
KhanAcademyIE,
|
|
||||||
EveryonesMixtapeIE,
|
|
||||||
RutubeChannelIE,
|
|
||||||
GoogleSearchIE,
|
|
||||||
GenericIE,
|
|
||||||
TEDIE,
|
|
||||||
ToypicsUserIE,
|
|
||||||
XTubeUserIE,
|
|
||||||
InstagramUserIE,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TestPlaylists(unittest.TestCase):
|
|
||||||
def assertIsPlaylist(self, info):
|
|
||||||
"""Make sure the info has '_type' set to 'playlist'"""
|
|
||||||
self.assertEqual(info['_type'], 'playlist')
|
|
||||||
|
|
||||||
def test_dailymotion_playlist(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = DailymotionPlaylistIE(dl)
|
|
||||||
result = ie.extract('http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['title'], 'SPORT')
|
|
||||||
self.assertTrue(len(result['entries']) > 20)
|
|
||||||
|
|
||||||
def test_dailymotion_user(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = DailymotionUserIE(dl)
|
|
||||||
result = ie.extract('https://www.dailymotion.com/user/nqtv')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['title'], 'Rémi Gaillard')
|
|
||||||
self.assertTrue(len(result['entries']) >= 100)
|
|
||||||
|
|
||||||
def test_vimeo_channel(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = VimeoChannelIE(dl)
|
|
||||||
result = ie.extract('http://vimeo.com/channels/tributes')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['title'], 'Vimeo Tributes')
|
|
||||||
self.assertTrue(len(result['entries']) > 24)
|
|
||||||
|
|
||||||
def test_vimeo_user(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = VimeoUserIE(dl)
|
|
||||||
result = ie.extract('http://vimeo.com/nkistudio/videos')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['title'], 'Nki')
|
|
||||||
self.assertTrue(len(result['entries']) > 65)
|
|
||||||
|
|
||||||
def test_vimeo_album(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = VimeoAlbumIE(dl)
|
|
||||||
result = ie.extract('http://vimeo.com/album/2632481')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['title'], 'Staff Favorites: November 2013')
|
|
||||||
self.assertTrue(len(result['entries']) > 12)
|
|
||||||
|
|
||||||
def test_vimeo_groups(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = VimeoGroupsIE(dl)
|
|
||||||
result = ie.extract('http://vimeo.com/groups/rolexawards')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['title'], 'Rolex Awards for Enterprise')
|
|
||||||
self.assertTrue(len(result['entries']) > 72)
|
|
||||||
|
|
||||||
def test_ustream_channel(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = UstreamChannelIE(dl)
|
|
||||||
result = ie.extract('http://www.ustream.tv/channel/young-americans-for-liberty')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], '5124905')
|
|
||||||
self.assertTrue(len(result['entries']) >= 6)
|
|
||||||
|
|
||||||
def test_soundcloud_set(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = SoundcloudSetIE(dl)
|
|
||||||
result = ie.extract('https://soundcloud.com/the-concept-band/sets/the-royal-concept-ep')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['title'], 'The Royal Concept EP')
|
|
||||||
self.assertTrue(len(result['entries']) >= 6)
|
|
||||||
|
|
||||||
def test_soundcloud_user(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = SoundcloudUserIE(dl)
|
|
||||||
result = ie.extract('https://soundcloud.com/the-concept-band')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], '9615865')
|
|
||||||
self.assertTrue(len(result['entries']) >= 12)
|
|
||||||
|
|
||||||
def test_livestream_event(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = LivestreamIE(dl)
|
|
||||||
result = ie.extract('http://new.livestream.com/tedx/cityenglish')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['title'], 'TEDCity2.0 (English)')
|
|
||||||
self.assertTrue(len(result['entries']) >= 4)
|
|
||||||
|
|
||||||
def test_nhl_videocenter(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = NHLVideocenterIE(dl)
|
|
||||||
result = ie.extract('http://video.canucks.nhl.com/videocenter/console?catid=999')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], '999')
|
|
||||||
self.assertEqual(result['title'], 'Highlights')
|
|
||||||
self.assertEqual(len(result['entries']), 12)
|
|
||||||
|
|
||||||
def test_bambuser_channel(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = BambuserChannelIE(dl)
|
|
||||||
result = ie.extract('http://bambuser.com/channel/pixelversity')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['title'], 'pixelversity')
|
|
||||||
self.assertTrue(len(result['entries']) >= 60)
|
|
||||||
|
|
||||||
def test_bandcamp_album(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = BandcampAlbumIE(dl)
|
|
||||||
result = ie.extract('http://mpallante.bandcamp.com/album/nightmare-night-ep')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['title'], 'Nightmare Night EP')
|
|
||||||
self.assertTrue(len(result['entries']) >= 4)
|
|
||||||
|
|
||||||
def test_smotri_community(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = SmotriCommunityIE(dl)
|
|
||||||
result = ie.extract('http://smotri.com/community/video/kommuna')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'kommuna')
|
|
||||||
self.assertEqual(result['title'], 'КПРФ')
|
|
||||||
self.assertTrue(len(result['entries']) >= 4)
|
|
||||||
|
|
||||||
def test_smotri_user(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = SmotriUserIE(dl)
|
|
||||||
result = ie.extract('http://smotri.com/user/inspector')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'inspector')
|
|
||||||
self.assertEqual(result['title'], 'Inspector')
|
|
||||||
self.assertTrue(len(result['entries']) >= 9)
|
|
||||||
|
|
||||||
def test_AcademicEarthCourse(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = AcademicEarthCourseIE(dl)
|
|
||||||
result = ie.extract('http://academicearth.org/playlists/laws-of-nature/')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'laws-of-nature')
|
|
||||||
self.assertEqual(result['title'], 'Laws of Nature')
|
|
||||||
self.assertEqual(result['description'],u'Introduce yourself to the laws of nature with these free online college lectures from Yale, Harvard, and MIT.')# u"Today's websites are increasingly dynamic. Pages are no longer static HTML files but instead generated by scripts and database calls. User interfaces are more seamless, with technologies like Ajax replacing traditional page reloads. This course teaches students how to build dynamic websites with Ajax and with Linux, Apache, MySQL, and PHP (LAMP), one of today's most popular frameworks. Students learn how to set up domain names with DNS, how to structure pages with XHTML and CSS, how to program in JavaScript and PHP, how to configure Apache and MySQL, how to design and query databases with SQL, how to use Ajax with both XML and JSON, and how to build mashups. The course explores issues of security, scalability, and cross-browser support and also discusses enterprise-level deployments of websites, including third-party hosting, virtualization, colocation in data centers, firewalling, and load-balancing.")
|
|
||||||
self.assertEqual(len(result['entries']), 4)
|
|
||||||
|
|
||||||
def test_ivi_compilation(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = IviCompilationIE(dl)
|
|
||||||
result = ie.extract('http://www.ivi.ru/watch/dezhurnyi_angel')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'dezhurnyi_angel')
|
|
||||||
self.assertEqual(result['title'], 'Дежурный ангел (2010 - 2012)')
|
|
||||||
self.assertTrue(len(result['entries']) >= 36)
|
|
||||||
|
|
||||||
def test_ivi_compilation_season(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = IviCompilationIE(dl)
|
|
||||||
result = ie.extract('http://www.ivi.ru/watch/dezhurnyi_angel/season2')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'dezhurnyi_angel/season2')
|
|
||||||
self.assertEqual(result['title'], 'Дежурный ангел (2010 - 2012) 2 сезон')
|
|
||||||
self.assertTrue(len(result['entries']) >= 20)
|
|
||||||
|
|
||||||
def test_imdb_list(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = ImdbListIE(dl)
|
|
||||||
result = ie.extract('http://www.imdb.com/list/JFs9NWw6XI0')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'JFs9NWw6XI0')
|
|
||||||
self.assertEqual(result['title'], 'March 23, 2012 Releases')
|
|
||||||
self.assertEqual(len(result['entries']), 7)
|
|
||||||
|
|
||||||
def test_khanacademy_topic(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = KhanAcademyIE(dl)
|
|
||||||
result = ie.extract('https://www.khanacademy.org/math/applied-math/cryptography')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'cryptography')
|
|
||||||
self.assertEqual(result['title'], 'Journey into cryptography')
|
|
||||||
self.assertEqual(result['description'], 'How have humans protected their secret messages through history? What has changed today?')
|
|
||||||
self.assertTrue(len(result['entries']) >= 3)
|
|
||||||
|
|
||||||
def test_EveryonesMixtape(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = EveryonesMixtapeIE(dl)
|
|
||||||
result = ie.extract('http://everyonesmixtape.com/#/mix/m7m0jJAbMQi')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'm7m0jJAbMQi')
|
|
||||||
self.assertEqual(result['title'], 'Driving')
|
|
||||||
self.assertEqual(len(result['entries']), 24)
|
|
||||||
|
|
||||||
def test_rutube_channel(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = RutubeChannelIE(dl)
|
|
||||||
result = ie.extract('http://rutube.ru/tags/video/1409')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], '1409')
|
|
||||||
self.assertTrue(len(result['entries']) >= 34)
|
|
||||||
|
|
||||||
def test_multiple_brightcove_videos(self):
|
|
||||||
# https://github.com/rg3/youtube-dl/issues/2283
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = GenericIE(dl)
|
|
||||||
result = ie.extract('http://www.newyorker.com/online/blogs/newsdesk/2014/01/always-never-nuclear-command-and-control.html')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'always-never-nuclear-command-and-control')
|
|
||||||
self.assertEqual(result['title'], 'Always/Never: A Little-Seen Movie About Nuclear Command and Control : The New Yorker')
|
|
||||||
self.assertEqual(len(result['entries']), 3)
|
|
||||||
|
|
||||||
def test_GoogleSearch(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = GoogleSearchIE(dl)
|
|
||||||
result = ie.extract('gvsearch15:python language')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'python language')
|
|
||||||
self.assertEqual(result['title'], 'python language')
|
|
||||||
self.assertEqual(len(result['entries']), 15)
|
|
||||||
|
|
||||||
def test_generic_rss_feed(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = GenericIE(dl)
|
|
||||||
result = ie.extract('http://phihag.de/2014/youtube-dl/rss.xml')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'http://phihag.de/2014/youtube-dl/rss.xml')
|
|
||||||
self.assertEqual(result['title'], 'Zero Punctuation')
|
|
||||||
self.assertTrue(len(result['entries']) > 10)
|
|
||||||
|
|
||||||
def test_ted_playlist(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = TEDIE(dl)
|
|
||||||
result = ie.extract('http://www.ted.com/playlists/who_are_the_hackers')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], '10')
|
|
||||||
self.assertEqual(result['title'], 'Who are the hackers?')
|
|
||||||
self.assertTrue(len(result['entries']) >= 6)
|
|
||||||
|
|
||||||
def test_toypics_user(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = ToypicsUserIE(dl)
|
|
||||||
result = ie.extract('http://videos.toypics.net/Mikey')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'Mikey')
|
|
||||||
self.assertTrue(len(result['entries']) >= 17)
|
|
||||||
|
|
||||||
def test_xtube_user(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = XTubeUserIE(dl)
|
|
||||||
result = ie.extract('http://www.xtube.com/community/profile.php?user=greenshowers')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'greenshowers')
|
|
||||||
self.assertTrue(len(result['entries']) >= 155)
|
|
||||||
|
|
||||||
def test_InstagramUser(self):
|
|
||||||
dl = FakeYDL()
|
|
||||||
ie = InstagramUserIE(dl)
|
|
||||||
result = ie.extract('http://instagram.com/porsche')
|
|
||||||
self.assertIsPlaylist(result)
|
|
||||||
self.assertEqual(result['id'], 'porsche')
|
|
||||||
self.assertTrue(len(result['entries']) >= 2)
|
|
||||||
test_video = next(
|
|
||||||
e for e in result['entries']
|
|
||||||
if e['id'] == '614605558512799803_462752227')
|
|
||||||
dl.add_default_extra_info(test_video, ie, '(irrelevant URL)')
|
|
||||||
dl.process_video_result(test_video, download=False)
|
|
||||||
EXPECTED = {
|
|
||||||
'id': '614605558512799803_462752227',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': '#Porsche Intelligent Performance.',
|
|
||||||
'thumbnail': 're:^https?://.*\.jpg',
|
|
||||||
'uploader': 'Porsche',
|
|
||||||
'uploader_id': 'porsche',
|
|
||||||
'timestamp': 1387486713,
|
|
||||||
'upload_date': '20131219',
|
|
||||||
}
|
|
||||||
expect_info_dict(self, EXPECTED, test_video)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
||||||
@@ -87,7 +87,7 @@ class TestYoutubeSubtitles(BaseTestSubtitles):
|
|||||||
|
|
||||||
def test_youtube_nosubtitles(self):
|
def test_youtube_nosubtitles(self):
|
||||||
self.DL.expect_warning(u'video doesn\'t have subtitles')
|
self.DL.expect_warning(u'video doesn\'t have subtitles')
|
||||||
self.url = 'sAjKT8FhjI8'
|
self.url = 'n5BB19UTcdA'
|
||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
self.DL.params['allsubtitles'] = True
|
self.DL.params['allsubtitles'] = True
|
||||||
subtitles = self.getSubtitles()
|
subtitles = self.getSubtitles()
|
||||||
@@ -181,7 +181,7 @@ class TestTedSubtitles(BaseTestSubtitles):
|
|||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
self.DL.params['allsubtitles'] = True
|
self.DL.params['allsubtitles'] = True
|
||||||
subtitles = self.getSubtitles()
|
subtitles = self.getSubtitles()
|
||||||
self.assertEqual(len(subtitles.keys()), 28)
|
self.assertTrue(len(subtitles.keys()) >= 28)
|
||||||
|
|
||||||
def test_list_subtitles(self):
|
def test_list_subtitles(self):
|
||||||
self.DL.expect_warning(u'Automatic Captions not supported by this server')
|
self.DL.expect_warning(u'Automatic Captions not supported by this server')
|
||||||
|
|||||||
77
test/test_swfinterp.py
Normal file
77
test/test_swfinterp.py
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
# Allow direct execution
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
|
|
||||||
|
import errno
|
||||||
|
import io
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from youtube_dl.swfinterp import SWFInterpreter
|
||||||
|
|
||||||
|
|
||||||
|
TEST_DIR = os.path.join(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)), 'swftests')
|
||||||
|
|
||||||
|
|
||||||
|
class TestSWFInterpreter(unittest.TestCase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def _make_testfunc(testfile):
|
||||||
|
m = re.match(r'^(.*)\.(as)$', testfile)
|
||||||
|
if not m:
|
||||||
|
return
|
||||||
|
test_id = m.group(1)
|
||||||
|
|
||||||
|
def test_func(self):
|
||||||
|
as_file = os.path.join(TEST_DIR, testfile)
|
||||||
|
swf_file = os.path.join(TEST_DIR, test_id + '.swf')
|
||||||
|
if ((not os.path.exists(swf_file))
|
||||||
|
or os.path.getmtime(swf_file) < os.path.getmtime(as_file)):
|
||||||
|
# Recompile
|
||||||
|
try:
|
||||||
|
subprocess.check_call(['mxmlc', '-output', swf_file, as_file])
|
||||||
|
except OSError as ose:
|
||||||
|
if ose.errno == errno.ENOENT:
|
||||||
|
print('mxmlc not found! Skipping test.')
|
||||||
|
return
|
||||||
|
raise
|
||||||
|
|
||||||
|
with open(swf_file, 'rb') as swf_f:
|
||||||
|
swf_content = swf_f.read()
|
||||||
|
swfi = SWFInterpreter(swf_content)
|
||||||
|
|
||||||
|
with io.open(as_file, 'r', encoding='utf-8') as as_f:
|
||||||
|
as_content = as_f.read()
|
||||||
|
|
||||||
|
def _find_spec(key):
|
||||||
|
m = re.search(
|
||||||
|
r'(?m)^//\s*%s:\s*(.*?)\n' % re.escape(key), as_content)
|
||||||
|
if not m:
|
||||||
|
raise ValueError('Cannot find %s in %s' % (key, testfile))
|
||||||
|
return json.loads(m.group(1))
|
||||||
|
|
||||||
|
input_args = _find_spec('input')
|
||||||
|
output = _find_spec('output')
|
||||||
|
|
||||||
|
swf_class = swfi.extract_class(test_id)
|
||||||
|
func = swfi.extract_function(swf_class, 'main')
|
||||||
|
res = func(input_args)
|
||||||
|
self.assertEqual(res, output)
|
||||||
|
|
||||||
|
test_func.__name__ = str('test_swf_' + test_id)
|
||||||
|
setattr(TestSWFInterpreter, test_func.__name__, test_func)
|
||||||
|
|
||||||
|
|
||||||
|
for testfile in os.listdir(TEST_DIR):
|
||||||
|
_make_testfunc(testfile)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Allow direct execution
|
# Allow direct execution
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@@ -13,7 +15,6 @@ import io
|
|||||||
import json
|
import json
|
||||||
import xml.etree.ElementTree
|
import xml.etree.ElementTree
|
||||||
|
|
||||||
#from youtube_dl.utils import htmlentity_transform
|
|
||||||
from youtube_dl.utils import (
|
from youtube_dl.utils import (
|
||||||
DateRange,
|
DateRange,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
@@ -38,13 +39,9 @@ from youtube_dl.utils import (
|
|||||||
xpath_with_ns,
|
xpath_with_ns,
|
||||||
parse_iso8601,
|
parse_iso8601,
|
||||||
strip_jsonp,
|
strip_jsonp,
|
||||||
|
uppercase_escape,
|
||||||
)
|
)
|
||||||
|
|
||||||
if sys.version_info < (3, 0):
|
|
||||||
_compat_str = lambda b: b.decode('unicode-escape')
|
|
||||||
else:
|
|
||||||
_compat_str = lambda s: s
|
|
||||||
|
|
||||||
|
|
||||||
class TestUtil(unittest.TestCase):
|
class TestUtil(unittest.TestCase):
|
||||||
def test_timeconvert(self):
|
def test_timeconvert(self):
|
||||||
@@ -66,9 +63,9 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual('this - that', sanitize_filename('this: that'))
|
self.assertEqual('this - that', sanitize_filename('this: that'))
|
||||||
|
|
||||||
self.assertEqual(sanitize_filename('AT&T'), 'AT&T')
|
self.assertEqual(sanitize_filename('AT&T'), 'AT&T')
|
||||||
aumlaut = _compat_str('\xe4')
|
aumlaut = 'ä'
|
||||||
self.assertEqual(sanitize_filename(aumlaut), aumlaut)
|
self.assertEqual(sanitize_filename(aumlaut), aumlaut)
|
||||||
tests = _compat_str('\u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u0430')
|
tests = '\u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u0430'
|
||||||
self.assertEqual(sanitize_filename(tests), tests)
|
self.assertEqual(sanitize_filename(tests), tests)
|
||||||
|
|
||||||
forbidden = '"\0\\/'
|
forbidden = '"\0\\/'
|
||||||
@@ -90,9 +87,9 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual('yes_no', sanitize_filename('yes? no', restricted=True))
|
self.assertEqual('yes_no', sanitize_filename('yes? no', restricted=True))
|
||||||
self.assertEqual('this_-_that', sanitize_filename('this: that', restricted=True))
|
self.assertEqual('this_-_that', sanitize_filename('this: that', restricted=True))
|
||||||
|
|
||||||
tests = _compat_str('a\xe4b\u4e2d\u56fd\u7684c')
|
tests = 'a\xe4b\u4e2d\u56fd\u7684c'
|
||||||
self.assertEqual(sanitize_filename(tests, restricted=True), 'a_b_c')
|
self.assertEqual(sanitize_filename(tests, restricted=True), 'a_b_c')
|
||||||
self.assertTrue(sanitize_filename(_compat_str('\xf6'), restricted=True) != '') # No empty filename
|
self.assertTrue(sanitize_filename('\xf6', restricted=True) != '') # No empty filename
|
||||||
|
|
||||||
forbidden = '"\0\\/&!: \'\t\n()[]{}$;`^,#'
|
forbidden = '"\0\\/&!: \'\t\n()[]{}$;`^,#'
|
||||||
for fc in forbidden:
|
for fc in forbidden:
|
||||||
@@ -100,8 +97,8 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertTrue(fbc not in sanitize_filename(fc, restricted=True))
|
self.assertTrue(fbc not in sanitize_filename(fc, restricted=True))
|
||||||
|
|
||||||
# Handle a common case more neatly
|
# Handle a common case more neatly
|
||||||
self.assertEqual(sanitize_filename(_compat_str('\u5927\u58f0\u5e26 - Song'), restricted=True), 'Song')
|
self.assertEqual(sanitize_filename('\u5927\u58f0\u5e26 - Song', restricted=True), 'Song')
|
||||||
self.assertEqual(sanitize_filename(_compat_str('\u603b\u7edf: Speech'), restricted=True), 'Speech')
|
self.assertEqual(sanitize_filename('\u603b\u7edf: Speech', restricted=True), 'Speech')
|
||||||
# .. but make sure the file name is never empty
|
# .. but make sure the file name is never empty
|
||||||
self.assertTrue(sanitize_filename('-', restricted=True) != '')
|
self.assertTrue(sanitize_filename('-', restricted=True) != '')
|
||||||
self.assertTrue(sanitize_filename(':', restricted=True) != '')
|
self.assertTrue(sanitize_filename(':', restricted=True) != '')
|
||||||
@@ -119,7 +116,9 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual(orderedSet([135, 1, 1, 1]), [135, 1])
|
self.assertEqual(orderedSet([135, 1, 1, 1]), [135, 1])
|
||||||
|
|
||||||
def test_unescape_html(self):
|
def test_unescape_html(self):
|
||||||
self.assertEqual(unescapeHTML(_compat_str('%20;')), _compat_str('%20;'))
|
self.assertEqual(unescapeHTML('%20;'), '%20;')
|
||||||
|
self.assertEqual(
|
||||||
|
unescapeHTML('é'), 'é')
|
||||||
|
|
||||||
def test_daterange(self):
|
def test_daterange(self):
|
||||||
_20century = DateRange("19000101","20000101")
|
_20century = DateRange("19000101","20000101")
|
||||||
@@ -137,7 +136,7 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual(unified_strdate('1968-12-10'), '19681210')
|
self.assertEqual(unified_strdate('1968-12-10'), '19681210')
|
||||||
|
|
||||||
def test_find_xpath_attr(self):
|
def test_find_xpath_attr(self):
|
||||||
testxml = u'''<root>
|
testxml = '''<root>
|
||||||
<node/>
|
<node/>
|
||||||
<node x="a"/>
|
<node x="a"/>
|
||||||
<node x="a" y="c" />
|
<node x="a" y="c" />
|
||||||
@@ -150,18 +149,18 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual(find_xpath_attr(doc, './/node', 'y', 'c'), doc[2])
|
self.assertEqual(find_xpath_attr(doc, './/node', 'y', 'c'), doc[2])
|
||||||
|
|
||||||
def test_meta_parser(self):
|
def test_meta_parser(self):
|
||||||
testhtml = u'''
|
testhtml = '''
|
||||||
<head>
|
<head>
|
||||||
<meta name="description" content="foo & bar">
|
<meta name="description" content="foo & bar">
|
||||||
<meta content='Plato' name='author'/>
|
<meta content='Plato' name='author'/>
|
||||||
</head>
|
</head>
|
||||||
'''
|
'''
|
||||||
get_meta = lambda name: get_meta_content(name, testhtml)
|
get_meta = lambda name: get_meta_content(name, testhtml)
|
||||||
self.assertEqual(get_meta('description'), u'foo & bar')
|
self.assertEqual(get_meta('description'), 'foo & bar')
|
||||||
self.assertEqual(get_meta('author'), 'Plato')
|
self.assertEqual(get_meta('author'), 'Plato')
|
||||||
|
|
||||||
def test_xpath_with_ns(self):
|
def test_xpath_with_ns(self):
|
||||||
testxml = u'''<root xmlns:media="http://example.com/">
|
testxml = '''<root xmlns:media="http://example.com/">
|
||||||
<media:song>
|
<media:song>
|
||||||
<media:author>The Author</media:author>
|
<media:author>The Author</media:author>
|
||||||
<url>http://server.com/download.mp3</url>
|
<url>http://server.com/download.mp3</url>
|
||||||
@@ -170,8 +169,8 @@ class TestUtil(unittest.TestCase):
|
|||||||
doc = xml.etree.ElementTree.fromstring(testxml)
|
doc = xml.etree.ElementTree.fromstring(testxml)
|
||||||
find = lambda p: doc.find(xpath_with_ns(p, {'media': 'http://example.com/'}))
|
find = lambda p: doc.find(xpath_with_ns(p, {'media': 'http://example.com/'}))
|
||||||
self.assertTrue(find('media:song') is not None)
|
self.assertTrue(find('media:song') is not None)
|
||||||
self.assertEqual(find('media:song/media:author').text, u'The Author')
|
self.assertEqual(find('media:song/media:author').text, 'The Author')
|
||||||
self.assertEqual(find('media:song/url').text, u'http://server.com/download.mp3')
|
self.assertEqual(find('media:song/url').text, 'http://server.com/download.mp3')
|
||||||
|
|
||||||
def test_smuggle_url(self):
|
def test_smuggle_url(self):
|
||||||
data = {u"ö": u"ö", u"abc": [3]}
|
data = {u"ö": u"ö", u"abc": [3]}
|
||||||
@@ -186,22 +185,22 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual(res_data, None)
|
self.assertEqual(res_data, None)
|
||||||
|
|
||||||
def test_shell_quote(self):
|
def test_shell_quote(self):
|
||||||
args = ['ffmpeg', '-i', encodeFilename(u'ñ€ß\'.mp4')]
|
args = ['ffmpeg', '-i', encodeFilename('ñ€ß\'.mp4')]
|
||||||
self.assertEqual(shell_quote(args), u"""ffmpeg -i 'ñ€ß'"'"'.mp4'""")
|
self.assertEqual(shell_quote(args), """ffmpeg -i 'ñ€ß'"'"'.mp4'""")
|
||||||
|
|
||||||
def test_str_to_int(self):
|
def test_str_to_int(self):
|
||||||
self.assertEqual(str_to_int('123,456'), 123456)
|
self.assertEqual(str_to_int('123,456'), 123456)
|
||||||
self.assertEqual(str_to_int('123.456'), 123456)
|
self.assertEqual(str_to_int('123.456'), 123456)
|
||||||
|
|
||||||
def test_url_basename(self):
|
def test_url_basename(self):
|
||||||
self.assertEqual(url_basename(u'http://foo.de/'), u'')
|
self.assertEqual(url_basename('http://foo.de/'), '')
|
||||||
self.assertEqual(url_basename(u'http://foo.de/bar/baz'), u'baz')
|
self.assertEqual(url_basename('http://foo.de/bar/baz'), 'baz')
|
||||||
self.assertEqual(url_basename(u'http://foo.de/bar/baz?x=y'), u'baz')
|
self.assertEqual(url_basename('http://foo.de/bar/baz?x=y'), 'baz')
|
||||||
self.assertEqual(url_basename(u'http://foo.de/bar/baz#x=y'), u'baz')
|
self.assertEqual(url_basename('http://foo.de/bar/baz#x=y'), 'baz')
|
||||||
self.assertEqual(url_basename(u'http://foo.de/bar/baz/'), u'baz')
|
self.assertEqual(url_basename('http://foo.de/bar/baz/'), 'baz')
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
url_basename(u'http://media.w3.org/2010/05/sintel/trailer.mp4'),
|
url_basename('http://media.w3.org/2010/05/sintel/trailer.mp4'),
|
||||||
u'trailer.mp4')
|
'trailer.mp4')
|
||||||
|
|
||||||
def test_parse_duration(self):
|
def test_parse_duration(self):
|
||||||
self.assertEqual(parse_duration(None), None)
|
self.assertEqual(parse_duration(None), None)
|
||||||
@@ -212,12 +211,16 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual(parse_duration('00:01:01'), 61)
|
self.assertEqual(parse_duration('00:01:01'), 61)
|
||||||
self.assertEqual(parse_duration('x:y'), None)
|
self.assertEqual(parse_duration('x:y'), None)
|
||||||
self.assertEqual(parse_duration('3h11m53s'), 11513)
|
self.assertEqual(parse_duration('3h11m53s'), 11513)
|
||||||
|
self.assertEqual(parse_duration('3h 11m 53s'), 11513)
|
||||||
|
self.assertEqual(parse_duration('3 hours 11 minutes 53 seconds'), 11513)
|
||||||
|
self.assertEqual(parse_duration('3 hours 11 mins 53 secs'), 11513)
|
||||||
self.assertEqual(parse_duration('62m45s'), 3765)
|
self.assertEqual(parse_duration('62m45s'), 3765)
|
||||||
self.assertEqual(parse_duration('6m59s'), 419)
|
self.assertEqual(parse_duration('6m59s'), 419)
|
||||||
self.assertEqual(parse_duration('49s'), 49)
|
self.assertEqual(parse_duration('49s'), 49)
|
||||||
self.assertEqual(parse_duration('0h0m0s'), 0)
|
self.assertEqual(parse_duration('0h0m0s'), 0)
|
||||||
self.assertEqual(parse_duration('0m0s'), 0)
|
self.assertEqual(parse_duration('0m0s'), 0)
|
||||||
self.assertEqual(parse_duration('0s'), 0)
|
self.assertEqual(parse_duration('0s'), 0)
|
||||||
|
self.assertEqual(parse_duration('01:02:03.05'), 3723.05)
|
||||||
|
|
||||||
def test_fix_xml_ampersands(self):
|
def test_fix_xml_ampersands(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@@ -254,16 +257,16 @@ class TestUtil(unittest.TestCase):
|
|||||||
testPL(5, 2, (20, 99), [])
|
testPL(5, 2, (20, 99), [])
|
||||||
|
|
||||||
def test_struct_unpack(self):
|
def test_struct_unpack(self):
|
||||||
self.assertEqual(struct_unpack(u'!B', b'\x00'), (0,))
|
self.assertEqual(struct_unpack('!B', b'\x00'), (0,))
|
||||||
|
|
||||||
def test_read_batch_urls(self):
|
def test_read_batch_urls(self):
|
||||||
f = io.StringIO(u'''\xef\xbb\xbf foo
|
f = io.StringIO('''\xef\xbb\xbf foo
|
||||||
bar\r
|
bar\r
|
||||||
baz
|
baz
|
||||||
# More after this line\r
|
# More after this line\r
|
||||||
; or after this
|
; or after this
|
||||||
bam''')
|
bam''')
|
||||||
self.assertEqual(read_batch_urls(f), [u'foo', u'bar', u'baz', u'bam'])
|
self.assertEqual(read_batch_urls(f), ['foo', 'bar', 'baz', 'bam'])
|
||||||
|
|
||||||
def test_urlencode_postdata(self):
|
def test_urlencode_postdata(self):
|
||||||
data = urlencode_postdata({'username': 'foo@bar.com', 'password': '1234'})
|
data = urlencode_postdata({'username': 'foo@bar.com', 'password': '1234'})
|
||||||
@@ -279,6 +282,9 @@ class TestUtil(unittest.TestCase):
|
|||||||
d = json.loads(stripped)
|
d = json.loads(stripped)
|
||||||
self.assertEqual(d, [{"id": "532cb", "x": 3}])
|
self.assertEqual(d, [{"id": "532cb", "x": 3}])
|
||||||
|
|
||||||
|
def test_uppercase_escape(self):
|
||||||
|
self.assertEqual(uppercase_escape('aä'), 'aä')
|
||||||
|
self.assertEqual(uppercase_escape('\\U0001d550'), '𝕐')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -112,11 +112,11 @@ class TestYoutubeLists(unittest.TestCase):
|
|||||||
def test_youtube_mix(self):
|
def test_youtube_mix(self):
|
||||||
dl = FakeYDL()
|
dl = FakeYDL()
|
||||||
ie = YoutubePlaylistIE(dl)
|
ie = YoutubePlaylistIE(dl)
|
||||||
result = ie.extract('http://www.youtube.com/watch?v=lLJf9qJHR3E&list=RDrjFaenf1T-Y')
|
result = ie.extract('https://www.youtube.com/watch?v=W01L70IGBgE&index=2&list=RDOQpdSVF_k_w')
|
||||||
entries = result['entries']
|
entries = result['entries']
|
||||||
self.assertTrue(len(entries) >= 20)
|
self.assertTrue(len(entries) >= 20)
|
||||||
original_video = entries[0]
|
original_video = entries[0]
|
||||||
self.assertEqual(original_video['id'], 'rjFaenf1T-Y')
|
self.assertEqual(original_video['id'], 'OQpdSVF_k_w')
|
||||||
|
|
||||||
def test_youtube_toptracks(self):
|
def test_youtube_toptracks(self):
|
||||||
print('Skipping: The playlist page gives error 500')
|
print('Skipping: The playlist page gives error 500')
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Allow direct execution
|
# Allow direct execution
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@@ -16,23 +18,65 @@ from youtube_dl.utils import compat_str, compat_urlretrieve
|
|||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
(
|
(
|
||||||
u'https://s.ytimg.com/yts/jsbin/html5player-vflHOr_nV.js',
|
'https://s.ytimg.com/yts/jsbin/html5player-vflHOr_nV.js',
|
||||||
u'js',
|
'js',
|
||||||
86,
|
86,
|
||||||
u'>=<;:/.-[+*)(\'&%$#"!ZYX0VUTSRQPONMLKJIHGFEDCBA\\yxwvutsrqponmlkjihgfedcba987654321',
|
'>=<;:/.-[+*)(\'&%$#"!ZYX0VUTSRQPONMLKJIHGFEDCBA\\yxwvutsrqponmlkjihgfedcba987654321',
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
u'https://s.ytimg.com/yts/jsbin/html5player-vfldJ8xgI.js',
|
'https://s.ytimg.com/yts/jsbin/html5player-vfldJ8xgI.js',
|
||||||
u'js',
|
'js',
|
||||||
85,
|
85,
|
||||||
u'3456789a0cdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS[UVWXYZ!"#$%&\'()*+,-./:;<=>?@',
|
'3456789a0cdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS[UVWXYZ!"#$%&\'()*+,-./:;<=>?@',
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
u'https://s.ytimg.com/yts/jsbin/html5player-vfle-mVwz.js',
|
'https://s.ytimg.com/yts/jsbin/html5player-vfle-mVwz.js',
|
||||||
u'js',
|
'js',
|
||||||
90,
|
90,
|
||||||
u']\\[@?>=<;:/.-,+*)(\'&%$#"hZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjiagfedcb39876',
|
']\\[@?>=<;:/.-,+*)(\'&%$#"hZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjiagfedcb39876',
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
'https://s.ytimg.com/yts/jsbin/html5player-en_US-vfl0Cbn9e.js',
|
||||||
|
'js',
|
||||||
|
84,
|
||||||
|
'O1I3456789abcde0ghijklmnopqrstuvwxyzABCDEFGHfJKLMN2PQRSTUVW@YZ!"#$%&\'()*+,-./:;<=',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://s.ytimg.com/yts/jsbin/html5player-en_US-vflXGBaUN.js',
|
||||||
|
'js',
|
||||||
|
'2ACFC7A61CA478CD21425E5A57EBD73DDC78E22A.2094302436B2D377D14A3BBA23022D023B8BC25AA',
|
||||||
|
'A52CB8B320D22032ABB3A41D773D2B6342034902.A22E87CDD37DBE75A5E52412DC874AC16A7CFCA2',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'http://s.ytimg.com/yts/swfbin/player-vfl5vIhK2/watch_as3.swf',
|
||||||
|
'swf',
|
||||||
|
86,
|
||||||
|
'O1I3456789abcde0ghijklmnopqrstuvwxyzABCDEFGHfJKLMN2PQRSTUVWXY\\!"#$%&\'()*+,-./:;<=>?'
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'http://s.ytimg.com/yts/swfbin/player-vflmDyk47/watch_as3.swf',
|
||||||
|
'swf',
|
||||||
|
'F375F75BF2AFDAAF2666E43868D46816F83F13E81C46.3725A8218E446A0DECD33F79DC282994D6AA92C92C9',
|
||||||
|
'9C29AA6D499282CD97F33DCED0A644E8128A5273.64C18E31F38361864D86834E6662FAADFA2FB57F'
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://s.ytimg.com/yts/jsbin/html5player-en_US-vflBb0OQx.js',
|
||||||
|
'js',
|
||||||
|
84,
|
||||||
|
'123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ0STUVWXYZ!"#$%&\'()*+,@./:;<=>'
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://s.ytimg.com/yts/jsbin/html5player-en_US-vfl9FYC6l.js',
|
||||||
|
'js',
|
||||||
|
83,
|
||||||
|
'123456789abcdefghijklmnopqr0tuvwxyzABCDETGHIJKLMNOPQRS>UVWXYZ!"#$%&\'()*+,-./:;<=F'
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://s.ytimg.com/yts/jsbin/html5player-en_US-vflCGk6yw/html5player.js',
|
||||||
|
'js',
|
||||||
|
'4646B5181C6C3020DF1D9C7FCFEA.AD80ABF70C39BD369CCCAE780AFBB98FA6B6CB42766249D9488C288',
|
||||||
|
'82C8849D94266724DC6B6AF89BBFA087EACCD963.B93C07FBA084ACAEFCF7C9D1FD0203C6C1815B6B'
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -44,13 +88,13 @@ class TestSignature(unittest.TestCase):
|
|||||||
os.mkdir(self.TESTDATA_DIR)
|
os.mkdir(self.TESTDATA_DIR)
|
||||||
|
|
||||||
|
|
||||||
def make_tfunc(url, stype, sig_length, expected_sig):
|
def make_tfunc(url, stype, sig_input, expected_sig):
|
||||||
basename = url.rpartition('/')[2]
|
m = re.match(r'.*-([a-zA-Z0-9_-]+)(?:/watch_as3|/html5player)?\.[a-z]+$', url)
|
||||||
m = re.match(r'.*-([a-zA-Z0-9_-]+)\.[a-z]+$', basename)
|
assert m, '%r should follow URL format' % url
|
||||||
assert m, '%r should follow URL format' % basename
|
|
||||||
test_id = m.group(1)
|
test_id = m.group(1)
|
||||||
|
|
||||||
def test_func(self):
|
def test_func(self):
|
||||||
|
basename = 'player-%s.%s' % (test_id, stype)
|
||||||
fn = os.path.join(self.TESTDATA_DIR, basename)
|
fn = os.path.join(self.TESTDATA_DIR, basename)
|
||||||
|
|
||||||
if not os.path.exists(fn):
|
if not os.path.exists(fn):
|
||||||
@@ -66,7 +110,9 @@ def make_tfunc(url, stype, sig_length, expected_sig):
|
|||||||
with open(fn, 'rb') as testf:
|
with open(fn, 'rb') as testf:
|
||||||
swfcode = testf.read()
|
swfcode = testf.read()
|
||||||
func = ie._parse_sig_swf(swfcode)
|
func = ie._parse_sig_swf(swfcode)
|
||||||
src_sig = compat_str(string.printable[:sig_length])
|
src_sig = (
|
||||||
|
compat_str(string.printable[:sig_input])
|
||||||
|
if isinstance(sig_input, int) else sig_input)
|
||||||
got_sig = func(src_sig)
|
got_sig = func(src_sig)
|
||||||
self.assertEqual(got_sig, expected_sig)
|
self.assertEqual(got_sig, expected_sig)
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
# Legacy file for backwards compatibility, use youtube_dl.downloader instead!
|
|
||||||
from .downloader import FileDownloader as RealFileDownloader
|
|
||||||
from .downloader import get_suitable_downloader
|
|
||||||
|
|
||||||
|
|
||||||
# This class reproduces the old behaviour of FileDownloader
|
|
||||||
class FileDownloader(RealFileDownloader):
|
|
||||||
def _do_download(self, filename, info_dict):
|
|
||||||
real_fd = get_suitable_downloader(info_dict)(self.ydl, self.params)
|
|
||||||
for ph in self._progress_hooks:
|
|
||||||
real_fd.add_progress_hook(ph)
|
|
||||||
return real_fd.download(filename, info_dict)
|
|
||||||
193
youtube_dl/YoutubeDL.py
Normal file → Executable file
193
youtube_dl/YoutubeDL.py
Normal file → Executable file
@@ -31,6 +31,7 @@ from .utils import (
|
|||||||
ContentTooShortError,
|
ContentTooShortError,
|
||||||
date_from_str,
|
date_from_str,
|
||||||
DateRange,
|
DateRange,
|
||||||
|
DEFAULT_OUTTMPL,
|
||||||
determine_ext,
|
determine_ext,
|
||||||
DownloadError,
|
DownloadError,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
@@ -161,6 +162,7 @@ class YoutubeDL(object):
|
|||||||
default_search: Prepend this string if an input url is not valid.
|
default_search: Prepend this string if an input url is not valid.
|
||||||
'auto' for elaborate guessing
|
'auto' for elaborate guessing
|
||||||
encoding: Use this encoding instead of the system-specified.
|
encoding: Use this encoding instead of the system-specified.
|
||||||
|
extract_flat: Do not resolve URLs, return the immediate result.
|
||||||
|
|
||||||
The following parameters are not used by YoutubeDL itself, they are used by
|
The following parameters are not used by YoutubeDL itself, they are used by
|
||||||
the FileDownloader:
|
the FileDownloader:
|
||||||
@@ -170,6 +172,7 @@ class YoutubeDL(object):
|
|||||||
The following options are used by the post processors:
|
The following options are used by the post processors:
|
||||||
prefer_ffmpeg: If True, use ffmpeg instead of avconv if both are available,
|
prefer_ffmpeg: If True, use ffmpeg instead of avconv if both are available,
|
||||||
otherwise prefer avconv.
|
otherwise prefer avconv.
|
||||||
|
exec_cmd: Arbitrary command to run after downloading
|
||||||
"""
|
"""
|
||||||
|
|
||||||
params = None
|
params = None
|
||||||
@@ -274,7 +277,7 @@ class YoutubeDL(object):
|
|||||||
return message
|
return message
|
||||||
|
|
||||||
assert hasattr(self, '_output_process')
|
assert hasattr(self, '_output_process')
|
||||||
assert type(message) == type('')
|
assert isinstance(message, compat_str)
|
||||||
line_count = message.count('\n') + 1
|
line_count = message.count('\n') + 1
|
||||||
self._output_process.stdin.write((message + '\n').encode('utf-8'))
|
self._output_process.stdin.write((message + '\n').encode('utf-8'))
|
||||||
self._output_process.stdin.flush()
|
self._output_process.stdin.flush()
|
||||||
@@ -286,6 +289,9 @@ class YoutubeDL(object):
|
|||||||
"""Print message to stdout if not in quiet mode."""
|
"""Print message to stdout if not in quiet mode."""
|
||||||
return self.to_stdout(message, skip_eol, check_quiet=True)
|
return self.to_stdout(message, skip_eol, check_quiet=True)
|
||||||
|
|
||||||
|
def _write_string(self, s, out=None):
|
||||||
|
write_string(s, out=out, encoding=self.params.get('encoding'))
|
||||||
|
|
||||||
def to_stdout(self, message, skip_eol=False, check_quiet=False):
|
def to_stdout(self, message, skip_eol=False, check_quiet=False):
|
||||||
"""Print message to stdout if not in quiet mode."""
|
"""Print message to stdout if not in quiet mode."""
|
||||||
if self.params.get('logger'):
|
if self.params.get('logger'):
|
||||||
@@ -295,17 +301,17 @@ class YoutubeDL(object):
|
|||||||
terminator = ['\n', ''][skip_eol]
|
terminator = ['\n', ''][skip_eol]
|
||||||
output = message + terminator
|
output = message + terminator
|
||||||
|
|
||||||
write_string(output, self._screen_file)
|
self._write_string(output, self._screen_file)
|
||||||
|
|
||||||
def to_stderr(self, message):
|
def to_stderr(self, message):
|
||||||
"""Print message to stderr."""
|
"""Print message to stderr."""
|
||||||
assert type(message) == type('')
|
assert isinstance(message, compat_str)
|
||||||
if self.params.get('logger'):
|
if self.params.get('logger'):
|
||||||
self.params['logger'].error(message)
|
self.params['logger'].error(message)
|
||||||
else:
|
else:
|
||||||
message = self._bidi_workaround(message)
|
message = self._bidi_workaround(message)
|
||||||
output = message + '\n'
|
output = message + '\n'
|
||||||
write_string(output, self._err_file)
|
self._write_string(output, self._err_file)
|
||||||
|
|
||||||
def to_console_title(self, message):
|
def to_console_title(self, message):
|
||||||
if not self.params.get('consoletitle', False):
|
if not self.params.get('consoletitle', False):
|
||||||
@@ -315,21 +321,21 @@ class YoutubeDL(object):
|
|||||||
# already of type unicode()
|
# already of type unicode()
|
||||||
ctypes.windll.kernel32.SetConsoleTitleW(ctypes.c_wchar_p(message))
|
ctypes.windll.kernel32.SetConsoleTitleW(ctypes.c_wchar_p(message))
|
||||||
elif 'TERM' in os.environ:
|
elif 'TERM' in os.environ:
|
||||||
write_string('\033]0;%s\007' % message, self._screen_file)
|
self._write_string('\033]0;%s\007' % message, self._screen_file)
|
||||||
|
|
||||||
def save_console_title(self):
|
def save_console_title(self):
|
||||||
if not self.params.get('consoletitle', False):
|
if not self.params.get('consoletitle', False):
|
||||||
return
|
return
|
||||||
if 'TERM' in os.environ:
|
if 'TERM' in os.environ:
|
||||||
# Save the title on stack
|
# Save the title on stack
|
||||||
write_string('\033[22;0t', self._screen_file)
|
self._write_string('\033[22;0t', self._screen_file)
|
||||||
|
|
||||||
def restore_console_title(self):
|
def restore_console_title(self):
|
||||||
if not self.params.get('consoletitle', False):
|
if not self.params.get('consoletitle', False):
|
||||||
return
|
return
|
||||||
if 'TERM' in os.environ:
|
if 'TERM' in os.environ:
|
||||||
# Restore the title from stack
|
# Restore the title from stack
|
||||||
write_string('\033[23;0t', self._screen_file)
|
self._write_string('\033[23;0t', self._screen_file)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self.save_console_title()
|
self.save_console_title()
|
||||||
@@ -419,7 +425,7 @@ class YoutubeDL(object):
|
|||||||
autonumber_templ = '%0' + str(autonumber_size) + 'd'
|
autonumber_templ = '%0' + str(autonumber_size) + 'd'
|
||||||
template_dict['autonumber'] = autonumber_templ % self._num_downloads
|
template_dict['autonumber'] = autonumber_templ % self._num_downloads
|
||||||
if template_dict.get('playlist_index') is not None:
|
if template_dict.get('playlist_index') is not None:
|
||||||
template_dict['playlist_index'] = '%05d' % template_dict['playlist_index']
|
template_dict['playlist_index'] = '%0*d' % (len(str(template_dict['n_entries'])), template_dict['playlist_index'])
|
||||||
if template_dict.get('resolution') is None:
|
if template_dict.get('resolution') is None:
|
||||||
if template_dict.get('width') and template_dict.get('height'):
|
if template_dict.get('width') and template_dict.get('height'):
|
||||||
template_dict['resolution'] = '%dx%d' % (template_dict['width'], template_dict['height'])
|
template_dict['resolution'] = '%dx%d' % (template_dict['width'], template_dict['height'])
|
||||||
@@ -437,7 +443,8 @@ class YoutubeDL(object):
|
|||||||
if v is not None)
|
if v is not None)
|
||||||
template_dict = collections.defaultdict(lambda: 'NA', template_dict)
|
template_dict = collections.defaultdict(lambda: 'NA', template_dict)
|
||||||
|
|
||||||
tmpl = os.path.expanduser(self.params['outtmpl'])
|
outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)
|
||||||
|
tmpl = os.path.expanduser(outtmpl)
|
||||||
filename = tmpl % template_dict
|
filename = tmpl % template_dict
|
||||||
return filename
|
return filename
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
@@ -474,7 +481,10 @@ class YoutubeDL(object):
|
|||||||
return 'Skipping %s, because it has exceeded the maximum view count (%d/%d)' % (video_title, view_count, max_views)
|
return 'Skipping %s, because it has exceeded the maximum view count (%d/%d)' % (video_title, view_count, max_views)
|
||||||
age_limit = self.params.get('age_limit')
|
age_limit = self.params.get('age_limit')
|
||||||
if age_limit is not None:
|
if age_limit is not None:
|
||||||
if age_limit < info_dict.get('age_limit', 0):
|
actual_age_limit = info_dict.get('age_limit')
|
||||||
|
if actual_age_limit is None:
|
||||||
|
actual_age_limit = 0
|
||||||
|
if age_limit < actual_age_limit:
|
||||||
return 'Skipping "' + title + '" because it is age restricted'
|
return 'Skipping "' + title + '" because it is age restricted'
|
||||||
if self.in_download_archive(info_dict):
|
if self.in_download_archive(info_dict):
|
||||||
return '%s has already been recorded in archive' % video_title
|
return '%s has already been recorded in archive' % video_title
|
||||||
@@ -553,7 +563,12 @@ class YoutubeDL(object):
|
|||||||
Returns the resolved ie_result.
|
Returns the resolved ie_result.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
result_type = ie_result.get('_type', 'video') # If not given we suppose it's a video, support the default old system
|
result_type = ie_result.get('_type', 'video')
|
||||||
|
|
||||||
|
if self.params.get('extract_flat', False):
|
||||||
|
if result_type in ('url', 'url_transparent'):
|
||||||
|
return ie_result
|
||||||
|
|
||||||
if result_type == 'video':
|
if result_type == 'video':
|
||||||
self.add_extra_info(ie_result, extra_info)
|
self.add_extra_info(ie_result, extra_info)
|
||||||
return self.process_video_result(ie_result, download=download)
|
return self.process_video_result(ie_result, download=download)
|
||||||
@@ -622,6 +637,7 @@ class YoutubeDL(object):
|
|||||||
for i, entry in enumerate(entries, 1):
|
for i, entry in enumerate(entries, 1):
|
||||||
self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries))
|
self.to_screen('[download] Downloading video #%s of %s' % (i, n_entries))
|
||||||
extra = {
|
extra = {
|
||||||
|
'n_entries': n_entries,
|
||||||
'playlist': playlist,
|
'playlist': playlist,
|
||||||
'playlist_index': i + playliststart,
|
'playlist_index': i + playliststart,
|
||||||
'extractor': ie_result['extractor'],
|
'extractor': ie_result['extractor'],
|
||||||
@@ -702,11 +718,27 @@ class YoutubeDL(object):
|
|||||||
def process_video_result(self, info_dict, download=True):
|
def process_video_result(self, info_dict, download=True):
|
||||||
assert info_dict.get('_type', 'video') == 'video'
|
assert info_dict.get('_type', 'video') == 'video'
|
||||||
|
|
||||||
|
if 'id' not in info_dict:
|
||||||
|
raise ExtractorError('Missing "id" field in extractor result')
|
||||||
|
if 'title' not in info_dict:
|
||||||
|
raise ExtractorError('Missing "title" field in extractor result')
|
||||||
|
|
||||||
if 'playlist' not in info_dict:
|
if 'playlist' not in info_dict:
|
||||||
# It isn't part of a playlist
|
# It isn't part of a playlist
|
||||||
info_dict['playlist'] = None
|
info_dict['playlist'] = None
|
||||||
info_dict['playlist_index'] = None
|
info_dict['playlist_index'] = None
|
||||||
|
|
||||||
|
thumbnails = info_dict.get('thumbnails')
|
||||||
|
if thumbnails:
|
||||||
|
thumbnails.sort(key=lambda t: (
|
||||||
|
t.get('width'), t.get('height'), t.get('url')))
|
||||||
|
for t in thumbnails:
|
||||||
|
if 'width' in t and 'height' in t:
|
||||||
|
t['resolution'] = '%dx%d' % (t['width'], t['height'])
|
||||||
|
|
||||||
|
if thumbnails and 'thumbnail' not in info_dict:
|
||||||
|
info_dict['thumbnail'] = thumbnails[-1]['url']
|
||||||
|
|
||||||
if 'display_id' not in info_dict and 'id' in info_dict:
|
if 'display_id' not in info_dict and 'id' in info_dict:
|
||||||
info_dict['display_id'] = info_dict['id']
|
info_dict['display_id'] = info_dict['id']
|
||||||
|
|
||||||
@@ -733,6 +765,9 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
# We check that all the formats have the format and format_id fields
|
# We check that all the formats have the format and format_id fields
|
||||||
for i, format in enumerate(formats):
|
for i, format in enumerate(formats):
|
||||||
|
if 'url' not in format:
|
||||||
|
raise ExtractorError('Missing "url" key in result (index %d)' % i)
|
||||||
|
|
||||||
if format.get('format_id') is None:
|
if format.get('format_id') is None:
|
||||||
format['format_id'] = compat_str(i)
|
format['format_id'] = compat_str(i)
|
||||||
if format.get('format') is None:
|
if format.get('format') is None:
|
||||||
@@ -743,7 +778,7 @@ class YoutubeDL(object):
|
|||||||
)
|
)
|
||||||
# Automatically determine file extension if missing
|
# Automatically determine file extension if missing
|
||||||
if 'ext' not in format:
|
if 'ext' not in format:
|
||||||
format['ext'] = determine_ext(format['url'])
|
format['ext'] = determine_ext(format['url']).lower()
|
||||||
|
|
||||||
format_limit = self.params.get('format_limit', None)
|
format_limit = self.params.get('format_limit', None)
|
||||||
if format_limit:
|
if format_limit:
|
||||||
@@ -825,7 +860,7 @@ class YoutubeDL(object):
|
|||||||
# Keep for backwards compatibility
|
# Keep for backwards compatibility
|
||||||
info_dict['stitle'] = info_dict['title']
|
info_dict['stitle'] = info_dict['title']
|
||||||
|
|
||||||
if not 'format' in info_dict:
|
if 'format' not in info_dict:
|
||||||
info_dict['format'] = info_dict['ext']
|
info_dict['format'] = info_dict['ext']
|
||||||
|
|
||||||
reason = self._match_entry(info_dict)
|
reason = self._match_entry(info_dict)
|
||||||
@@ -868,7 +903,7 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
dn = os.path.dirname(encodeFilename(filename))
|
dn = os.path.dirname(encodeFilename(filename))
|
||||||
if dn != '' and not os.path.exists(dn):
|
if dn and not os.path.exists(dn):
|
||||||
os.makedirs(dn)
|
os.makedirs(dn)
|
||||||
except (OSError, IOError) as err:
|
except (OSError, IOError) as err:
|
||||||
self.report_error('unable to create directory ' + compat_str(err))
|
self.report_error('unable to create directory ' + compat_str(err))
|
||||||
@@ -925,7 +960,7 @@ class YoutubeDL(object):
|
|||||||
with io.open(encodeFilename(sub_filename), 'w', encoding='utf-8') as subfile:
|
with io.open(encodeFilename(sub_filename), 'w', encoding='utf-8') as subfile:
|
||||||
subfile.write(sub)
|
subfile.write(sub)
|
||||||
except (OSError, IOError):
|
except (OSError, IOError):
|
||||||
self.report_error('Cannot write subtitles file ' + descfn)
|
self.report_error('Cannot write subtitles file ' + sub_filename)
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.params.get('writeinfojson', False):
|
if self.params.get('writeinfojson', False):
|
||||||
@@ -969,11 +1004,13 @@ class YoutubeDL(object):
|
|||||||
fd = get_suitable_downloader(info)(self, self.params)
|
fd = get_suitable_downloader(info)(self, self.params)
|
||||||
for ph in self._progress_hooks:
|
for ph in self._progress_hooks:
|
||||||
fd.add_progress_hook(ph)
|
fd.add_progress_hook(ph)
|
||||||
|
if self.params.get('verbose'):
|
||||||
|
self.to_stdout('[debug] Invoking downloader on %r' % info.get('url'))
|
||||||
return fd.download(name, info)
|
return fd.download(name, info)
|
||||||
if info_dict.get('requested_formats') is not None:
|
if info_dict.get('requested_formats') is not None:
|
||||||
downloaded = []
|
downloaded = []
|
||||||
success = True
|
success = True
|
||||||
merger = FFmpegMergerPP(self)
|
merger = FFmpegMergerPP(self, not self.params.get('keepvideo'))
|
||||||
if not merger._get_executable():
|
if not merger._get_executable():
|
||||||
postprocessors = []
|
postprocessors = []
|
||||||
self.report_warning('You have requested multiple '
|
self.report_warning('You have requested multiple '
|
||||||
@@ -1014,10 +1051,11 @@ class YoutubeDL(object):
|
|||||||
|
|
||||||
def download(self, url_list):
|
def download(self, url_list):
|
||||||
"""Download a given list of URLs."""
|
"""Download a given list of URLs."""
|
||||||
|
outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)
|
||||||
if (len(url_list) > 1 and
|
if (len(url_list) > 1 and
|
||||||
'%' not in self.params['outtmpl']
|
'%' not in outtmpl
|
||||||
and self.params.get('max_downloads') != 1):
|
and self.params.get('max_downloads') != 1):
|
||||||
raise SameFileError(self.params['outtmpl'])
|
raise SameFileError(outtmpl)
|
||||||
|
|
||||||
for url in url_list:
|
for url in url_list:
|
||||||
try:
|
try:
|
||||||
@@ -1128,57 +1166,61 @@ class YoutubeDL(object):
|
|||||||
res = default
|
res = default
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def list_formats(self, info_dict):
|
def _format_note(self, fdict):
|
||||||
def format_note(fdict):
|
res = ''
|
||||||
res = ''
|
if fdict.get('ext') in ['f4f', 'f4m']:
|
||||||
if fdict.get('ext') in ['f4f', 'f4m']:
|
res += '(unsupported) '
|
||||||
res += '(unsupported) '
|
if fdict.get('format_note') is not None:
|
||||||
if fdict.get('format_note') is not None:
|
res += fdict['format_note'] + ' '
|
||||||
res += fdict['format_note'] + ' '
|
if fdict.get('tbr') is not None:
|
||||||
if fdict.get('tbr') is not None:
|
res += '%4dk ' % fdict['tbr']
|
||||||
res += '%4dk ' % fdict['tbr']
|
if fdict.get('container') is not None:
|
||||||
if fdict.get('container') is not None:
|
if res:
|
||||||
if res:
|
res += ', '
|
||||||
res += ', '
|
res += '%s container' % fdict['container']
|
||||||
res += '%s container' % fdict['container']
|
if (fdict.get('vcodec') is not None and
|
||||||
if (fdict.get('vcodec') is not None and
|
fdict.get('vcodec') != 'none'):
|
||||||
fdict.get('vcodec') != 'none'):
|
if res:
|
||||||
if res:
|
res += ', '
|
||||||
res += ', '
|
res += fdict['vcodec']
|
||||||
res += fdict['vcodec']
|
|
||||||
if fdict.get('vbr') is not None:
|
|
||||||
res += '@'
|
|
||||||
elif fdict.get('vbr') is not None and fdict.get('abr') is not None:
|
|
||||||
res += 'video@'
|
|
||||||
if fdict.get('vbr') is not None:
|
if fdict.get('vbr') is not None:
|
||||||
res += '%4dk' % fdict['vbr']
|
res += '@'
|
||||||
if fdict.get('acodec') is not None:
|
elif fdict.get('vbr') is not None and fdict.get('abr') is not None:
|
||||||
if res:
|
res += 'video@'
|
||||||
res += ', '
|
if fdict.get('vbr') is not None:
|
||||||
if fdict['acodec'] == 'none':
|
res += '%4dk' % fdict['vbr']
|
||||||
res += 'video only'
|
if fdict.get('acodec') is not None:
|
||||||
else:
|
if res:
|
||||||
res += '%-5s' % fdict['acodec']
|
res += ', '
|
||||||
elif fdict.get('abr') is not None:
|
if fdict['acodec'] == 'none':
|
||||||
if res:
|
res += 'video only'
|
||||||
res += ', '
|
else:
|
||||||
res += 'audio'
|
res += '%-5s' % fdict['acodec']
|
||||||
if fdict.get('abr') is not None:
|
elif fdict.get('abr') is not None:
|
||||||
res += '@%3dk' % fdict['abr']
|
if res:
|
||||||
if fdict.get('asr') is not None:
|
res += ', '
|
||||||
res += ' (%5dHz)' % fdict['asr']
|
res += 'audio'
|
||||||
if fdict.get('filesize') is not None:
|
if fdict.get('abr') is not None:
|
||||||
if res:
|
res += '@%3dk' % fdict['abr']
|
||||||
res += ', '
|
if fdict.get('asr') is not None:
|
||||||
res += format_bytes(fdict['filesize'])
|
res += ' (%5dHz)' % fdict['asr']
|
||||||
return res
|
if fdict.get('filesize') is not None:
|
||||||
|
if res:
|
||||||
|
res += ', '
|
||||||
|
res += format_bytes(fdict['filesize'])
|
||||||
|
elif fdict.get('filesize_approx') is not None:
|
||||||
|
if res:
|
||||||
|
res += ', '
|
||||||
|
res += '~' + format_bytes(fdict['filesize_approx'])
|
||||||
|
return res
|
||||||
|
|
||||||
|
def list_formats(self, info_dict):
|
||||||
def line(format, idlen=20):
|
def line(format, idlen=20):
|
||||||
return (('%-' + compat_str(idlen + 1) + 's%-10s%-12s%s') % (
|
return (('%-' + compat_str(idlen + 1) + 's%-10s%-12s%s') % (
|
||||||
format['format_id'],
|
format['format_id'],
|
||||||
format['ext'],
|
format['ext'],
|
||||||
self.format_resolution(format),
|
self.format_resolution(format),
|
||||||
format_note(format),
|
self._format_note(format),
|
||||||
))
|
))
|
||||||
|
|
||||||
formats = info_dict.get('formats', [info_dict])
|
formats = info_dict.get('formats', [info_dict])
|
||||||
@@ -1186,8 +1228,8 @@ class YoutubeDL(object):
|
|||||||
max(len(f['format_id']) for f in formats))
|
max(len(f['format_id']) for f in formats))
|
||||||
formats_s = [line(f, idlen) for f in formats]
|
formats_s = [line(f, idlen) for f in formats]
|
||||||
if len(formats) > 1:
|
if len(formats) > 1:
|
||||||
formats_s[0] += (' ' if format_note(formats[0]) else '') + '(worst)'
|
formats_s[0] += (' ' if self._format_note(formats[0]) else '') + '(worst)'
|
||||||
formats_s[-1] += (' ' if format_note(formats[-1]) else '') + '(best)'
|
formats_s[-1] += (' ' if self._format_note(formats[-1]) else '') + '(best)'
|
||||||
|
|
||||||
header_line = line({
|
header_line = line({
|
||||||
'format_id': 'format code', 'ext': 'extension',
|
'format_id': 'format code', 'ext': 'extension',
|
||||||
@@ -1203,9 +1245,20 @@ class YoutubeDL(object):
|
|||||||
if not self.params.get('verbose'):
|
if not self.params.get('verbose'):
|
||||||
return
|
return
|
||||||
|
|
||||||
write_string('[debug] Encodings: locale %s, fs %s, out %s, pref %s\n' %
|
if type('') is not compat_str:
|
||||||
(locale.getpreferredencoding(), sys.getfilesystemencoding(), sys.stdout.encoding, self.get_encoding()))
|
# Python 2.6 on SLES11 SP1 (https://github.com/rg3/youtube-dl/issues/3326)
|
||||||
write_string('[debug] youtube-dl version ' + __version__ + '\n')
|
self.report_warning(
|
||||||
|
'Your Python is broken! Update to a newer and supported version')
|
||||||
|
|
||||||
|
encoding_str = (
|
||||||
|
'[debug] Encodings: locale %s, fs %s, out %s, pref %s\n' % (
|
||||||
|
locale.getpreferredencoding(),
|
||||||
|
sys.getfilesystemencoding(),
|
||||||
|
sys.stdout.encoding,
|
||||||
|
self.get_encoding()))
|
||||||
|
write_string(encoding_str, encoding=None)
|
||||||
|
|
||||||
|
self._write_string('[debug] youtube-dl version ' + __version__ + '\n')
|
||||||
try:
|
try:
|
||||||
sp = subprocess.Popen(
|
sp = subprocess.Popen(
|
||||||
['git', 'rev-parse', '--short', 'HEAD'],
|
['git', 'rev-parse', '--short', 'HEAD'],
|
||||||
@@ -1214,20 +1267,20 @@ class YoutubeDL(object):
|
|||||||
out, err = sp.communicate()
|
out, err = sp.communicate()
|
||||||
out = out.decode().strip()
|
out = out.decode().strip()
|
||||||
if re.match('[0-9a-f]+', out):
|
if re.match('[0-9a-f]+', out):
|
||||||
write_string('[debug] Git HEAD: ' + out + '\n')
|
self._write_string('[debug] Git HEAD: ' + out + '\n')
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
sys.exc_clear()
|
sys.exc_clear()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
write_string('[debug] Python version %s - %s' %
|
self._write_string('[debug] Python version %s - %s' %
|
||||||
(platform.python_version(), platform_name()) + '\n')
|
(platform.python_version(), platform_name()) + '\n')
|
||||||
|
|
||||||
proxy_map = {}
|
proxy_map = {}
|
||||||
for handler in self._opener.handlers:
|
for handler in self._opener.handlers:
|
||||||
if hasattr(handler, 'proxies'):
|
if hasattr(handler, 'proxies'):
|
||||||
proxy_map.update(handler.proxies)
|
proxy_map.update(handler.proxies)
|
||||||
write_string('[debug] Proxy map: ' + compat_str(proxy_map) + '\n')
|
self._write_string('[debug] Proxy map: ' + compat_str(proxy_map) + '\n')
|
||||||
|
|
||||||
def _setup_opener(self):
|
def _setup_opener(self):
|
||||||
timeout_val = self.params.get('socket_timeout')
|
timeout_val = self.params.get('socket_timeout')
|
||||||
|
|||||||
@@ -52,18 +52,39 @@ __authors__ = (
|
|||||||
'Juan C. Olivares',
|
'Juan C. Olivares',
|
||||||
'Mattias Harrysson',
|
'Mattias Harrysson',
|
||||||
'phaer',
|
'phaer',
|
||||||
|
'Sainyam Kapoor',
|
||||||
|
'Nicolas Évrard',
|
||||||
|
'Jason Normore',
|
||||||
|
'Hoje Lee',
|
||||||
|
'Adam Thalhammer',
|
||||||
|
'Georg Jähnig',
|
||||||
|
'Ralf Haring',
|
||||||
|
'Koki Takahashi',
|
||||||
|
'Ariset Llerena',
|
||||||
|
'Adam Malcontenti-Wilson',
|
||||||
|
'Tobias Bell',
|
||||||
|
'Naglis Jonaitis',
|
||||||
|
'Charles Chen',
|
||||||
|
'Hassaan Ali',
|
||||||
|
'Dobrosław Żybort',
|
||||||
|
'David Fabijan',
|
||||||
|
'Sebastian Haas',
|
||||||
|
'Alexander Kirk',
|
||||||
|
'Erik Johnson',
|
||||||
|
'Keith Beckman',
|
||||||
|
'Ole Ernst',
|
||||||
|
'Aaron McDaniel (mcd1992)',
|
||||||
)
|
)
|
||||||
|
|
||||||
__license__ = 'Public Domain'
|
__license__ = 'Public Domain'
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
import io
|
import io
|
||||||
import locale
|
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import re
|
|
||||||
import shlex
|
import shlex
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
@@ -71,6 +92,7 @@ from .utils import (
|
|||||||
compat_getpass,
|
compat_getpass,
|
||||||
compat_print,
|
compat_print,
|
||||||
DateRange,
|
DateRange,
|
||||||
|
DEFAULT_OUTTMPL,
|
||||||
decodeOption,
|
decodeOption,
|
||||||
get_term_width,
|
get_term_width,
|
||||||
DownloadError,
|
DownloadError,
|
||||||
@@ -84,18 +106,21 @@ from .utils import (
|
|||||||
write_string,
|
write_string,
|
||||||
)
|
)
|
||||||
from .update import update_self
|
from .update import update_self
|
||||||
from .FileDownloader import (
|
from .downloader import (
|
||||||
FileDownloader,
|
FileDownloader,
|
||||||
)
|
)
|
||||||
from .extractor import gen_extractors
|
from .extractor import gen_extractors
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
from .YoutubeDL import YoutubeDL
|
from .YoutubeDL import YoutubeDL
|
||||||
from .postprocessor import (
|
from .postprocessor import (
|
||||||
|
AtomicParsleyPP,
|
||||||
|
FFmpegAudioFixPP,
|
||||||
FFmpegMetadataPP,
|
FFmpegMetadataPP,
|
||||||
FFmpegVideoConvertor,
|
FFmpegVideoConvertor,
|
||||||
FFmpegExtractAudioPP,
|
FFmpegExtractAudioPP,
|
||||||
FFmpegEmbedSubtitlePP,
|
FFmpegEmbedSubtitlePP,
|
||||||
XAttrMetadataPP,
|
XAttrMetadataPP,
|
||||||
|
ExecAfterDownloadPP,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -207,6 +232,7 @@ def parseOpts(overrideArguments=None):
|
|||||||
downloader = optparse.OptionGroup(parser, 'Download Options')
|
downloader = optparse.OptionGroup(parser, 'Download Options')
|
||||||
postproc = optparse.OptionGroup(parser, 'Post-processing Options')
|
postproc = optparse.OptionGroup(parser, 'Post-processing Options')
|
||||||
filesystem = optparse.OptionGroup(parser, 'Filesystem Options')
|
filesystem = optparse.OptionGroup(parser, 'Filesystem Options')
|
||||||
|
workarounds = optparse.OptionGroup(parser, 'Workarounds')
|
||||||
verbosity = optparse.OptionGroup(parser, 'Verbosity / Simulation Options')
|
verbosity = optparse.OptionGroup(parser, 'Verbosity / Simulation Options')
|
||||||
|
|
||||||
general.add_option('-h', '--help',
|
general.add_option('-h', '--help',
|
||||||
@@ -223,14 +249,6 @@ def parseOpts(overrideArguments=None):
|
|||||||
general.add_option('--dump-user-agent',
|
general.add_option('--dump-user-agent',
|
||||||
action='store_true', dest='dump_user_agent',
|
action='store_true', dest='dump_user_agent',
|
||||||
help='display the current browser identification', default=False)
|
help='display the current browser identification', default=False)
|
||||||
general.add_option('--user-agent',
|
|
||||||
dest='user_agent', help='specify a custom user agent', metavar='UA')
|
|
||||||
general.add_option('--referer',
|
|
||||||
dest='referer', help='specify a custom referer, use if the video access is restricted to one domain',
|
|
||||||
metavar='REF', default=None)
|
|
||||||
general.add_option('--add-header',
|
|
||||||
dest='headers', help='specify a custom HTTP header and its value, separated by a colon \':\'. You can use this option multiple times', action="append",
|
|
||||||
metavar='FIELD:VALUE')
|
|
||||||
general.add_option('--list-extractors',
|
general.add_option('--list-extractors',
|
||||||
action='store_true', dest='list_extractors',
|
action='store_true', dest='list_extractors',
|
||||||
help='List all supported extractors and the URLs they would handle', default=False)
|
help='List all supported extractors and the URLs they would handle', default=False)
|
||||||
@@ -240,33 +258,17 @@ def parseOpts(overrideArguments=None):
|
|||||||
general.add_option(
|
general.add_option(
|
||||||
'--proxy', dest='proxy', default=None, metavar='URL',
|
'--proxy', dest='proxy', default=None, metavar='URL',
|
||||||
help='Use the specified HTTP/HTTPS proxy. Pass in an empty string (--proxy "") for direct connection')
|
help='Use the specified HTTP/HTTPS proxy. Pass in an empty string (--proxy "") for direct connection')
|
||||||
general.add_option('--no-check-certificate', action='store_true', dest='no_check_certificate', default=False, help='Suppress HTTPS certificate validation.')
|
|
||||||
general.add_option(
|
|
||||||
'--prefer-insecure', action='store_true', dest='prefer_insecure',
|
|
||||||
help='Use an unencrypted connection to retrieve information about the video. (Currently supported only for YouTube)')
|
|
||||||
general.add_option(
|
|
||||||
'--cache-dir', dest='cachedir', default=get_cachedir(), metavar='DIR',
|
|
||||||
help='Location in the filesystem where youtube-dl can store some downloaded information permanently. By default $XDG_CACHE_HOME/youtube-dl or ~/.cache/youtube-dl . At the moment, only YouTube player files (for videos with obfuscated signatures) are cached, but that may change.')
|
|
||||||
general.add_option(
|
|
||||||
'--no-cache-dir', action='store_const', const=None, dest='cachedir',
|
|
||||||
help='Disable filesystem caching')
|
|
||||||
general.add_option(
|
general.add_option(
|
||||||
'--socket-timeout', dest='socket_timeout',
|
'--socket-timeout', dest='socket_timeout',
|
||||||
type=float, default=None, help=u'Time to wait before giving up, in seconds')
|
type=float, default=None, help=u'Time to wait before giving up, in seconds')
|
||||||
general.add_option(
|
|
||||||
'--bidi-workaround', dest='bidi_workaround', action='store_true',
|
|
||||||
help=u'Work around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH')
|
|
||||||
general.add_option(
|
general.add_option(
|
||||||
'--default-search',
|
'--default-search',
|
||||||
dest='default_search', metavar='PREFIX',
|
dest='default_search', metavar='PREFIX',
|
||||||
help='Use this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos from google videos for youtube-dl "large apple". By default (with value "auto") youtube-dl guesses.')
|
help='Use this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos from google videos for youtube-dl "large apple". Use the value "auto" to let youtube-dl guess ("auto_warning" to emit a warning when guessing). "error" just throws an error. The default value "fixup_error" repairs broken URLs, but emits an error if this is not possible instead of searching.')
|
||||||
general.add_option(
|
general.add_option(
|
||||||
'--ignore-config',
|
'--ignore-config',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Do not read configuration files. When given in the global configuration file /etc/youtube-dl.conf: do not read the user configuration in ~/.config/youtube-dl.conf (%APPDATA%/youtube-dl/config.txt on Windows)')
|
help='Do not read configuration files. When given in the global configuration file /etc/youtube-dl.conf: do not read the user configuration in ~/.config/youtube-dl.conf (%APPDATA%/youtube-dl/config.txt on Windows)')
|
||||||
general.add_option(
|
|
||||||
'--encoding', dest='encoding', metavar='ENCODING',
|
|
||||||
help='Force the specified encoding (experimental)')
|
|
||||||
|
|
||||||
selection.add_option(
|
selection.add_option(
|
||||||
'--playlist-start',
|
'--playlist-start',
|
||||||
@@ -318,6 +320,8 @@ def parseOpts(overrideArguments=None):
|
|||||||
dest='username', metavar='USERNAME', help='account username')
|
dest='username', metavar='USERNAME', help='account username')
|
||||||
authentication.add_option('-p', '--password',
|
authentication.add_option('-p', '--password',
|
||||||
dest='password', metavar='PASSWORD', help='account password')
|
dest='password', metavar='PASSWORD', help='account password')
|
||||||
|
authentication.add_option('-2', '--twofactor',
|
||||||
|
dest='twofactor', metavar='TWOFACTOR', help='two-factor auth code')
|
||||||
authentication.add_option('-n', '--netrc',
|
authentication.add_option('-n', '--netrc',
|
||||||
action='store_true', dest='usenetrc', help='use .netrc authentication data', default=False)
|
action='store_true', dest='usenetrc', help='use .netrc authentication data', default=False)
|
||||||
authentication.add_option('--video-password',
|
authentication.add_option('--video-password',
|
||||||
@@ -367,6 +371,33 @@ def parseOpts(overrideArguments=None):
|
|||||||
help='do not automatically adjust the buffer size. By default, the buffer size is automatically resized from an initial value of SIZE.', default=False)
|
help='do not automatically adjust the buffer size. By default, the buffer size is automatically resized from an initial value of SIZE.', default=False)
|
||||||
downloader.add_option('--test', action='store_true', dest='test', default=False, help=optparse.SUPPRESS_HELP)
|
downloader.add_option('--test', action='store_true', dest='test', default=False, help=optparse.SUPPRESS_HELP)
|
||||||
|
|
||||||
|
workarounds.add_option(
|
||||||
|
'--encoding', dest='encoding', metavar='ENCODING',
|
||||||
|
help='Force the specified encoding (experimental)')
|
||||||
|
workarounds.add_option(
|
||||||
|
'--no-check-certificate', action='store_true',
|
||||||
|
dest='no_check_certificate', default=False,
|
||||||
|
help='Suppress HTTPS certificate validation.')
|
||||||
|
workarounds.add_option(
|
||||||
|
'--prefer-insecure', '--prefer-unsecure', action='store_true', dest='prefer_insecure',
|
||||||
|
help='Use an unencrypted connection to retrieve information about the video. (Currently supported only for YouTube)')
|
||||||
|
workarounds.add_option(
|
||||||
|
'--user-agent', metavar='UA',
|
||||||
|
dest='user_agent', help='specify a custom user agent')
|
||||||
|
workarounds.add_option(
|
||||||
|
'--referer', metavar='REF',
|
||||||
|
dest='referer', default=None,
|
||||||
|
help='specify a custom referer, use if the video access is restricted to one domain',
|
||||||
|
)
|
||||||
|
workarounds.add_option(
|
||||||
|
'--add-header', metavar='FIELD:VALUE',
|
||||||
|
dest='headers', action='append',
|
||||||
|
help='specify a custom HTTP header and its value, separated by a colon \':\'. You can use this option multiple times',
|
||||||
|
)
|
||||||
|
workarounds.add_option(
|
||||||
|
'--bidi-workaround', dest='bidi_workaround', action='store_true',
|
||||||
|
help=u'Work around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATH')
|
||||||
|
|
||||||
verbosity.add_option('-q', '--quiet',
|
verbosity.add_option('-q', '--quiet',
|
||||||
action='store_true', dest='quiet', help='activates quiet mode', default=False)
|
action='store_true', dest='quiet', help='activates quiet mode', default=False)
|
||||||
verbosity.add_option(
|
verbosity.add_option(
|
||||||
@@ -424,12 +455,10 @@ def parseOpts(overrideArguments=None):
|
|||||||
help='Display sent and read HTTP traffic')
|
help='Display sent and read HTTP traffic')
|
||||||
|
|
||||||
|
|
||||||
filesystem.add_option('-t', '--title',
|
filesystem.add_option('-a', '--batch-file',
|
||||||
action='store_true', dest='usetitle', help='use title in file name (default)', default=False)
|
dest='batchfile', metavar='FILE', help='file containing URLs to download (\'-\' for stdin)')
|
||||||
filesystem.add_option('--id',
|
filesystem.add_option('--id',
|
||||||
action='store_true', dest='useid', help='use only video ID in file name', default=False)
|
action='store_true', dest='useid', help='use only video ID in file name', default=False)
|
||||||
filesystem.add_option('-l', '--literal',
|
|
||||||
action='store_true', dest='usetitle', help='[deprecated] alias of --title', default=False)
|
|
||||||
filesystem.add_option('-A', '--auto-number',
|
filesystem.add_option('-A', '--auto-number',
|
||||||
action='store_true', dest='autonumber',
|
action='store_true', dest='autonumber',
|
||||||
help='number downloaded files starting from 00000', default=False)
|
help='number downloaded files starting from 00000', default=False)
|
||||||
@@ -455,11 +484,10 @@ def parseOpts(overrideArguments=None):
|
|||||||
filesystem.add_option('--restrict-filenames',
|
filesystem.add_option('--restrict-filenames',
|
||||||
action='store_true', dest='restrictfilenames',
|
action='store_true', dest='restrictfilenames',
|
||||||
help='Restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames', default=False)
|
help='Restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames', default=False)
|
||||||
filesystem.add_option('-a', '--batch-file',
|
filesystem.add_option('-t', '--title',
|
||||||
dest='batchfile', metavar='FILE', help='file containing URLs to download (\'-\' for stdin)')
|
action='store_true', dest='usetitle', help='[deprecated] use title in file name (default)', default=False)
|
||||||
filesystem.add_option('--load-info',
|
filesystem.add_option('-l', '--literal',
|
||||||
dest='load_info_filename', metavar='FILE',
|
action='store_true', dest='usetitle', help='[deprecated] alias of --title', default=False)
|
||||||
help='json file containing the video information (created with the "--write-json" option)')
|
|
||||||
filesystem.add_option('-w', '--no-overwrites',
|
filesystem.add_option('-w', '--no-overwrites',
|
||||||
action='store_true', dest='nooverwrites', help='do not overwrite files', default=False)
|
action='store_true', dest='nooverwrites', help='do not overwrite files', default=False)
|
||||||
filesystem.add_option('-c', '--continue',
|
filesystem.add_option('-c', '--continue',
|
||||||
@@ -467,8 +495,6 @@ def parseOpts(overrideArguments=None):
|
|||||||
filesystem.add_option('--no-continue',
|
filesystem.add_option('--no-continue',
|
||||||
action='store_false', dest='continue_dl',
|
action='store_false', dest='continue_dl',
|
||||||
help='do not resume partially downloaded files (restart from beginning)')
|
help='do not resume partially downloaded files (restart from beginning)')
|
||||||
filesystem.add_option('--cookies',
|
|
||||||
dest='cookiefile', metavar='FILE', help='file to read cookies from and dump cookie jar in')
|
|
||||||
filesystem.add_option('--no-part',
|
filesystem.add_option('--no-part',
|
||||||
action='store_true', dest='nopart', help='do not use .part files', default=False)
|
action='store_true', dest='nopart', help='do not use .part files', default=False)
|
||||||
filesystem.add_option('--no-mtime',
|
filesystem.add_option('--no-mtime',
|
||||||
@@ -486,6 +512,20 @@ def parseOpts(overrideArguments=None):
|
|||||||
filesystem.add_option('--write-thumbnail',
|
filesystem.add_option('--write-thumbnail',
|
||||||
action='store_true', dest='writethumbnail',
|
action='store_true', dest='writethumbnail',
|
||||||
help='write thumbnail image to disk', default=False)
|
help='write thumbnail image to disk', default=False)
|
||||||
|
filesystem.add_option('--load-info',
|
||||||
|
dest='load_info_filename', metavar='FILE',
|
||||||
|
help='json file containing the video information (created with the "--write-json" option)')
|
||||||
|
filesystem.add_option('--cookies',
|
||||||
|
dest='cookiefile', metavar='FILE', help='file to read cookies from and dump cookie jar in')
|
||||||
|
filesystem.add_option(
|
||||||
|
'--cache-dir', dest='cachedir', default=get_cachedir(), metavar='DIR',
|
||||||
|
help='Location in the filesystem where youtube-dl can store some downloaded information permanently. By default $XDG_CACHE_HOME/youtube-dl or ~/.cache/youtube-dl . At the moment, only YouTube player files (for videos with obfuscated signatures) are cached, but that may change.')
|
||||||
|
filesystem.add_option(
|
||||||
|
'--no-cache-dir', action='store_const', const=None, dest='cachedir',
|
||||||
|
help='Disable filesystem caching')
|
||||||
|
filesystem.add_option(
|
||||||
|
'--rm-cache-dir', action='store_true', dest='rm_cachedir',
|
||||||
|
help='Delete all filesystem cache files')
|
||||||
|
|
||||||
|
|
||||||
postproc.add_option('-x', '--extract-audio', action='store_true', dest='extractaudio', default=False,
|
postproc.add_option('-x', '--extract-audio', action='store_true', dest='extractaudio', default=False,
|
||||||
@@ -495,13 +535,15 @@ def parseOpts(overrideArguments=None):
|
|||||||
postproc.add_option('--audio-quality', metavar='QUALITY', dest='audioquality', default='5',
|
postproc.add_option('--audio-quality', metavar='QUALITY', dest='audioquality', default='5',
|
||||||
help='ffmpeg/avconv audio quality specification, insert a value between 0 (better) and 9 (worse) for VBR or a specific bitrate like 128K (default 5)')
|
help='ffmpeg/avconv audio quality specification, insert a value between 0 (better) and 9 (worse) for VBR or a specific bitrate like 128K (default 5)')
|
||||||
postproc.add_option('--recode-video', metavar='FORMAT', dest='recodevideo', default=None,
|
postproc.add_option('--recode-video', metavar='FORMAT', dest='recodevideo', default=None,
|
||||||
help='Encode the video to another format if necessary (currently supported: mp4|flv|ogg|webm)')
|
help='Encode the video to another format if necessary (currently supported: mp4|flv|ogg|webm|mkv)')
|
||||||
postproc.add_option('-k', '--keep-video', action='store_true', dest='keepvideo', default=False,
|
postproc.add_option('-k', '--keep-video', action='store_true', dest='keepvideo', default=False,
|
||||||
help='keeps the video file on disk after the post-processing; the video is erased by default')
|
help='keeps the video file on disk after the post-processing; the video is erased by default')
|
||||||
postproc.add_option('--no-post-overwrites', action='store_true', dest='nopostoverwrites', default=False,
|
postproc.add_option('--no-post-overwrites', action='store_true', dest='nopostoverwrites', default=False,
|
||||||
help='do not overwrite post-processed files; the post-processed files are overwritten by default')
|
help='do not overwrite post-processed files; the post-processed files are overwritten by default')
|
||||||
postproc.add_option('--embed-subs', action='store_true', dest='embedsubtitles', default=False,
|
postproc.add_option('--embed-subs', action='store_true', dest='embedsubtitles', default=False,
|
||||||
help='embed subtitles in the video (only for mp4 videos)')
|
help='embed subtitles in the video (only for mp4 videos)')
|
||||||
|
postproc.add_option('--embed-thumbnail', action='store_true', dest='embedthumbnail', default=False,
|
||||||
|
help='embed thumbnail in the audio as cover art')
|
||||||
postproc.add_option('--add-metadata', action='store_true', dest='addmetadata', default=False,
|
postproc.add_option('--add-metadata', action='store_true', dest='addmetadata', default=False,
|
||||||
help='write metadata to the video file')
|
help='write metadata to the video file')
|
||||||
postproc.add_option('--xattrs', action='store_true', dest='xattrs', default=False,
|
postproc.add_option('--xattrs', action='store_true', dest='xattrs', default=False,
|
||||||
@@ -510,13 +552,16 @@ def parseOpts(overrideArguments=None):
|
|||||||
help='Prefer avconv over ffmpeg for running the postprocessors (default)')
|
help='Prefer avconv over ffmpeg for running the postprocessors (default)')
|
||||||
postproc.add_option('--prefer-ffmpeg', action='store_true', dest='prefer_ffmpeg',
|
postproc.add_option('--prefer-ffmpeg', action='store_true', dest='prefer_ffmpeg',
|
||||||
help='Prefer ffmpeg over avconv for running the postprocessors')
|
help='Prefer ffmpeg over avconv for running the postprocessors')
|
||||||
|
postproc.add_option(
|
||||||
|
'--exec', metavar='CMD', dest='exec_cmd',
|
||||||
|
help='Execute a command on the file after downloading, similar to find\'s -exec syntax. Example: --exec \'adb push {} /sdcard/Music/ && rm {}\'' )
|
||||||
|
|
||||||
parser.add_option_group(general)
|
parser.add_option_group(general)
|
||||||
parser.add_option_group(selection)
|
parser.add_option_group(selection)
|
||||||
parser.add_option_group(downloader)
|
parser.add_option_group(downloader)
|
||||||
parser.add_option_group(filesystem)
|
parser.add_option_group(filesystem)
|
||||||
parser.add_option_group(verbosity)
|
parser.add_option_group(verbosity)
|
||||||
|
parser.add_option_group(workarounds)
|
||||||
parser.add_option_group(video_format)
|
parser.add_option_group(video_format)
|
||||||
parser.add_option_group(subtitles)
|
parser.add_option_group(subtitles)
|
||||||
parser.add_option_group(authentication)
|
parser.add_option_group(authentication)
|
||||||
@@ -616,7 +661,7 @@ def _real_main(argv=None):
|
|||||||
if desc is False:
|
if desc is False:
|
||||||
continue
|
continue
|
||||||
if hasattr(ie, 'SEARCH_KEY'):
|
if hasattr(ie, 'SEARCH_KEY'):
|
||||||
_SEARCHES = (u'cute kittens', u'slithering pythons', u'falling cat', u'angry poodle', u'purple fish', u'running tortoise')
|
_SEARCHES = (u'cute kittens', u'slithering pythons', u'falling cat', u'angry poodle', u'purple fish', u'running tortoise', u'sleeping bunny')
|
||||||
_COUNTS = (u'', u'5', u'10', u'all')
|
_COUNTS = (u'', u'5', u'10', u'all')
|
||||||
desc += u' (Example: "%s%s:%s" )' % (ie.SEARCH_KEY, random.choice(_COUNTS), random.choice(_SEARCHES))
|
desc += u' (Example: "%s%s:%s" )' % (ie.SEARCH_KEY, random.choice(_COUNTS), random.choice(_SEARCHES))
|
||||||
compat_print(desc)
|
compat_print(desc)
|
||||||
@@ -671,13 +716,13 @@ def _real_main(argv=None):
|
|||||||
if not opts.audioquality.isdigit():
|
if not opts.audioquality.isdigit():
|
||||||
parser.error(u'invalid audio quality specified')
|
parser.error(u'invalid audio quality specified')
|
||||||
if opts.recodevideo is not None:
|
if opts.recodevideo is not None:
|
||||||
if opts.recodevideo not in ['mp4', 'flv', 'webm', 'ogg']:
|
if opts.recodevideo not in ['mp4', 'flv', 'webm', 'ogg', 'mkv']:
|
||||||
parser.error(u'invalid video recode format specified')
|
parser.error(u'invalid video recode format specified')
|
||||||
if opts.date is not None:
|
if opts.date is not None:
|
||||||
date = DateRange.day(opts.date)
|
date = DateRange.day(opts.date)
|
||||||
else:
|
else:
|
||||||
date = DateRange(opts.dateafter, opts.datebefore)
|
date = DateRange(opts.dateafter, opts.datebefore)
|
||||||
if opts.default_search not in ('auto', 'auto_warning', None) and ':' not in opts.default_search:
|
if opts.default_search not in ('auto', 'auto_warning', 'error', 'fixup_error', None) and ':' not in opts.default_search:
|
||||||
parser.error(u'--default-search invalid; did you forget a colon (:) at the end?')
|
parser.error(u'--default-search invalid; did you forget a colon (:) at the end?')
|
||||||
|
|
||||||
# Do not download videos when there are audio-only formats
|
# Do not download videos when there are audio-only formats
|
||||||
@@ -700,7 +745,7 @@ def _real_main(argv=None):
|
|||||||
or (opts.usetitle and u'%(title)s-%(id)s.%(ext)s')
|
or (opts.usetitle and u'%(title)s-%(id)s.%(ext)s')
|
||||||
or (opts.useid and u'%(id)s.%(ext)s')
|
or (opts.useid and u'%(id)s.%(ext)s')
|
||||||
or (opts.autonumber and u'%(autonumber)s-%(id)s.%(ext)s')
|
or (opts.autonumber and u'%(autonumber)s-%(id)s.%(ext)s')
|
||||||
or u'%(title)s-%(id)s.%(ext)s')
|
or DEFAULT_OUTTMPL)
|
||||||
if not os.path.splitext(outtmpl)[1] and opts.extractaudio:
|
if not os.path.splitext(outtmpl)[1] and opts.extractaudio:
|
||||||
parser.error(u'Cannot download a video and extract audio into the same'
|
parser.error(u'Cannot download a video and extract audio into the same'
|
||||||
u' file! Use "{0}.%(ext)s" instead of "{0}" as the output'
|
u' file! Use "{0}.%(ext)s" instead of "{0}" as the output'
|
||||||
@@ -713,6 +758,7 @@ def _real_main(argv=None):
|
|||||||
'usenetrc': opts.usenetrc,
|
'usenetrc': opts.usenetrc,
|
||||||
'username': opts.username,
|
'username': opts.username,
|
||||||
'password': opts.password,
|
'password': opts.password,
|
||||||
|
'twofactor': opts.twofactor,
|
||||||
'videopassword': opts.videopassword,
|
'videopassword': opts.videopassword,
|
||||||
'quiet': (opts.quiet or any_printing),
|
'quiet': (opts.quiet or any_printing),
|
||||||
'no_warnings': opts.no_warnings,
|
'no_warnings': opts.no_warnings,
|
||||||
@@ -789,6 +835,7 @@ def _real_main(argv=None):
|
|||||||
'default_search': opts.default_search,
|
'default_search': opts.default_search,
|
||||||
'youtube_include_dash_manifest': opts.youtube_include_dash_manifest,
|
'youtube_include_dash_manifest': opts.youtube_include_dash_manifest,
|
||||||
'encoding': opts.encoding,
|
'encoding': opts.encoding,
|
||||||
|
'exec_cmd': opts.exec_cmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
with YoutubeDL(ydl_opts) as ydl:
|
with YoutubeDL(ydl_opts) as ydl:
|
||||||
@@ -807,14 +854,42 @@ def _real_main(argv=None):
|
|||||||
ydl.add_post_processor(FFmpegEmbedSubtitlePP(subtitlesformat=opts.subtitlesformat))
|
ydl.add_post_processor(FFmpegEmbedSubtitlePP(subtitlesformat=opts.subtitlesformat))
|
||||||
if opts.xattrs:
|
if opts.xattrs:
|
||||||
ydl.add_post_processor(XAttrMetadataPP())
|
ydl.add_post_processor(XAttrMetadataPP())
|
||||||
|
if opts.embedthumbnail:
|
||||||
|
if not opts.addmetadata:
|
||||||
|
ydl.add_post_processor(FFmpegAudioFixPP())
|
||||||
|
ydl.add_post_processor(AtomicParsleyPP())
|
||||||
|
|
||||||
|
|
||||||
|
# Please keep ExecAfterDownload towards the bottom as it allows the user to modify the final file in any way.
|
||||||
|
# So if the user is able to remove the file before your postprocessor runs it might cause a few problems.
|
||||||
|
if opts.exec_cmd:
|
||||||
|
ydl.add_post_processor(ExecAfterDownloadPP(
|
||||||
|
verboseOutput=opts.verbose, exec_cmd=opts.exec_cmd))
|
||||||
|
|
||||||
# Update version
|
# Update version
|
||||||
if opts.update_self:
|
if opts.update_self:
|
||||||
update_self(ydl.to_screen, opts.verbose)
|
update_self(ydl.to_screen, opts.verbose)
|
||||||
|
|
||||||
|
# Remove cache dir
|
||||||
|
if opts.rm_cachedir:
|
||||||
|
if opts.cachedir is None:
|
||||||
|
ydl.to_screen(u'No cache dir specified (Did you combine --no-cache-dir and --rm-cache-dir?)')
|
||||||
|
else:
|
||||||
|
if ('.cache' not in opts.cachedir) or ('youtube-dl' not in opts.cachedir):
|
||||||
|
ydl.to_screen(u'Not removing directory %s - this does not look like a cache dir' % opts.cachedir)
|
||||||
|
retcode = 141
|
||||||
|
else:
|
||||||
|
ydl.to_screen(
|
||||||
|
u'Removing cache dir %s .' % opts.cachedir,
|
||||||
|
skip_eol=True)
|
||||||
|
if os.path.exists(opts.cachedir):
|
||||||
|
ydl.to_screen(u'.', skip_eol=True)
|
||||||
|
shutil.rmtree(opts.cachedir)
|
||||||
|
ydl.to_screen(u'.')
|
||||||
|
|
||||||
# Maybe do nothing
|
# Maybe do nothing
|
||||||
if (len(all_urls) < 1) and (opts.load_info_filename is None):
|
if (len(all_urls) < 1) and (opts.load_info_filename is None):
|
||||||
if not opts.update_self:
|
if not (opts.update_self or opts.rm_cachedir):
|
||||||
parser.error(u'you must provide at least one URL')
|
parser.error(u'you must provide at least one URL')
|
||||||
else:
|
else:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import sys
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
compat_str,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
timeconvert,
|
|
||||||
format_bytes,
|
format_bytes,
|
||||||
|
timeconvert,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -173,7 +174,7 @@ class FileDownloader(object):
|
|||||||
return
|
return
|
||||||
os.rename(encodeFilename(old_filename), encodeFilename(new_filename))
|
os.rename(encodeFilename(old_filename), encodeFilename(new_filename))
|
||||||
except (IOError, OSError) as err:
|
except (IOError, OSError) as err:
|
||||||
self.report_error(u'unable to rename file: %s' % str(err))
|
self.report_error(u'unable to rename file: %s' % compat_str(err))
|
||||||
|
|
||||||
def try_utime(self, filename, last_modified_hdr):
|
def try_utime(self, filename, last_modified_hdr):
|
||||||
"""Try to set the last-modified time of the given file."""
|
"""Try to set the last-modified time of the given file."""
|
||||||
@@ -291,7 +292,7 @@ class FileDownloader(object):
|
|||||||
|
|
||||||
def real_download(self, filename, info_dict):
|
def real_download(self, filename, info_dict):
|
||||||
"""Real download process. Redefine in subclasses."""
|
"""Real download process. Redefine in subclasses."""
|
||||||
raise NotImplementedError(u'This method must be implemented by sublcasses')
|
raise NotImplementedError(u'This method must be implemented by subclasses')
|
||||||
|
|
||||||
def _hook_progress(self, status):
|
def _hook_progress(self, status):
|
||||||
for ph in self._progress_hooks:
|
for ph in self._progress_hooks:
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ class F4mFD(FileDownloader):
|
|||||||
|
|
||||||
def real_download(self, filename, info_dict):
|
def real_download(self, filename, info_dict):
|
||||||
man_url = info_dict['url']
|
man_url = info_dict['url']
|
||||||
|
requested_bitrate = info_dict.get('tbr')
|
||||||
self.to_screen('[download] Downloading f4m manifest')
|
self.to_screen('[download] Downloading f4m manifest')
|
||||||
manifest = self.ydl.urlopen(man_url).read()
|
manifest = self.ydl.urlopen(man_url).read()
|
||||||
self.report_destination(filename)
|
self.report_destination(filename)
|
||||||
@@ -233,8 +234,14 @@ class F4mFD(FileDownloader):
|
|||||||
|
|
||||||
doc = etree.fromstring(manifest)
|
doc = etree.fromstring(manifest)
|
||||||
formats = [(int(f.attrib.get('bitrate', -1)), f) for f in doc.findall(_add_ns('media'))]
|
formats = [(int(f.attrib.get('bitrate', -1)), f) for f in doc.findall(_add_ns('media'))]
|
||||||
formats = sorted(formats, key=lambda f: f[0])
|
if requested_bitrate is None:
|
||||||
rate, media = formats[-1]
|
# get the best format
|
||||||
|
formats = sorted(formats, key=lambda f: f[0])
|
||||||
|
rate, media = formats[-1]
|
||||||
|
else:
|
||||||
|
rate, media = list(filter(
|
||||||
|
lambda f: int(f[0]) == requested_bitrate, formats))[0]
|
||||||
|
|
||||||
base_url = compat_urlparse.urljoin(man_url, media.attrib['url'])
|
base_url = compat_urlparse.urljoin(man_url, media.attrib['url'])
|
||||||
bootstrap = base64.b64decode(doc.find(_add_ns('bootstrapInfo')).text)
|
bootstrap = base64.b64decode(doc.find(_add_ns('bootstrapInfo')).text)
|
||||||
metadata = base64.b64decode(media.find(_add_ns('metadata')).text)
|
metadata = base64.b64decode(media.find(_add_ns('metadata')).text)
|
||||||
@@ -297,6 +304,7 @@ class F4mFD(FileDownloader):
|
|||||||
break
|
break
|
||||||
frags_filenames.append(frag_filename)
|
frags_filenames.append(frag_filename)
|
||||||
|
|
||||||
|
dest_stream.close()
|
||||||
self.report_finish(format_bytes(state['downloaded_bytes']), time.time() - start)
|
self.report_finish(format_bytes(state['downloaded_bytes']), time.time() - start)
|
||||||
|
|
||||||
self.try_rename(tmpfilename, filename)
|
self.try_rename(tmpfilename, filename)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import subprocess
|
|||||||
|
|
||||||
from .common import FileDownloader
|
from .common import FileDownloader
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
check_executable,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -19,13 +20,11 @@ class HlsFD(FileDownloader):
|
|||||||
encodeFilename(tmpfilename, for_subprocess=True)]
|
encodeFilename(tmpfilename, for_subprocess=True)]
|
||||||
|
|
||||||
for program in ['avconv', 'ffmpeg']:
|
for program in ['avconv', 'ffmpeg']:
|
||||||
try:
|
if check_executable(program, ['-version']):
|
||||||
subprocess.call([program, '-version'], stdout=(open(os.path.devnull, 'w')), stderr=subprocess.STDOUT)
|
|
||||||
break
|
break
|
||||||
except (OSError, IOError):
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
self.report_error(u'm3u8 download detected but ffmpeg or avconv could not be found')
|
self.report_error(u'm3u8 download detected but ffmpeg or avconv could not be found. Please install one.')
|
||||||
|
return False
|
||||||
cmd = [program] + args
|
cmd = [program] + args
|
||||||
|
|
||||||
retval = subprocess.call(cmd)
|
retval = subprocess.call(cmd)
|
||||||
@@ -42,5 +41,5 @@ class HlsFD(FileDownloader):
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
self.to_stderr(u"\n")
|
self.to_stderr(u"\n")
|
||||||
self.report_error(u'ffmpeg exited with code %d' % retval)
|
self.report_error(u'%s exited with code %d' % (program, retval))
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class HttpFD(FileDownloader):
|
class HttpFD(FileDownloader):
|
||||||
|
_TEST_FILE_SIZE = 10241
|
||||||
|
|
||||||
def real_download(self, filename, info_dict):
|
def real_download(self, filename, info_dict):
|
||||||
url = info_dict['url']
|
url = info_dict['url']
|
||||||
tmpfilename = self.temp_name(filename)
|
tmpfilename = self.temp_name(filename)
|
||||||
@@ -25,11 +27,21 @@ class HttpFD(FileDownloader):
|
|||||||
headers['Youtubedl-user-agent'] = info_dict['user_agent']
|
headers['Youtubedl-user-agent'] = info_dict['user_agent']
|
||||||
if 'http_referer' in info_dict:
|
if 'http_referer' in info_dict:
|
||||||
headers['Referer'] = info_dict['http_referer']
|
headers['Referer'] = info_dict['http_referer']
|
||||||
basic_request = compat_urllib_request.Request(url, None, headers)
|
add_headers = info_dict.get('http_headers')
|
||||||
request = compat_urllib_request.Request(url, None, headers)
|
if add_headers:
|
||||||
|
headers.update(add_headers)
|
||||||
|
data = info_dict.get('http_post_data')
|
||||||
|
http_method = info_dict.get('http_method')
|
||||||
|
basic_request = compat_urllib_request.Request(url, data, headers)
|
||||||
|
request = compat_urllib_request.Request(url, data, headers)
|
||||||
|
if http_method is not None:
|
||||||
|
basic_request.get_method = lambda: http_method
|
||||||
|
request.get_method = lambda: http_method
|
||||||
|
|
||||||
if self.params.get('test', False):
|
is_test = self.params.get('test', False)
|
||||||
request.add_header('Range', 'bytes=0-10240')
|
|
||||||
|
if is_test:
|
||||||
|
request.add_header('Range', 'bytes=0-%s' % str(self._TEST_FILE_SIZE - 1))
|
||||||
|
|
||||||
# Establish possible resume length
|
# Establish possible resume length
|
||||||
if os.path.isfile(encodeFilename(tmpfilename)):
|
if os.path.isfile(encodeFilename(tmpfilename)):
|
||||||
@@ -100,6 +112,15 @@ class HttpFD(FileDownloader):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
data_len = data.info().get('Content-length', None)
|
data_len = data.info().get('Content-length', None)
|
||||||
|
|
||||||
|
# Range HTTP header may be ignored/unsupported by a webserver
|
||||||
|
# (e.g. extractor/scivee.py, extractor/bambuser.py).
|
||||||
|
# However, for a test we still would like to download just a piece of a file.
|
||||||
|
# To achieve this we limit data_len to _TEST_FILE_SIZE and manually control
|
||||||
|
# block size when downloading a file.
|
||||||
|
if is_test and (data_len is None or int(data_len) > self._TEST_FILE_SIZE):
|
||||||
|
data_len = self._TEST_FILE_SIZE
|
||||||
|
|
||||||
if data_len is not None:
|
if data_len is not None:
|
||||||
data_len = int(data_len) + resume_len
|
data_len = int(data_len) + resume_len
|
||||||
min_data_len = self.params.get("min_filesize", None)
|
min_data_len = self.params.get("min_filesize", None)
|
||||||
@@ -118,7 +139,7 @@ class HttpFD(FileDownloader):
|
|||||||
while True:
|
while True:
|
||||||
# Download and write
|
# Download and write
|
||||||
before = time.time()
|
before = time.time()
|
||||||
data_block = data.read(block_size)
|
data_block = data.read(block_size if not is_test else min(block_size, data_len - byte_counter))
|
||||||
after = time.time()
|
after = time.time()
|
||||||
if len(data_block) == 0:
|
if len(data_block) == 0:
|
||||||
break
|
break
|
||||||
@@ -162,6 +183,9 @@ class HttpFD(FileDownloader):
|
|||||||
'speed': speed,
|
'speed': speed,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if is_test and byte_counter == data_len:
|
||||||
|
break
|
||||||
|
|
||||||
# Apply rate limit
|
# Apply rate limit
|
||||||
self.slow_down(start, byte_counter - resume_len)
|
self.slow_down(start, byte_counter - resume_len)
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import time
|
|||||||
|
|
||||||
from .common import FileDownloader
|
from .common import FileDownloader
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
check_executable,
|
||||||
|
compat_str,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
format_bytes,
|
format_bytes,
|
||||||
)
|
)
|
||||||
@@ -95,16 +97,15 @@ class RtmpFD(FileDownloader):
|
|||||||
flash_version = info_dict.get('flash_version', None)
|
flash_version = info_dict.get('flash_version', None)
|
||||||
live = info_dict.get('rtmp_live', False)
|
live = info_dict.get('rtmp_live', False)
|
||||||
conn = info_dict.get('rtmp_conn', None)
|
conn = info_dict.get('rtmp_conn', None)
|
||||||
|
protocol = info_dict.get('rtmp_protocol', None)
|
||||||
|
|
||||||
self.report_destination(filename)
|
self.report_destination(filename)
|
||||||
tmpfilename = self.temp_name(filename)
|
tmpfilename = self.temp_name(filename)
|
||||||
test = self.params.get('test', False)
|
test = self.params.get('test', False)
|
||||||
|
|
||||||
# Check for rtmpdump first
|
# Check for rtmpdump first
|
||||||
try:
|
if not check_executable('rtmpdump', ['-h']):
|
||||||
subprocess.call(['rtmpdump', '-h'], stdout=(open(os.path.devnull, 'w')), stderr=subprocess.STDOUT)
|
self.report_error('RTMP download detected but "rtmpdump" could not be run. Please install it.')
|
||||||
except (OSError, IOError):
|
|
||||||
self.report_error('RTMP download detected but "rtmpdump" could not be run')
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Download using rtmpdump. rtmpdump returns exit code 2 when
|
# Download using rtmpdump. rtmpdump returns exit code 2 when
|
||||||
@@ -127,8 +128,13 @@ class RtmpFD(FileDownloader):
|
|||||||
basic_args += ['--flashVer', flash_version]
|
basic_args += ['--flashVer', flash_version]
|
||||||
if live:
|
if live:
|
||||||
basic_args += ['--live']
|
basic_args += ['--live']
|
||||||
if conn:
|
if isinstance(conn, list):
|
||||||
|
for entry in conn:
|
||||||
|
basic_args += ['--conn', entry]
|
||||||
|
elif isinstance(conn, compat_str):
|
||||||
basic_args += ['--conn', conn]
|
basic_args += ['--conn', conn]
|
||||||
|
if protocol is not None:
|
||||||
|
basic_args += ['--protocol', protocol]
|
||||||
args = basic_args + [[], ['--resume', '--skip', '1']][not live and self.params.get('continuedl', False)]
|
args = basic_args + [[], ['--resume', '--skip', '1']][not live and self.params.get('continuedl', False)]
|
||||||
|
|
||||||
if sys.platform == 'win32' and sys.version_info < (3, 0):
|
if sys.platform == 'win32' and sys.version_info < (3, 0):
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
|
from .abc import ABCIE
|
||||||
from .academicearth import AcademicEarthCourseIE
|
from .academicearth import AcademicEarthCourseIE
|
||||||
from .addanime import AddAnimeIE
|
from .addanime import AddAnimeIE
|
||||||
|
from .adultswim import AdultSwimIE
|
||||||
from .aftonbladet import AftonbladetIE
|
from .aftonbladet import AftonbladetIE
|
||||||
from .anitube import AnitubeIE
|
from .anitube import AnitubeIE
|
||||||
|
from .anysex import AnySexIE
|
||||||
from .aol import AolIE
|
from .aol import AolIE
|
||||||
|
from .allocine import AllocineIE
|
||||||
from .aparat import AparatIE
|
from .aparat import AparatIE
|
||||||
from .appletrailers import AppleTrailersIE
|
from .appletrailers import AppleTrailersIE
|
||||||
from .archiveorg import ArchiveOrgIE
|
from .archiveorg import ArchiveOrgIE
|
||||||
from .ard import ARDIE
|
from .ard import ARDIE, ARDMediathekIE
|
||||||
from .arte import (
|
from .arte import (
|
||||||
ArteTvIE,
|
ArteTvIE,
|
||||||
ArteTVPlus7IE,
|
ArteTVPlus7IE,
|
||||||
@@ -20,6 +24,8 @@ from .auengine import AUEngineIE
|
|||||||
from .bambuser import BambuserIE, BambuserChannelIE
|
from .bambuser import BambuserIE, BambuserChannelIE
|
||||||
from .bandcamp import BandcampIE, BandcampAlbumIE
|
from .bandcamp import BandcampIE, BandcampAlbumIE
|
||||||
from .bbccouk import BBCCoUkIE
|
from .bbccouk import BBCCoUkIE
|
||||||
|
from .beeg import BeegIE
|
||||||
|
from .bilibili import BiliBiliIE
|
||||||
from .blinkx import BlinkxIE
|
from .blinkx import BlinkxIE
|
||||||
from .bliptv import BlipTVIE, BlipTVUserIE
|
from .bliptv import BlipTVIE, BlipTVUserIE
|
||||||
from .bloomberg import BloombergIE
|
from .bloomberg import BloombergIE
|
||||||
@@ -32,6 +38,7 @@ from .canal13cl import Canal13clIE
|
|||||||
from .canalplus import CanalplusIE
|
from .canalplus import CanalplusIE
|
||||||
from .canalc2 import Canalc2IE
|
from .canalc2 import Canalc2IE
|
||||||
from .cbs import CBSIE
|
from .cbs import CBSIE
|
||||||
|
from .cbsnews import CBSNewsIE
|
||||||
from .ceskatelevize import CeskaTelevizeIE
|
from .ceskatelevize import CeskaTelevizeIE
|
||||||
from .channel9 import Channel9IE
|
from .channel9 import Channel9IE
|
||||||
from .chilloutzone import ChilloutzoneIE
|
from .chilloutzone import ChilloutzoneIE
|
||||||
@@ -39,7 +46,9 @@ from .cinemassacre import CinemassacreIE
|
|||||||
from .clipfish import ClipfishIE
|
from .clipfish import ClipfishIE
|
||||||
from .cliphunter import CliphunterIE
|
from .cliphunter import CliphunterIE
|
||||||
from .clipsyndicate import ClipsyndicateIE
|
from .clipsyndicate import ClipsyndicateIE
|
||||||
|
from .clubic import ClubicIE
|
||||||
from .cmt import CMTIE
|
from .cmt import CMTIE
|
||||||
|
from .cnet import CNETIE
|
||||||
from .cnn import (
|
from .cnn import (
|
||||||
CNNIE,
|
CNNIE,
|
||||||
CNNBlogsIE,
|
CNNBlogsIE,
|
||||||
@@ -47,6 +56,7 @@ from .cnn import (
|
|||||||
from .collegehumor import CollegeHumorIE
|
from .collegehumor import CollegeHumorIE
|
||||||
from .comedycentral import ComedyCentralIE, ComedyCentralShowsIE
|
from .comedycentral import ComedyCentralIE, ComedyCentralShowsIE
|
||||||
from .condenast import CondeNastIE
|
from .condenast import CondeNastIE
|
||||||
|
from .cracked import CrackedIE
|
||||||
from .criterion import CriterionIE
|
from .criterion import CriterionIE
|
||||||
from .crunchyroll import CrunchyrollIE
|
from .crunchyroll import CrunchyrollIE
|
||||||
from .cspan import CSpanIE
|
from .cspan import CSpanIE
|
||||||
@@ -57,23 +67,37 @@ from .dailymotion import (
|
|||||||
DailymotionUserIE,
|
DailymotionUserIE,
|
||||||
)
|
)
|
||||||
from .daum import DaumIE
|
from .daum import DaumIE
|
||||||
|
from .dfb import DFBIE
|
||||||
from .dotsub import DotsubIE
|
from .dotsub import DotsubIE
|
||||||
from .dreisat import DreiSatIE
|
from .dreisat import DreiSatIE
|
||||||
|
from .drtuber import DrTuberIE
|
||||||
|
from .drtv import DRTVIE
|
||||||
|
from .dump import DumpIE
|
||||||
from .defense import DefenseGouvFrIE
|
from .defense import DefenseGouvFrIE
|
||||||
from .discovery import DiscoveryIE
|
from .discovery import DiscoveryIE
|
||||||
|
from .divxstage import DivxStageIE
|
||||||
from .dropbox import DropboxIE
|
from .dropbox import DropboxIE
|
||||||
from .ebaumsworld import EbaumsWorldIE
|
from .ebaumsworld import EbaumsWorldIE
|
||||||
from .ehow import EHowIE
|
from .ehow import EHowIE
|
||||||
from .eighttracks import EightTracksIE
|
from .eighttracks import EightTracksIE
|
||||||
from .eitb import EitbIE
|
from .eitb import EitbIE
|
||||||
|
from .ellentv import (
|
||||||
|
EllenTVIE,
|
||||||
|
EllenTVClipsIE,
|
||||||
|
)
|
||||||
from .elpais import ElPaisIE
|
from .elpais import ElPaisIE
|
||||||
|
from .empflix import EmpflixIE
|
||||||
from .engadget import EngadgetIE
|
from .engadget import EngadgetIE
|
||||||
|
from .eporner import EpornerIE
|
||||||
from .escapist import EscapistIE
|
from .escapist import EscapistIE
|
||||||
from .everyonesmixtape import EveryonesMixtapeIE
|
from .everyonesmixtape import EveryonesMixtapeIE
|
||||||
from .exfm import ExfmIE
|
from .exfm import ExfmIE
|
||||||
|
from .expotv import ExpoTVIE
|
||||||
from .extremetube import ExtremeTubeIE
|
from .extremetube import ExtremeTubeIE
|
||||||
from .facebook import FacebookIE
|
from .facebook import FacebookIE
|
||||||
from .faz import FazIE
|
from .faz import FazIE
|
||||||
|
from .fc2 import FC2IE
|
||||||
|
from .firedrive import FiredriveIE
|
||||||
from .firstpost import FirstpostIE
|
from .firstpost import FirstpostIE
|
||||||
from .firsttv import FirstTVIE
|
from .firsttv import FirstTVIE
|
||||||
from .fivemin import FiveMinIE
|
from .fivemin import FiveMinIE
|
||||||
@@ -83,6 +107,7 @@ from .fktv import (
|
|||||||
)
|
)
|
||||||
from .flickr import FlickrIE
|
from .flickr import FlickrIE
|
||||||
from .fourtube import FourTubeIE
|
from .fourtube import FourTubeIE
|
||||||
|
from .franceculture import FranceCultureIE
|
||||||
from .franceinter import FranceInterIE
|
from .franceinter import FranceInterIE
|
||||||
from .francetv import (
|
from .francetv import (
|
||||||
PluzzIE,
|
PluzzIE,
|
||||||
@@ -95,18 +120,31 @@ from .freesound import FreesoundIE
|
|||||||
from .freespeech import FreespeechIE
|
from .freespeech import FreespeechIE
|
||||||
from .funnyordie import FunnyOrDieIE
|
from .funnyordie import FunnyOrDieIE
|
||||||
from .gamekings import GamekingsIE
|
from .gamekings import GamekingsIE
|
||||||
|
from .gameone import (
|
||||||
|
GameOneIE,
|
||||||
|
GameOnePlaylistIE,
|
||||||
|
)
|
||||||
from .gamespot import GameSpotIE
|
from .gamespot import GameSpotIE
|
||||||
|
from .gamestar import GameStarIE
|
||||||
from .gametrailers import GametrailersIE
|
from .gametrailers import GametrailersIE
|
||||||
from .gdcvault import GDCVaultIE
|
from .gdcvault import GDCVaultIE
|
||||||
from .generic import GenericIE
|
from .generic import GenericIE
|
||||||
|
from .godtube import GodTubeIE
|
||||||
from .googleplus import GooglePlusIE
|
from .googleplus import GooglePlusIE
|
||||||
from .googlesearch import GoogleSearchIE
|
from .googlesearch import GoogleSearchIE
|
||||||
|
from .gorillavid import GorillaVidIE
|
||||||
|
from .goshgay import GoshgayIE
|
||||||
|
from .grooveshark import GroovesharkIE
|
||||||
from .hark import HarkIE
|
from .hark import HarkIE
|
||||||
from .helsinki import HelsinkiIE
|
from .helsinki import HelsinkiIE
|
||||||
|
from .hentaistigma import HentaiStigmaIE
|
||||||
|
from .hornbunny import HornBunnyIE
|
||||||
from .hotnewhiphop import HotNewHipHopIE
|
from .hotnewhiphop import HotNewHipHopIE
|
||||||
from .howcast import HowcastIE
|
from .howcast import HowcastIE
|
||||||
|
from .howstuffworks import HowStuffWorksIE
|
||||||
from .huffpost import HuffPostIE
|
from .huffpost import HuffPostIE
|
||||||
from .hypem import HypemIE
|
from .hypem import HypemIE
|
||||||
|
from .iconosquare import IconosquareIE
|
||||||
from .ign import IGNIE, OneUPIE
|
from .ign import IGNIE, OneUPIE
|
||||||
from .imdb import (
|
from .imdb import (
|
||||||
ImdbIE,
|
ImdbIE,
|
||||||
@@ -121,8 +159,10 @@ from .ivi import (
|
|||||||
IviIE,
|
IviIE,
|
||||||
IviCompilationIE
|
IviCompilationIE
|
||||||
)
|
)
|
||||||
|
from .izlesene import IzleseneIE
|
||||||
from .jadorecettepub import JadoreCettePubIE
|
from .jadorecettepub import JadoreCettePubIE
|
||||||
from .jeuxvideo import JeuxVideoIE
|
from .jeuxvideo import JeuxVideoIE
|
||||||
|
from .jove import JoveIE
|
||||||
from .jukebox import JukeboxIE
|
from .jukebox import JukeboxIE
|
||||||
from .justintv import JustinTVIE
|
from .justintv import JustinTVIE
|
||||||
from .jpopsukitv import JpopsukiIE
|
from .jpopsukitv import JpopsukiIE
|
||||||
@@ -132,10 +172,16 @@ from .khanacademy import KhanAcademyIE
|
|||||||
from .kickstarter import KickStarterIE
|
from .kickstarter import KickStarterIE
|
||||||
from .keek import KeekIE
|
from .keek import KeekIE
|
||||||
from .kontrtube import KontrTubeIE
|
from .kontrtube import KontrTubeIE
|
||||||
|
from .krasview import KrasViewIE
|
||||||
|
from .ku6 import Ku6IE
|
||||||
from .la7 import LA7IE
|
from .la7 import LA7IE
|
||||||
from .lifenews import LifeNewsIE
|
from .lifenews import LifeNewsIE
|
||||||
from .liveleak import LiveLeakIE
|
from .liveleak import LiveLeakIE
|
||||||
from .livestream import LivestreamIE, LivestreamOriginalIE
|
from .livestream import (
|
||||||
|
LivestreamIE,
|
||||||
|
LivestreamOriginalIE,
|
||||||
|
LivestreamShortenerIE,
|
||||||
|
)
|
||||||
from .lynda import (
|
from .lynda import (
|
||||||
LyndaIE,
|
LyndaIE,
|
||||||
LyndaCourseIE
|
LyndaCourseIE
|
||||||
@@ -147,15 +193,28 @@ from .malemotion import MalemotionIE
|
|||||||
from .mdr import MDRIE
|
from .mdr import MDRIE
|
||||||
from .metacafe import MetacafeIE
|
from .metacafe import MetacafeIE
|
||||||
from .metacritic import MetacriticIE
|
from .metacritic import MetacriticIE
|
||||||
|
from .ministrygrid import MinistryGridIE
|
||||||
from .mit import TechTVMITIE, MITIE, OCWMITIE
|
from .mit import TechTVMITIE, MITIE, OCWMITIE
|
||||||
|
from .mitele import MiTeleIE
|
||||||
from .mixcloud import MixcloudIE
|
from .mixcloud import MixcloudIE
|
||||||
|
from .mlb import MLBIE
|
||||||
from .mpora import MporaIE
|
from .mpora import MporaIE
|
||||||
from .mofosex import MofosexIE
|
from .mofosex import MofosexIE
|
||||||
|
from .mojvideo import MojvideoIE
|
||||||
from .mooshare import MooshareIE
|
from .mooshare import MooshareIE
|
||||||
|
from .morningstar import MorningstarIE
|
||||||
|
from .motherless import MotherlessIE
|
||||||
|
from .motorsport import MotorsportIE
|
||||||
|
from .movieclips import MovieClipsIE
|
||||||
|
from .moviezine import MoviezineIE
|
||||||
|
from .movshare import MovShareIE
|
||||||
from .mtv import (
|
from .mtv import (
|
||||||
MTVIE,
|
MTVIE,
|
||||||
|
MTVServicesEmbeddedIE,
|
||||||
MTVIggyIE,
|
MTVIggyIE,
|
||||||
)
|
)
|
||||||
|
from .musicplayon import MusicPlayOnIE
|
||||||
|
from .musicvault import MusicVaultIE
|
||||||
from .muzu import MuzuTVIE
|
from .muzu import MuzuTVIE
|
||||||
from .myspace import MySpaceIE
|
from .myspace import MySpaceIE
|
||||||
from .myspass import MySpassIE
|
from .myspass import MySpassIE
|
||||||
@@ -169,37 +228,58 @@ from .nbc import (
|
|||||||
from .ndr import NDRIE
|
from .ndr import NDRIE
|
||||||
from .ndtv import NDTVIE
|
from .ndtv import NDTVIE
|
||||||
from .newgrounds import NewgroundsIE
|
from .newgrounds import NewgroundsIE
|
||||||
|
from .newstube import NewstubeIE
|
||||||
from .nfb import NFBIE
|
from .nfb import NFBIE
|
||||||
from .nhl import NHLIE, NHLVideocenterIE
|
from .nhl import NHLIE, NHLVideocenterIE
|
||||||
from .niconico import NiconicoIE
|
from .niconico import NiconicoIE
|
||||||
from .ninegag import NineGagIE
|
from .ninegag import NineGagIE
|
||||||
|
from .noco import NocoIE
|
||||||
from .normalboots import NormalbootsIE
|
from .normalboots import NormalbootsIE
|
||||||
from .novamov import NovaMovIE
|
from .novamov import NovaMovIE
|
||||||
from .nowness import NownessIE
|
from .nowness import NownessIE
|
||||||
from .nowvideo import NowVideoIE
|
from .nowvideo import NowVideoIE
|
||||||
|
from .npo import NPOIE
|
||||||
|
from .nrk import (
|
||||||
|
NRKIE,
|
||||||
|
NRKTVIE,
|
||||||
|
)
|
||||||
from .ntv import NTVIE
|
from .ntv import NTVIE
|
||||||
from .oe1 import OE1IE
|
from .nytimes import NYTimesIE
|
||||||
|
from .nuvid import NuvidIE
|
||||||
from .ooyala import OoyalaIE
|
from .ooyala import OoyalaIE
|
||||||
from .orf import ORFIE
|
from .orf import (
|
||||||
|
ORFTVthekIE,
|
||||||
|
ORFOE1IE,
|
||||||
|
ORFFM4IE,
|
||||||
|
)
|
||||||
from .parliamentliveuk import ParliamentLiveUKIE
|
from .parliamentliveuk import ParliamentLiveUKIE
|
||||||
|
from .patreon import PatreonIE
|
||||||
from .pbs import PBSIE
|
from .pbs import PBSIE
|
||||||
from .photobucket import PhotobucketIE
|
from .photobucket import PhotobucketIE
|
||||||
|
from .playfm import PlayFMIE
|
||||||
from .playvid import PlayvidIE
|
from .playvid import PlayvidIE
|
||||||
from .podomatic import PodomaticIE
|
from .podomatic import PodomaticIE
|
||||||
from .pornhd import PornHdIE
|
from .pornhd import PornHdIE
|
||||||
from .pornhub import PornHubIE
|
from .pornhub import PornHubIE
|
||||||
from .pornotube import PornotubeIE
|
from .pornotube import PornotubeIE
|
||||||
|
from .promptfile import PromptFileIE
|
||||||
from .prosiebensat1 import ProSiebenSat1IE
|
from .prosiebensat1 import ProSiebenSat1IE
|
||||||
from .pyvideo import PyvideoIE
|
from .pyvideo import PyvideoIE
|
||||||
from .radiofrance import RadioFranceIE
|
from .radiofrance import RadioFranceIE
|
||||||
|
from .rai import RaiIE
|
||||||
from .rbmaradio import RBMARadioIE
|
from .rbmaradio import RBMARadioIE
|
||||||
from .redtube import RedTubeIE
|
from .redtube import RedTubeIE
|
||||||
|
from .reverbnation import ReverbNationIE
|
||||||
from .ringtv import RingTVIE
|
from .ringtv import RingTVIE
|
||||||
from .ro220 import Ro220IE
|
from .ro220 import Ro220IE
|
||||||
from .rottentomatoes import RottenTomatoesIE
|
from .rottentomatoes import RottenTomatoesIE
|
||||||
from .roxwel import RoxwelIE
|
from .roxwel import RoxwelIE
|
||||||
|
from .rtbf import RTBFIE
|
||||||
|
from .rtlnl import RtlXlIE
|
||||||
from .rtlnow import RTLnowIE
|
from .rtlnow import RTLnowIE
|
||||||
from .rts import RTSIE
|
from .rts import RTSIE
|
||||||
|
from .rtve import RTVEALaCartaIE, RTVELiveIE
|
||||||
|
from .ruhd import RUHDIE
|
||||||
from .rutube import (
|
from .rutube import (
|
||||||
RutubeIE,
|
RutubeIE,
|
||||||
RutubeChannelIE,
|
RutubeChannelIE,
|
||||||
@@ -207,41 +287,66 @@ from .rutube import (
|
|||||||
RutubePersonIE,
|
RutubePersonIE,
|
||||||
)
|
)
|
||||||
from .rutv import RUTVIE
|
from .rutv import RUTVIE
|
||||||
|
from .sapo import SapoIE
|
||||||
from .savefrom import SaveFromIE
|
from .savefrom import SaveFromIE
|
||||||
|
from .sbs import SBSIE
|
||||||
|
from .scivee import SciVeeIE
|
||||||
|
from .screencast import ScreencastIE
|
||||||
from .servingsys import ServingSysIE
|
from .servingsys import ServingSysIE
|
||||||
|
from .shared import SharedIE
|
||||||
from .sina import SinaIE
|
from .sina import SinaIE
|
||||||
from .slideshare import SlideshareIE
|
from .slideshare import SlideshareIE
|
||||||
|
from .slutload import SlutloadIE
|
||||||
from .smotri import (
|
from .smotri import (
|
||||||
SmotriIE,
|
SmotriIE,
|
||||||
SmotriCommunityIE,
|
SmotriCommunityIE,
|
||||||
SmotriUserIE,
|
SmotriUserIE,
|
||||||
SmotriBroadcastIE,
|
SmotriBroadcastIE,
|
||||||
)
|
)
|
||||||
|
from .snotr import SnotrIE
|
||||||
|
from .sockshare import SockshareIE
|
||||||
from .sohu import SohuIE
|
from .sohu import SohuIE
|
||||||
from .soundcloud import SoundcloudIE, SoundcloudSetIE, SoundcloudUserIE
|
from .soundcloud import (
|
||||||
from .southparkstudios import (
|
SoundcloudIE,
|
||||||
SouthParkStudiosIE,
|
SoundcloudSetIE,
|
||||||
|
SoundcloudUserIE,
|
||||||
|
SoundcloudPlaylistIE
|
||||||
|
)
|
||||||
|
from .soundgasm import SoundgasmIE
|
||||||
|
from .southpark import (
|
||||||
|
SouthParkIE,
|
||||||
SouthparkDeIE,
|
SouthparkDeIE,
|
||||||
)
|
)
|
||||||
from .space import SpaceIE
|
from .space import SpaceIE
|
||||||
from .spankwire import SpankwireIE
|
from .spankwire import SpankwireIE
|
||||||
from .spiegel import SpiegelIE
|
from .spiegel import SpiegelIE
|
||||||
|
from .spiegeltv import SpiegeltvIE
|
||||||
from .spike import SpikeIE
|
from .spike import SpikeIE
|
||||||
|
from .sportdeutschland import SportDeutschlandIE
|
||||||
from .stanfordoc import StanfordOpenClassroomIE
|
from .stanfordoc import StanfordOpenClassroomIE
|
||||||
from .statigram import StatigramIE
|
|
||||||
from .steam import SteamIE
|
from .steam import SteamIE
|
||||||
from .streamcloud import StreamcloudIE
|
from .streamcloud import StreamcloudIE
|
||||||
from .streamcz import StreamCZIE
|
from .streamcz import StreamCZIE
|
||||||
|
from .sunporno import SunPornoIE
|
||||||
|
from .swrmediathek import SWRMediathekIE
|
||||||
from .syfy import SyfyIE
|
from .syfy import SyfyIE
|
||||||
from .sztvhu import SztvHuIE
|
from .sztvhu import SztvHuIE
|
||||||
|
from .tagesschau import TagesschauIE
|
||||||
|
from .teachertube import (
|
||||||
|
TeacherTubeIE,
|
||||||
|
TeacherTubeUserIE,
|
||||||
|
)
|
||||||
|
from .teachingchannel import TeachingChannelIE
|
||||||
from .teamcoco import TeamcocoIE
|
from .teamcoco import TeamcocoIE
|
||||||
from .techtalks import TechTalksIE
|
from .techtalks import TechTalksIE
|
||||||
from .ted import TEDIE
|
from .ted import TEDIE
|
||||||
|
from .tenplay import TenPlayIE
|
||||||
from .testurl import TestURLIE
|
from .testurl import TestURLIE
|
||||||
from .tf1 import TF1IE
|
from .tf1 import TF1IE
|
||||||
from .theplatform import ThePlatformIE
|
from .theplatform import ThePlatformIE
|
||||||
from .thisav import ThisAVIE
|
from .thisav import ThisAVIE
|
||||||
from .tinypic import TinyPicIE
|
from .tinypic import TinyPicIE
|
||||||
|
from .tlc import TlcIE, TlcDeIE
|
||||||
from .toutv import TouTvIE
|
from .toutv import TouTvIE
|
||||||
from .toypics import ToypicsUserIE, ToypicsIE
|
from .toypics import ToypicsUserIE, ToypicsIE
|
||||||
from .traileraddict import TrailerAddictIE
|
from .traileraddict import TrailerAddictIE
|
||||||
@@ -253,6 +358,8 @@ from .tumblr import TumblrIE
|
|||||||
from .tutv import TutvIE
|
from .tutv import TutvIE
|
||||||
from .tvigle import TvigleIE
|
from .tvigle import TvigleIE
|
||||||
from .tvp import TvpIE
|
from .tvp import TvpIE
|
||||||
|
from .tvplay import TVPlayIE
|
||||||
|
from .ubu import UbuIE
|
||||||
from .udemy import (
|
from .udemy import (
|
||||||
UdemyIE,
|
UdemyIE,
|
||||||
UdemyCourseIE
|
UdemyCourseIE
|
||||||
@@ -265,12 +372,16 @@ from .veehd import VeeHDIE
|
|||||||
from .veoh import VeohIE
|
from .veoh import VeohIE
|
||||||
from .vesti import VestiIE
|
from .vesti import VestiIE
|
||||||
from .vevo import VevoIE
|
from .vevo import VevoIE
|
||||||
|
from .vh1 import VH1IE
|
||||||
from .viddler import ViddlerIE
|
from .viddler import ViddlerIE
|
||||||
from .videobam import VideoBamIE
|
from .videobam import VideoBamIE
|
||||||
from .videodetective import VideoDetectiveIE
|
from .videodetective import VideoDetectiveIE
|
||||||
from .videolecturesnet import VideoLecturesNetIE
|
from .videolecturesnet import VideoLecturesNetIE
|
||||||
from .videofyme import VideofyMeIE
|
from .videofyme import VideofyMeIE
|
||||||
from .videopremium import VideoPremiumIE
|
from .videopremium import VideoPremiumIE
|
||||||
|
from .videott import VideoTtIE
|
||||||
|
from .videoweed import VideoWeedIE
|
||||||
|
from .vidme import VidmeIE
|
||||||
from .vimeo import (
|
from .vimeo import (
|
||||||
VimeoIE,
|
VimeoIE,
|
||||||
VimeoChannelIE,
|
VimeoChannelIE,
|
||||||
@@ -278,22 +389,35 @@ from .vimeo import (
|
|||||||
VimeoAlbumIE,
|
VimeoAlbumIE,
|
||||||
VimeoGroupsIE,
|
VimeoGroupsIE,
|
||||||
VimeoReviewIE,
|
VimeoReviewIE,
|
||||||
|
VimeoWatchLaterIE,
|
||||||
|
)
|
||||||
|
from .vimple import VimpleIE
|
||||||
|
from .vine import (
|
||||||
|
VineIE,
|
||||||
|
VineUserIE,
|
||||||
)
|
)
|
||||||
from .vine import VineIE
|
|
||||||
from .viki import VikiIE
|
from .viki import VikiIE
|
||||||
from .vk import VKIE
|
from .vk import VKIE
|
||||||
|
from .vodlocker import VodlockerIE
|
||||||
|
from .vporn import VpornIE
|
||||||
from .vube import VubeIE
|
from .vube import VubeIE
|
||||||
|
from .vuclip import VuClipIE
|
||||||
|
from .vulture import VultureIE
|
||||||
from .washingtonpost import WashingtonPostIE
|
from .washingtonpost import WashingtonPostIE
|
||||||
from .wat import WatIE
|
from .wat import WatIE
|
||||||
|
from .wayofthemaster import WayOfTheMasterIE
|
||||||
from .wdr import (
|
from .wdr import (
|
||||||
WDRIE,
|
WDRIE,
|
||||||
|
WDRMobileIE,
|
||||||
WDRMausIE,
|
WDRMausIE,
|
||||||
)
|
)
|
||||||
from .weibo import WeiboIE
|
from .weibo import WeiboIE
|
||||||
from .wimp import WimpIE
|
from .wimp import WimpIE
|
||||||
from .wistia import WistiaIE
|
from .wistia import WistiaIE
|
||||||
from .worldstarhiphop import WorldStarHipHopIE
|
from .worldstarhiphop import WorldStarHipHopIE
|
||||||
|
from .wrzuta import WrzutaIE
|
||||||
from .xbef import XBefIE
|
from .xbef import XBefIE
|
||||||
|
from .xboxclips import XboxClipsIE
|
||||||
from .xhamster import XHamsterIE
|
from .xhamster import XHamsterIE
|
||||||
from .xnxx import XNXXIE
|
from .xnxx import XNXXIE
|
||||||
from .xvideos import XVideosIE
|
from .xvideos import XVideosIE
|
||||||
@@ -323,6 +447,7 @@ from .youtube import (
|
|||||||
YoutubeUserIE,
|
YoutubeUserIE,
|
||||||
YoutubeWatchLaterIE,
|
YoutubeWatchLaterIE,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .zdf import ZDFIE
|
from .zdf import ZDFIE
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
48
youtube_dl/extractor/abc.py
Normal file
48
youtube_dl/extractor/abc.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class ABCIE(InfoExtractor):
|
||||||
|
IE_NAME = 'abc.net.au'
|
||||||
|
_VALID_URL = r'http://www\.abc\.net\.au/news/[^/]+/[^/]+/(?P<id>\d+)'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.abc.net.au/news/2014-07-25/bringing-asylum-seekers-to-australia-would-give/5624716',
|
||||||
|
'md5': 'dad6f8ad011a70d9ddf887ce6d5d0742',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '5624716',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Bringing asylum seekers to Australia would give them right to asylum claims: professor',
|
||||||
|
'description': 'md5:ba36fa5e27e5c9251fd929d339aea4af',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
urls_info_json = self._search_regex(
|
||||||
|
r'inlineVideoData\.push\((.*?)\);', webpage, 'video urls',
|
||||||
|
flags=re.DOTALL)
|
||||||
|
urls_info = json.loads(urls_info_json.replace('\'', '"'))
|
||||||
|
formats = [{
|
||||||
|
'url': url_info['url'],
|
||||||
|
'width': int(url_info['width']),
|
||||||
|
'height': int(url_info['height']),
|
||||||
|
'tbr': int(url_info['bitrate']),
|
||||||
|
'filesize': int(url_info['filesize']),
|
||||||
|
} for url_info in urls_info]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': self._og_search_title(webpage),
|
||||||
|
'formats': formats,
|
||||||
|
'description': self._og_search_description(webpage),
|
||||||
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
|
}
|
||||||
@@ -7,6 +7,15 @@ from .common import InfoExtractor
|
|||||||
class AcademicEarthCourseIE(InfoExtractor):
|
class AcademicEarthCourseIE(InfoExtractor):
|
||||||
_VALID_URL = r'^https?://(?:www\.)?academicearth\.org/playlists/(?P<id>[^?#/]+)'
|
_VALID_URL = r'^https?://(?:www\.)?academicearth\.org/playlists/(?P<id>[^?#/]+)'
|
||||||
IE_NAME = 'AcademicEarth:Course'
|
IE_NAME = 'AcademicEarth:Course'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://academicearth.org/playlists/laws-of-nature/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'laws-of-nature',
|
||||||
|
'title': 'Laws of Nature',
|
||||||
|
'description': 'Introduce yourself to the laws of nature with these free online college lectures from Yale, Harvard, and MIT.',
|
||||||
|
},
|
||||||
|
'playlist_count': 4,
|
||||||
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
m = re.match(self._VALID_URL, url)
|
m = re.match(self._VALID_URL, url)
|
||||||
|
|||||||
139
youtube_dl/extractor/adultswim.py
Normal file
139
youtube_dl/extractor/adultswim.py
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
class AdultSwimIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://video\.adultswim\.com/(?P<path>.+?)(?:\.html)?(?:\?.*)?(?:#.*)?$'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://video.adultswim.com/rick-and-morty/close-rick-counters-of-the-rick-kind.html?x=y#title',
|
||||||
|
'playlist': [
|
||||||
|
{
|
||||||
|
'md5': '4da359ec73b58df4575cd01a610ba5dc',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '8a250ba1450996e901453d7f02ca02f5',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Rick and Morty Close Rick-Counters of the Rick Kind part 1',
|
||||||
|
'description': 'Rick has a run in with some old associates, resulting in a fallout with Morty. You got any chips, broh?',
|
||||||
|
'uploader': 'Rick and Morty',
|
||||||
|
'thumbnail': 'http://i.cdn.turner.com/asfix/repository/8a250ba13f865824013fc9db8b6b0400/thumbnail_267549017116827057.jpg'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'md5': 'ffbdf55af9331c509d95350bd0cc1819',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '8a250ba1450996e901453d7f4bd102f6',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Rick and Morty Close Rick-Counters of the Rick Kind part 2',
|
||||||
|
'description': 'Rick has a run in with some old associates, resulting in a fallout with Morty. You got any chips, broh?',
|
||||||
|
'uploader': 'Rick and Morty',
|
||||||
|
'thumbnail': 'http://i.cdn.turner.com/asfix/repository/8a250ba13f865824013fc9db8b6b0400/thumbnail_267549017116827057.jpg'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'md5': 'b92409635540304280b4b6c36bd14a0a',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '8a250ba1450996e901453d7fa73c02f7',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Rick and Morty Close Rick-Counters of the Rick Kind part 3',
|
||||||
|
'description': 'Rick has a run in with some old associates, resulting in a fallout with Morty. You got any chips, broh?',
|
||||||
|
'uploader': 'Rick and Morty',
|
||||||
|
'thumbnail': 'http://i.cdn.turner.com/asfix/repository/8a250ba13f865824013fc9db8b6b0400/thumbnail_267549017116827057.jpg'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'md5': 'e8818891d60e47b29cd89d7b0278156d',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '8a250ba1450996e901453d7fc8ba02f8',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Rick and Morty Close Rick-Counters of the Rick Kind part 4',
|
||||||
|
'description': 'Rick has a run in with some old associates, resulting in a fallout with Morty. You got any chips, broh?',
|
||||||
|
'uploader': 'Rick and Morty',
|
||||||
|
'thumbnail': 'http://i.cdn.turner.com/asfix/repository/8a250ba13f865824013fc9db8b6b0400/thumbnail_267549017116827057.jpg'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
_video_extensions = {
|
||||||
|
'3500': 'flv',
|
||||||
|
'640': 'mp4',
|
||||||
|
'150': 'mp4',
|
||||||
|
'ipad': 'm3u8',
|
||||||
|
'iphone': 'm3u8'
|
||||||
|
}
|
||||||
|
_video_dimensions = {
|
||||||
|
'3500': (1280, 720),
|
||||||
|
'640': (480, 270),
|
||||||
|
'150': (320, 180)
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_path = mobj.group('path')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_path)
|
||||||
|
episode_id = self._html_search_regex(r'<link rel="video_src" href="http://i\.adultswim\.com/adultswim/adultswimtv/tools/swf/viralplayer.swf\?id=([0-9a-f]+?)"\s*/?\s*>', webpage, 'episode_id')
|
||||||
|
title = self._og_search_title(webpage)
|
||||||
|
|
||||||
|
index_url = 'http://asfix.adultswim.com/asfix-svc/episodeSearch/getEpisodesByIDs?networkName=AS&ids=%s' % episode_id
|
||||||
|
idoc = self._download_xml(index_url, title, 'Downloading episode index', 'Unable to download episode index')
|
||||||
|
|
||||||
|
episode_el = idoc.find('.//episode')
|
||||||
|
show_title = episode_el.attrib.get('collectionTitle')
|
||||||
|
episode_title = episode_el.attrib.get('title')
|
||||||
|
thumbnail = episode_el.attrib.get('thumbnailUrl')
|
||||||
|
description = episode_el.find('./description').text.strip()
|
||||||
|
|
||||||
|
entries = []
|
||||||
|
segment_els = episode_el.findall('./segments/segment')
|
||||||
|
|
||||||
|
for part_num, segment_el in enumerate(segment_els):
|
||||||
|
segment_id = segment_el.attrib.get('id')
|
||||||
|
segment_title = '%s %s part %d' % (show_title, episode_title, part_num + 1)
|
||||||
|
thumbnail = segment_el.attrib.get('thumbnailUrl')
|
||||||
|
duration = segment_el.attrib.get('duration')
|
||||||
|
|
||||||
|
segment_url = 'http://asfix.adultswim.com/asfix-svc/episodeservices/getCvpPlaylist?networkName=AS&id=%s' % segment_id
|
||||||
|
idoc = self._download_xml(segment_url, segment_title, 'Downloading segment information', 'Unable to download segment information')
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
file_els = idoc.findall('.//files/file')
|
||||||
|
|
||||||
|
for file_el in file_els:
|
||||||
|
bitrate = file_el.attrib.get('bitrate')
|
||||||
|
type = file_el.attrib.get('type')
|
||||||
|
width, height = self._video_dimensions.get(bitrate, (None, None))
|
||||||
|
formats.append({
|
||||||
|
'format_id': '%s-%s' % (bitrate, type),
|
||||||
|
'url': file_el.text,
|
||||||
|
'ext': self._video_extensions.get(bitrate, 'mp4'),
|
||||||
|
# The bitrate may not be a number (for example: 'iphone')
|
||||||
|
'tbr': int(bitrate) if bitrate.isdigit() else None,
|
||||||
|
'height': height,
|
||||||
|
'width': width
|
||||||
|
})
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
entries.append({
|
||||||
|
'id': segment_id,
|
||||||
|
'title': segment_title,
|
||||||
|
'formats': formats,
|
||||||
|
'uploader': show_title,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'duration': duration,
|
||||||
|
'description': description
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'id': episode_id,
|
||||||
|
'display_id': video_path,
|
||||||
|
'entries': entries,
|
||||||
|
'title': '%s %s' % (show_title, episode_title),
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import datetime
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -16,6 +15,7 @@ class AftonbladetIE(InfoExtractor):
|
|||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Vulkanutbrott i rymden - nu släpper NASA bilderna',
|
'title': 'Vulkanutbrott i rymden - nu släpper NASA bilderna',
|
||||||
'description': 'Jupiters måne mest aktiv av alla himlakroppar',
|
'description': 'Jupiters måne mest aktiv av alla himlakroppar',
|
||||||
|
'timestamp': 1394142732,
|
||||||
'upload_date': '20140306',
|
'upload_date': '20140306',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -27,17 +27,17 @@ class AftonbladetIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
# find internal video meta data
|
# find internal video meta data
|
||||||
META_URL = 'http://aftonbladet-play.drlib.aptoma.no/video/%s.json'
|
meta_url = 'http://aftonbladet-play.drlib.aptoma.no/video/%s.json'
|
||||||
internal_meta_id = self._html_search_regex(
|
internal_meta_id = self._html_search_regex(
|
||||||
r'data-aptomaId="([\w\d]+)"', webpage, 'internal_meta_id')
|
r'data-aptomaId="([\w\d]+)"', webpage, 'internal_meta_id')
|
||||||
internal_meta_url = META_URL % internal_meta_id
|
internal_meta_url = meta_url % internal_meta_id
|
||||||
internal_meta_json = self._download_json(
|
internal_meta_json = self._download_json(
|
||||||
internal_meta_url, video_id, 'Downloading video meta data')
|
internal_meta_url, video_id, 'Downloading video meta data')
|
||||||
|
|
||||||
# find internal video formats
|
# find internal video formats
|
||||||
FORMATS_URL = 'http://aftonbladet-play.videodata.drvideo.aptoma.no/actions/video/?id=%s'
|
format_url = 'http://aftonbladet-play.videodata.drvideo.aptoma.no/actions/video/?id=%s'
|
||||||
internal_video_id = internal_meta_json['videoId']
|
internal_video_id = internal_meta_json['videoId']
|
||||||
internal_formats_url = FORMATS_URL % internal_video_id
|
internal_formats_url = format_url % internal_video_id
|
||||||
internal_formats_json = self._download_json(
|
internal_formats_json = self._download_json(
|
||||||
internal_formats_url, video_id, 'Downloading video formats')
|
internal_formats_url, video_id, 'Downloading video formats')
|
||||||
|
|
||||||
@@ -54,16 +54,13 @@ class AftonbladetIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
timestamp = datetime.datetime.fromtimestamp(internal_meta_json['timePublished'])
|
|
||||||
upload_date = timestamp.strftime('%Y%m%d')
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': internal_meta_json['title'],
|
'title': internal_meta_json['title'],
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnail': internal_meta_json['imageUrl'],
|
'thumbnail': internal_meta_json['imageUrl'],
|
||||||
'description': internal_meta_json['shortPreamble'],
|
'description': internal_meta_json['shortPreamble'],
|
||||||
'upload_date': upload_date,
|
'timestamp': internal_meta_json['timePublished'],
|
||||||
'duration': internal_meta_json['duration'],
|
'duration': internal_meta_json['duration'],
|
||||||
'view_count': internal_meta_json['views'],
|
'view_count': internal_meta_json['views'],
|
||||||
}
|
}
|
||||||
|
|||||||
89
youtube_dl/extractor/allocine.py
Normal file
89
youtube_dl/extractor/allocine.py
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
compat_str,
|
||||||
|
qualities,
|
||||||
|
determine_ext,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class AllocineIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?allocine\.fr/(?P<typ>article|video|film)/(fichearticle_gen_carticle=|player_gen_cmedia=|fichefilm_gen_cfilm=)(?P<id>[0-9]+)(?:\.html)?'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'http://www.allocine.fr/article/fichearticle_gen_carticle=18635087.html',
|
||||||
|
'md5': '0c9fcf59a841f65635fa300ac43d8269',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '19546517',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Astérix - Le Domaine des Dieux Teaser VF',
|
||||||
|
'description': 'md5:4a754271d9c6f16c72629a8a993ee884',
|
||||||
|
'thumbnail': 're:http://.*\.jpg',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://www.allocine.fr/video/player_gen_cmedia=19540403&cfilm=222257.html',
|
||||||
|
'md5': 'd0cdce5d2b9522ce279fdfec07ff16e0',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '19540403',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Planes 2 Bande-annonce VF',
|
||||||
|
'description': 'md5:eeaffe7c2d634525e21159b93acf3b1e',
|
||||||
|
'thumbnail': 're:http://.*\.jpg',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'http://www.allocine.fr/film/fichefilm_gen_cfilm=181290.html',
|
||||||
|
'md5': '101250fb127ef9ca3d73186ff22a47ce',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '19544709',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Dragons 2 - Bande annonce finale VF',
|
||||||
|
'description': 'md5:71742e3a74b0d692c7fce0dd2017a4ac',
|
||||||
|
'thumbnail': 're:http://.*\.jpg',
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
typ = mobj.group('typ')
|
||||||
|
display_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
|
if typ == 'film':
|
||||||
|
video_id = self._search_regex(r'href="/video/player_gen_cmedia=([0-9]+).+"', webpage, 'video id')
|
||||||
|
else:
|
||||||
|
player = self._search_regex(r'data-player=\'([^\']+)\'>', webpage, 'data player')
|
||||||
|
|
||||||
|
player_data = json.loads(player)
|
||||||
|
video_id = compat_str(player_data['refMedia'])
|
||||||
|
|
||||||
|
xml = self._download_xml('http://www.allocine.fr/ws/AcVisiondataV4.ashx?media=%s' % video_id, display_id)
|
||||||
|
|
||||||
|
video = xml.find('.//AcVisionVideo').attrib
|
||||||
|
quality = qualities(['ld', 'md', 'hd'])
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
for k, v in video.items():
|
||||||
|
if re.match(r'.+_path', k):
|
||||||
|
format_id = k.split('_')[0]
|
||||||
|
formats.append({
|
||||||
|
'format_id': format_id,
|
||||||
|
'quality': quality(format_id),
|
||||||
|
'url': v,
|
||||||
|
'ext': determine_ext(v),
|
||||||
|
})
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': video['videoTitle'],
|
||||||
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
|
'formats': formats,
|
||||||
|
'description': self._og_search_description(webpage),
|
||||||
|
}
|
||||||
@@ -1,22 +1,24 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class AnitubeIE(InfoExtractor):
|
class AnitubeIE(InfoExtractor):
|
||||||
IE_NAME = u'anitube.se'
|
IE_NAME = 'anitube.se'
|
||||||
_VALID_URL = r'https?://(?:www\.)?anitube\.se/video/(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?anitube\.se/video/(?P<id>\d+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.anitube.se/video/36621',
|
'url': 'http://www.anitube.se/video/36621',
|
||||||
u'md5': u'59d0eeae28ea0bc8c05e7af429998d43',
|
'md5': '59d0eeae28ea0bc8c05e7af429998d43',
|
||||||
u'file': u'36621.mp4',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '36621',
|
||||||
u'id': u'36621',
|
'ext': 'mp4',
|
||||||
u'ext': u'mp4',
|
'title': 'Recorder to Randoseru 01',
|
||||||
u'title': u'Recorder to Randoseru 01',
|
'duration': 180.19,
|
||||||
},
|
},
|
||||||
u'skip': u'Blocked in the US',
|
'skip': 'Blocked in the US',
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@@ -24,13 +26,15 @@ class AnitubeIE(InfoExtractor):
|
|||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
key = self._html_search_regex(r'http://www\.anitube\.se/embed/([A-Za-z0-9_-]*)',
|
key = self._html_search_regex(
|
||||||
webpage, u'key')
|
r'http://www\.anitube\.se/embed/([A-Za-z0-9_-]*)', webpage, 'key')
|
||||||
|
|
||||||
config_xml = self._download_xml('http://www.anitube.se/nuevo/econfig.php?key=%s' % key,
|
config_xml = self._download_xml(
|
||||||
key)
|
'http://www.anitube.se/nuevo/econfig.php?key=%s' % key, key)
|
||||||
|
|
||||||
video_title = config_xml.find('title').text
|
video_title = config_xml.find('title').text
|
||||||
|
thumbnail = config_xml.find('image').text
|
||||||
|
duration = float(config_xml.find('duration').text)
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
video_url = config_xml.find('file')
|
video_url = config_xml.find('file')
|
||||||
@@ -49,5 +53,7 @@ class AnitubeIE(InfoExtractor):
|
|||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'duration': duration,
|
||||||
'formats': formats
|
'formats': formats
|
||||||
}
|
}
|
||||||
|
|||||||
61
youtube_dl/extractor/anysex.py
Normal file
61
youtube_dl/extractor/anysex.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
parse_duration,
|
||||||
|
int_or_none,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class AnySexIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?anysex\.com/(?P<id>\d+)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://anysex.com/156592/',
|
||||||
|
'md5': '023e9fbb7f7987f5529a394c34ad3d3d',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '156592',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Busty and sexy blondie in her bikini strips for you',
|
||||||
|
'description': 'md5:de9e418178e2931c10b62966474e1383',
|
||||||
|
'categories': ['Erotic'],
|
||||||
|
'duration': 270,
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
video_url = self._html_search_regex(r"video_url\s*:\s*'([^']+)'", webpage, 'video URL')
|
||||||
|
|
||||||
|
title = self._html_search_regex(r'<title>(.*?)</title>', webpage, 'title')
|
||||||
|
description = self._html_search_regex(
|
||||||
|
r'<div class="description">([^<]+)</div>', webpage, 'description', fatal=False)
|
||||||
|
thumbnail = self._html_search_regex(
|
||||||
|
r'preview_url\s*:\s*\'(.*?)\'', webpage, 'thumbnail', fatal=False)
|
||||||
|
|
||||||
|
categories = re.findall(
|
||||||
|
r'<a href="http://anysex\.com/categories/[^"]+" title="[^"]*">([^<]+)</a>', webpage)
|
||||||
|
|
||||||
|
duration = parse_duration(self._search_regex(
|
||||||
|
r'<b>Duration:</b> (\d+:\d+)', webpage, 'duration', fatal=False))
|
||||||
|
view_count = int_or_none(self._html_search_regex(
|
||||||
|
r'<b>Views:</b> (\d+)', webpage, 'view count', fatal=False))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'categories': categories,
|
||||||
|
'duration': duration,
|
||||||
|
'view_count': view_count,
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
||||||
@@ -8,9 +8,20 @@ from .fivemin import FiveMinIE
|
|||||||
|
|
||||||
class AolIE(InfoExtractor):
|
class AolIE(InfoExtractor):
|
||||||
IE_NAME = 'on.aol.com'
|
IE_NAME = 'on.aol.com'
|
||||||
_VALID_URL = r'http://on\.aol\.com/video/.*-(?P<id>\d+)($|\?)'
|
_VALID_URL = r'''(?x)
|
||||||
|
(?:
|
||||||
|
aol-video:|
|
||||||
|
http://on\.aol\.com/
|
||||||
|
(?:
|
||||||
|
video/.*-|
|
||||||
|
playlist/(?P<playlist_display_id>[^/?#]+?)-(?P<playlist_id>[0-9]+)[?#].*_videoid=
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(?P<id>[0-9]+)
|
||||||
|
(?:$|\?)
|
||||||
|
'''
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://on.aol.com/video/u-s--official-warns-of-largest-ever-irs-phone-scam-518167793?icid=OnHomepageC2Wide_MustSee_Img',
|
'url': 'http://on.aol.com/video/u-s--official-warns-of-largest-ever-irs-phone-scam-518167793?icid=OnHomepageC2Wide_MustSee_Img',
|
||||||
'md5': '18ef68f48740e86ae94b98da815eec42',
|
'md5': '18ef68f48740e86ae94b98da815eec42',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@@ -19,10 +30,43 @@ class AolIE(InfoExtractor):
|
|||||||
'title': 'U.S. Official Warns Of \'Largest Ever\' IRS Phone Scam',
|
'title': 'U.S. Official Warns Of \'Largest Ever\' IRS Phone Scam',
|
||||||
},
|
},
|
||||||
'add_ie': ['FiveMin'],
|
'add_ie': ['FiveMin'],
|
||||||
}
|
}, {
|
||||||
|
'url': 'http://on.aol.com/playlist/brace-yourself---todays-weirdest-news-152147?icid=OnHomepageC4_Omg_Img#_videoid=518184316',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '152147',
|
||||||
|
'title': 'Brace Yourself - Today\'s Weirdest News',
|
||||||
|
},
|
||||||
|
'playlist_mincount': 10,
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
self.to_screen('Downloading 5min.com video %s' % video_id)
|
|
||||||
|
playlist_id = mobj.group('playlist_id')
|
||||||
|
if playlist_id and not self._downloader.params.get('noplaylist'):
|
||||||
|
self.to_screen('Downloading playlist %s - add --no-playlist to just download video %s' % (playlist_id, video_id))
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
|
title = self._html_search_regex(
|
||||||
|
r'<h1 class="video-title[^"]*">(.+?)</h1>', webpage, 'title')
|
||||||
|
playlist_html = self._search_regex(
|
||||||
|
r"(?s)<ul\s+class='video-related[^']*'>(.*?)</ul>", webpage,
|
||||||
|
'playlist HTML')
|
||||||
|
entries = [{
|
||||||
|
'_type': 'url',
|
||||||
|
'url': 'aol-video:%s' % m.group('id'),
|
||||||
|
'ie_key': 'Aol',
|
||||||
|
} for m in re.finditer(
|
||||||
|
r"<a\s+href='.*videoid=(?P<id>[0-9]+)'\s+class='video-thumb'>",
|
||||||
|
playlist_html)]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'id': playlist_id,
|
||||||
|
'display_id': mobj.group('playlist_display_id'),
|
||||||
|
'title': title,
|
||||||
|
'entries': entries,
|
||||||
|
}
|
||||||
|
|
||||||
return FiveMinIE._build_result(video_id)
|
return FiveMinIE._build_result(video_id)
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#coding: utf-8
|
#coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -13,13 +15,14 @@ class AparatIE(InfoExtractor):
|
|||||||
_VALID_URL = r'^https?://(?:www\.)?aparat\.com/(?:v/|video/video/embed/videohash/)(?P<id>[a-zA-Z0-9]+)'
|
_VALID_URL = r'^https?://(?:www\.)?aparat\.com/(?:v/|video/video/embed/videohash/)(?P<id>[a-zA-Z0-9]+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.aparat.com/v/wP8On',
|
'url': 'http://www.aparat.com/v/wP8On',
|
||||||
u'file': u'wP8On.mp4',
|
'md5': '6714e0af7e0d875c5a39c4dc4ab46ad1',
|
||||||
u'md5': u'6714e0af7e0d875c5a39c4dc4ab46ad1',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': 'wP8On',
|
||||||
u"title": u"تیم گلکسی 11 - زومیت",
|
'ext': 'mp4',
|
||||||
|
'title': 'تیم گلکسی 11 - زومیت',
|
||||||
},
|
},
|
||||||
#u'skip': u'Extremely unreliable',
|
# 'skip': 'Extremely unreliable',
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@@ -29,8 +32,8 @@ class AparatIE(InfoExtractor):
|
|||||||
# Note: There is an easier-to-parse configuration at
|
# Note: There is an easier-to-parse configuration at
|
||||||
# http://www.aparat.com/video/video/config/videohash/%video_id
|
# http://www.aparat.com/video/video/config/videohash/%video_id
|
||||||
# but the URL in there does not work
|
# but the URL in there does not work
|
||||||
embed_url = (u'http://www.aparat.com/video/video/embed/videohash/' +
|
embed_url = ('http://www.aparat.com/video/video/embed/videohash/' +
|
||||||
video_id + u'/vt/frame')
|
video_id + '/vt/frame')
|
||||||
webpage = self._download_webpage(embed_url, video_id)
|
webpage = self._download_webpage(embed_url, video_id)
|
||||||
|
|
||||||
video_urls = re.findall(r'fileList\[[0-9]+\]\s*=\s*"([^"]+)"', webpage)
|
video_urls = re.findall(r'fileList\[[0-9]+\]\s*=\s*"([^"]+)"', webpage)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import json
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urlparse,
|
compat_urlparse,
|
||||||
|
int_or_none,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -110,8 +111,8 @@ class AppleTrailersIE(InfoExtractor):
|
|||||||
formats.append({
|
formats.append({
|
||||||
'url': format_url,
|
'url': format_url,
|
||||||
'format': format['type'],
|
'format': format['type'],
|
||||||
'width': format['width'],
|
'width': int_or_none(format['width']),
|
||||||
'height': int(format['height']),
|
'height': int_or_none(format['height']),
|
||||||
})
|
})
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|||||||
@@ -7,23 +7,38 @@ from .common import InfoExtractor
|
|||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
determine_ext,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
qualities,
|
||||||
|
compat_urllib_parse_urlparse,
|
||||||
|
compat_urllib_parse,
|
||||||
|
int_or_none,
|
||||||
|
parse_duration,
|
||||||
|
unified_strdate,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ARDIE(InfoExtractor):
|
class ARDMediathekIE(InfoExtractor):
|
||||||
_VALID_URL = r'^https?://(?:(?:www\.)?ardmediathek\.de|mediathek\.daserste\.de)/(?:.*/)(?P<video_id>[^/\?]+)(?:\?.*)?'
|
IE_NAME = 'ARD:mediathek'
|
||||||
|
_VALID_URL = r'^https?://(?:(?:www\.)?ardmediathek\.de|mediathek\.daserste\.de)/(?:.*/)(?P<video_id>[0-9]+|[^0-9][^/\?]+)[^/\?]*(?:\?.*)?'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://www.ardmediathek.de/das-erste/guenther-jauch/edward-snowden-im-interview-held-oder-verraeter?documentId=19288786',
|
'url': 'http://mediathek.daserste.de/sendungen_a-z/328454_anne-will/22429276_vertrauen-ist-gut-spionieren-ist-besser-geht',
|
||||||
'file': '19288786.mp4',
|
'file': '22429276.mp4',
|
||||||
'md5': '515bf47ce209fb3f5a61b7aad364634c',
|
'md5': '469751912f1de0816a9fc9df8336476c',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'title': 'Edward Snowden im Interview - Held oder Verräter?',
|
'title': 'Vertrauen ist gut, Spionieren ist besser - Geht so deutsch-amerikanische Freundschaft?',
|
||||||
'description': 'Edward Snowden hat alles aufs Spiel gesetzt, um die weltweite \xdcberwachung durch die Geheimdienste zu enttarnen. Nun stellt sich der ehemalige NSA-Mitarbeiter erstmals weltweit in einem TV-Interview den Fragen eines NDR-Journalisten. Die Sendung vom Sonntagabend.',
|
'description': 'Das Erste Mediathek [ARD]: Vertrauen ist gut, Spionieren ist besser - Geht so deutsch-amerikanische Freundschaft?, Anne Will, Über die Spionage-Affäre diskutieren Clemens Binninger, Katrin Göring-Eckardt, Georg Mascolo, Andrew B. Denison und Constanze Kurz.. Das Video zur Sendung Anne Will am Mittwoch, 16.07.2014',
|
||||||
'thumbnail': 'http://www.ardmediathek.de/ard/servlet/contentblob/19/28/87/90/19288790/bild/2250037',
|
|
||||||
},
|
},
|
||||||
'skip': 'Blocked outside of Germany',
|
'skip': 'Blocked outside of Germany',
|
||||||
}
|
}, {
|
||||||
|
'url': 'http://www.ardmediathek.de/tv/Tatort/Das-Wunder-von-Wolbeck-Video-tgl-ab-20/Das-Erste/Video?documentId=22490580&bcastId=602916',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '22490580',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Das Wunder von Wolbeck (Video tgl. ab 20 Uhr)',
|
||||||
|
'description': 'Auf einem restaurierten Hof bei Wolbeck wird der Heilpraktiker Raffael Lembeck eines morgens von seiner Frau Stella tot aufgefunden. Das Opfer war offensichtlich in seiner Praxis zu Fall gekommen und ist dann verblutet, erklärt Prof. Boerne am Tatort.',
|
||||||
|
},
|
||||||
|
'skip': 'Blocked outside of Germany',
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
# determine video id from url
|
# determine video id from url
|
||||||
@@ -35,42 +50,78 @@ class ARDIE(InfoExtractor):
|
|||||||
else:
|
else:
|
||||||
video_id = m.group('video_id')
|
video_id = m.group('video_id')
|
||||||
|
|
||||||
|
urlp = compat_urllib_parse_urlparse(url)
|
||||||
|
url = urlp._replace(path=compat_urllib_parse.quote(urlp.path.encode('utf-8'))).geturl()
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
if '>Der gewünschte Beitrag ist nicht mehr verfügbar.<' in webpage:
|
||||||
|
raise ExtractorError('Video %s is no longer available' % video_id, expected=True)
|
||||||
|
|
||||||
title = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'<h1(?:\s+class="boxTopHeadline")?>(.*?)</h1>', webpage, 'title')
|
[r'<h1(?:\s+class="boxTopHeadline")?>(.*?)</h1>',
|
||||||
|
r'<meta name="dcterms.title" content="(.*?)"/>',
|
||||||
|
r'<h4 class="headline">(.*?)</h4>'],
|
||||||
|
webpage, 'title')
|
||||||
description = self._html_search_meta(
|
description = self._html_search_meta(
|
||||||
'dcterms.abstract', webpage, 'description')
|
'dcterms.abstract', webpage, 'description', default=None)
|
||||||
thumbnail = self._og_search_thumbnail(webpage)
|
if description is None:
|
||||||
|
description = self._html_search_meta(
|
||||||
|
'description', webpage, 'meta description')
|
||||||
|
|
||||||
streams = [
|
# Thumbnail is sometimes not present.
|
||||||
mo.groupdict()
|
# It is in the mobile version, but that seems to use a different URL
|
||||||
for mo in re.finditer(
|
# structure altogether.
|
||||||
r'mediaCollection\.addMediaStream\((?P<media_type>\d+), (?P<quality>\d+), "(?P<rtmp_url>[^"]*)", "(?P<video_url>[^"]*)", "[^"]*"\)', webpage)]
|
thumbnail = self._og_search_thumbnail(webpage, default=None)
|
||||||
if not streams:
|
|
||||||
if '"fsk"' in webpage:
|
|
||||||
raise ExtractorError('This video is only available after 20:00')
|
|
||||||
|
|
||||||
formats = []
|
media_streams = re.findall(r'''(?x)
|
||||||
for s in streams:
|
mediaCollection\.addMediaStream\([0-9]+,\s*[0-9]+,\s*"[^"]*",\s*
|
||||||
format = {
|
"([^"]+)"''', webpage)
|
||||||
'quality': int(s['quality']),
|
|
||||||
}
|
|
||||||
if s.get('rtmp_url'):
|
|
||||||
format['protocol'] = 'rtmp'
|
|
||||||
format['url'] = s['rtmp_url']
|
|
||||||
format['playpath'] = s['video_url']
|
|
||||||
else:
|
|
||||||
format['url'] = s['video_url']
|
|
||||||
|
|
||||||
quality_name = self._search_regex(
|
if media_streams:
|
||||||
r'[,.]([a-zA-Z0-9_-]+),?\.mp4', format['url'],
|
QUALITIES = qualities(['lo', 'hi', 'hq'])
|
||||||
'quality name', default='NA')
|
formats = []
|
||||||
format['format_id'] = '%s-%s-%s-%s' % (
|
for furl in set(media_streams):
|
||||||
determine_ext(format['url']), quality_name, s['media_type'],
|
if furl.endswith('.f4m'):
|
||||||
s['quality'])
|
fid = 'f4m'
|
||||||
|
else:
|
||||||
|
fid_m = re.match(r'.*\.([^.]+)\.[^.]+$', furl)
|
||||||
|
fid = fid_m.group(1) if fid_m else None
|
||||||
|
formats.append({
|
||||||
|
'quality': QUALITIES(fid),
|
||||||
|
'format_id': fid,
|
||||||
|
'url': furl,
|
||||||
|
})
|
||||||
|
else: # request JSON file
|
||||||
|
media_info = self._download_json(
|
||||||
|
'http://www.ardmediathek.de/play/media/%s' % video_id, video_id)
|
||||||
|
# The second element of the _mediaArray contains the standard http urls
|
||||||
|
streams = media_info['_mediaArray'][1]['_mediaStreamArray']
|
||||||
|
if not streams:
|
||||||
|
if '"fsk"' in webpage:
|
||||||
|
raise ExtractorError('This video is only available after 20:00')
|
||||||
|
|
||||||
formats.append(format)
|
formats = []
|
||||||
|
for s in streams:
|
||||||
|
if type(s['_stream']) == list:
|
||||||
|
for index, url in enumerate(s['_stream'][::-1]):
|
||||||
|
quality = s['_quality'] + index
|
||||||
|
formats.append({
|
||||||
|
'quality': quality,
|
||||||
|
'url': url,
|
||||||
|
'format_id': '%s-%s' % (determine_ext(url), quality)
|
||||||
|
})
|
||||||
|
continue
|
||||||
|
|
||||||
|
format = {
|
||||||
|
'quality': s['_quality'],
|
||||||
|
'url': s['_stream'],
|
||||||
|
}
|
||||||
|
|
||||||
|
format['format_id'] = '%s-%s' % (
|
||||||
|
determine_ext(format['url']), format['quality'])
|
||||||
|
|
||||||
|
formats.append(format)
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
@@ -81,3 +132,60 @@ class ARDIE(InfoExtractor):
|
|||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ARDIE(InfoExtractor):
|
||||||
|
_VALID_URL = '(?P<mainurl>https?://(www\.)?daserste\.de/[^?#]+/videos/(?P<display_id>[^/?#]+)-(?P<id>[0-9]+))\.html'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.daserste.de/information/reportage-dokumentation/dokus/videos/die-story-im-ersten-mission-unter-falscher-flagge-100.html',
|
||||||
|
'md5': 'd216c3a86493f9322545e045ddc3eb35',
|
||||||
|
'info_dict': {
|
||||||
|
'display_id': 'die-story-im-ersten-mission-unter-falscher-flagge',
|
||||||
|
'id': '100',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'duration': 2600,
|
||||||
|
'title': 'Die Story im Ersten: Mission unter falscher Flagge',
|
||||||
|
'upload_date': '20140804',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
display_id = mobj.group('display_id')
|
||||||
|
|
||||||
|
player_url = mobj.group('mainurl') + '~playerXml.xml'
|
||||||
|
doc = self._download_xml(player_url, display_id)
|
||||||
|
video_node = doc.find('./video')
|
||||||
|
upload_date = unified_strdate(video_node.find('./broadcastDate').text)
|
||||||
|
thumbnail = video_node.find('.//teaserImage//variant/url').text
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
for a in video_node.findall('.//asset'):
|
||||||
|
f = {
|
||||||
|
'format_id': a.attrib['type'],
|
||||||
|
'width': int_or_none(a.find('./frameWidth').text),
|
||||||
|
'height': int_or_none(a.find('./frameHeight').text),
|
||||||
|
'vbr': int_or_none(a.find('./bitrateVideo').text),
|
||||||
|
'abr': int_or_none(a.find('./bitrateAudio').text),
|
||||||
|
'vcodec': a.find('./codecVideo').text,
|
||||||
|
'tbr': int_or_none(a.find('./totalBitrate').text),
|
||||||
|
}
|
||||||
|
if a.find('./serverPrefix').text:
|
||||||
|
f['url'] = a.find('./serverPrefix').text
|
||||||
|
f['playpath'] = a.find('./fileName').text
|
||||||
|
else:
|
||||||
|
f['url'] = a.find('./fileName').text
|
||||||
|
formats.append(f)
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': mobj.group('id'),
|
||||||
|
'formats': formats,
|
||||||
|
'display_id': display_id,
|
||||||
|
'title': video_node.find('./title').text,
|
||||||
|
'duration': parse_duration(video_node.find('./duration').text),
|
||||||
|
'upload_date': upload_date,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,10 @@ class ArteTvIE(InfoExtractor):
|
|||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'forma_id': q.attrib['quality'],
|
'forma_id': q.attrib['quality'],
|
||||||
'url': q.text,
|
# The playpath starts at 'mp4:', if we don't manually
|
||||||
|
# split the url, rtmpdump will incorrectly parse them
|
||||||
|
'url': q.text.split('mp4:', 1)[0],
|
||||||
|
'play_path': 'mp4:' + q.text.split('mp4:', 1)[1],
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'quality': 2 if q.attrib['quality'] == 'hd' else 1,
|
'quality': 2 if q.attrib['quality'] == 'hd' else 1,
|
||||||
} for q in config.findall('./urls/url')]
|
} for q in config.findall('./urls/url')]
|
||||||
@@ -74,7 +77,8 @@ class ArteTVPlus7IE(InfoExtractor):
|
|||||||
return self._extract_from_webpage(webpage, video_id, lang)
|
return self._extract_from_webpage(webpage, video_id, lang)
|
||||||
|
|
||||||
def _extract_from_webpage(self, webpage, video_id, lang):
|
def _extract_from_webpage(self, webpage, video_id, lang):
|
||||||
json_url = self._html_search_regex(r'arte_vp_url="(.*?)"', webpage, 'json url')
|
json_url = self._html_search_regex(
|
||||||
|
r'arte_vp_url="(.*?)"', webpage, 'json vp url')
|
||||||
return self._extract_from_json_url(json_url, video_id, lang)
|
return self._extract_from_json_url(json_url, video_id, lang)
|
||||||
|
|
||||||
def _extract_from_json_url(self, json_url, video_id, lang):
|
def _extract_from_json_url(self, json_url, video_id, lang):
|
||||||
@@ -105,29 +109,36 @@ class ArteTVPlus7IE(InfoExtractor):
|
|||||||
regexes = [r'VO?%s' % l, r'VO?.-ST%s' % l]
|
regexes = [r'VO?%s' % l, r'VO?.-ST%s' % l]
|
||||||
return any(re.match(r, f['versionCode']) for r in regexes)
|
return any(re.match(r, f['versionCode']) for r in regexes)
|
||||||
# Some formats may not be in the same language as the url
|
# Some formats may not be in the same language as the url
|
||||||
|
# TODO: Might want not to drop videos that does not match requested language
|
||||||
|
# but to process those formats with lower precedence
|
||||||
formats = filter(_match_lang, all_formats)
|
formats = filter(_match_lang, all_formats)
|
||||||
formats = list(formats) # in python3 filter returns an iterator
|
formats = list(formats) # in python3 filter returns an iterator
|
||||||
if not formats:
|
if not formats:
|
||||||
# Some videos are only available in the 'Originalversion'
|
# Some videos are only available in the 'Originalversion'
|
||||||
# they aren't tagged as being in French or German
|
# they aren't tagged as being in French or German
|
||||||
if all(f['versionCode'] == 'VO' for f in all_formats):
|
# Sometimes there are neither videos of requested lang code
|
||||||
formats = all_formats
|
# nor original version videos available
|
||||||
else:
|
# For such cases we just take all_formats as is
|
||||||
raise ExtractorError(u'The formats list is empty')
|
formats = all_formats
|
||||||
|
if not formats:
|
||||||
|
raise ExtractorError('The formats list is empty')
|
||||||
|
|
||||||
if re.match(r'[A-Z]Q', formats[0]['quality']) is not None:
|
if re.match(r'[A-Z]Q', formats[0]['quality']) is not None:
|
||||||
def sort_key(f):
|
def sort_key(f):
|
||||||
return ['HQ', 'MQ', 'EQ', 'SQ'].index(f['quality'])
|
return ['HQ', 'MQ', 'EQ', 'SQ'].index(f['quality'])
|
||||||
else:
|
else:
|
||||||
def sort_key(f):
|
def sort_key(f):
|
||||||
|
versionCode = f.get('versionCode')
|
||||||
|
if versionCode is None:
|
||||||
|
versionCode = ''
|
||||||
return (
|
return (
|
||||||
# Sort first by quality
|
# Sort first by quality
|
||||||
int(f.get('height',-1)),
|
int(f.get('height', -1)),
|
||||||
int(f.get('bitrate',-1)),
|
int(f.get('bitrate', -1)),
|
||||||
# The original version with subtitles has lower relevance
|
# The original version with subtitles has lower relevance
|
||||||
re.match(r'VO-ST(F|A)', f.get('versionCode', '')) is None,
|
re.match(r'VO-ST(F|A)', versionCode) is None,
|
||||||
# The version with sourds/mal subtitles has also lower relevance
|
# The version with sourds/mal subtitles has also lower relevance
|
||||||
re.match(r'VO?(F|A)-STM\1', f.get('versionCode', '')) is None,
|
re.match(r'VO?(F|A)-STM\1', versionCode) is None,
|
||||||
# Prefer http downloads over m3u8
|
# Prefer http downloads over m3u8
|
||||||
0 if f['url'].endswith('m3u8') else 1,
|
0 if f['url'].endswith('m3u8') else 1,
|
||||||
)
|
)
|
||||||
@@ -166,16 +177,26 @@ class ArteTVPlus7IE(InfoExtractor):
|
|||||||
# It also uses the arte_vp_url url from the webpage to extract the information
|
# It also uses the arte_vp_url url from the webpage to extract the information
|
||||||
class ArteTVCreativeIE(ArteTVPlus7IE):
|
class ArteTVCreativeIE(ArteTVPlus7IE):
|
||||||
IE_NAME = 'arte.tv:creative'
|
IE_NAME = 'arte.tv:creative'
|
||||||
_VALID_URL = r'https?://creative\.arte\.tv/(?P<lang>fr|de)/magazine?/(?P<id>.+)'
|
_VALID_URL = r'https?://creative\.arte\.tv/(?P<lang>fr|de)/(?:magazine?/)?(?P<id>[^?#]+)'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://creative.arte.tv/de/magazin/agentur-amateur-corporate-design',
|
'url': 'http://creative.arte.tv/de/magazin/agentur-amateur-corporate-design',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '050489-002',
|
'id': '72176',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Agentur Amateur / Agence Amateur #2 : Corporate Design',
|
'title': 'Folge 2 - Corporate Design',
|
||||||
|
'upload_date': '20131004',
|
||||||
},
|
},
|
||||||
}
|
}, {
|
||||||
|
'url': 'http://creative.arte.tv/fr/Monty-Python-Reunion',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '160676',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Monty Python live (mostly)',
|
||||||
|
'description': 'Événement ! Quarante-cinq ans après leurs premiers succès, les légendaires Monty Python remontent sur scène.\n',
|
||||||
|
'upload_date': '20140805',
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
class ArteTVFutureIE(ArteTVPlus7IE):
|
class ArteTVFutureIE(ArteTVPlus7IE):
|
||||||
@@ -185,9 +206,10 @@ class ArteTVFutureIE(ArteTVPlus7IE):
|
|||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://future.arte.tv/fr/sujet/info-sciences#article-anchor-7081',
|
'url': 'http://future.arte.tv/fr/sujet/info-sciences#article-anchor-7081',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '050940-003',
|
'id': '5201',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Les champignons au secours de la planète',
|
'title': 'Les champignons au secours de la planète',
|
||||||
|
'upload_date': '20131101',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,13 @@ class BambuserChannelIE(InfoExtractor):
|
|||||||
_VALID_URL = r'https?://bambuser\.com/channel/(?P<user>.*?)(?:/|#|\?|$)'
|
_VALID_URL = r'https?://bambuser\.com/channel/(?P<user>.*?)(?:/|#|\?|$)'
|
||||||
# The maximum number we can get with each request
|
# The maximum number we can get with each request
|
||||||
_STEP = 50
|
_STEP = 50
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://bambuser.com/channel/pixelversity',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'pixelversity',
|
||||||
|
},
|
||||||
|
'playlist_mincount': 60,
|
||||||
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
@@ -73,10 +80,10 @@ class BambuserChannelIE(InfoExtractor):
|
|||||||
req = compat_urllib_request.Request(req_url)
|
req = compat_urllib_request.Request(req_url)
|
||||||
# Without setting this header, we wouldn't get any result
|
# Without setting this header, we wouldn't get any result
|
||||||
req.add_header('Referer', 'http://bambuser.com/channel/%s' % user)
|
req.add_header('Referer', 'http://bambuser.com/channel/%s' % user)
|
||||||
info_json = self._download_webpage(req, user,
|
data = self._download_json(
|
||||||
'Downloading page %d' % i)
|
req, user, 'Downloading page %d' % i)
|
||||||
results = json.loads(info_json)['result']
|
results = data['result']
|
||||||
if len(results) == 0:
|
if not results:
|
||||||
break
|
break
|
||||||
last_id = results[-1]['vid']
|
last_id = results[-1]['vid']
|
||||||
urls.extend(self.url_result(v['page'], 'Bambuser') for v in results)
|
urls.extend(self.url_result(v['page'], 'Bambuser') for v in results)
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class BandcampIE(InfoExtractor):
|
class BandcampIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://.*?\.bandcamp\.com/track/(?P<title>.*)'
|
_VALID_URL = r'https?://.*?\.bandcamp\.com/track/(?P<title>.*)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://youtube-dl.bandcamp.com/track/youtube-dl-test-song',
|
'url': 'http://youtube-dl.bandcamp.com/track/youtube-dl-test-song',
|
||||||
'file': '1812978515.mp3',
|
'file': '1812978515.mp3',
|
||||||
'md5': 'c557841d5e50261777a6585648adf439',
|
'md5': 'c557841d5e50261777a6585648adf439',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
"title": "youtube-dl \"'/\\\u00e4\u21ad - youtube-dl test song \"'/\\\u00e4\u21ad",
|
"title": "youtube-dl \"'/\\\u00e4\u21ad - youtube-dl test song \"'/\\\u00e4\u21ad",
|
||||||
"duration": 10,
|
"duration": 9.8485,
|
||||||
},
|
},
|
||||||
'_skip': 'There is a limit of 200 free downloads / month for the test song'
|
'_skip': 'There is a limit of 200 free downloads / month for the test song'
|
||||||
}]
|
}]
|
||||||
@@ -28,36 +28,32 @@ class BandcampIE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
title = mobj.group('title')
|
title = mobj.group('title')
|
||||||
webpage = self._download_webpage(url, title)
|
webpage = self._download_webpage(url, title)
|
||||||
# We get the link to the free download page
|
|
||||||
m_download = re.search(r'freeDownloadPage: "(.*?)"', webpage)
|
m_download = re.search(r'freeDownloadPage: "(.*?)"', webpage)
|
||||||
if m_download is None:
|
if not m_download:
|
||||||
m_trackinfo = re.search(r'trackinfo: (.+),\s*?\n', webpage)
|
m_trackinfo = re.search(r'trackinfo: (.+),\s*?\n', webpage)
|
||||||
if m_trackinfo:
|
if m_trackinfo:
|
||||||
json_code = m_trackinfo.group(1)
|
json_code = m_trackinfo.group(1)
|
||||||
data = json.loads(json_code)
|
data = json.loads(json_code)[0]
|
||||||
d = data[0]
|
|
||||||
|
|
||||||
duration = int(round(d['duration']))
|
|
||||||
formats = []
|
formats = []
|
||||||
for format_id, format_url in d['file'].items():
|
for format_id, format_url in data['file'].items():
|
||||||
ext, _, abr_str = format_id.partition('-')
|
ext, abr_str = format_id.split('-', 1)
|
||||||
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': format_id,
|
'format_id': format_id,
|
||||||
'url': format_url,
|
'url': format_url,
|
||||||
'ext': format_id.partition('-')[0],
|
'ext': ext,
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
'acodec': format_id.partition('-')[0],
|
'acodec': ext,
|
||||||
'abr': int(format_id.partition('-')[2]),
|
'abr': int(abr_str),
|
||||||
})
|
})
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': compat_str(d['id']),
|
'id': compat_str(data['id']),
|
||||||
'title': d['title'],
|
'title': data['title'],
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'duration': duration,
|
'duration': float(data['duration']),
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
raise ExtractorError('No free songs found')
|
raise ExtractorError('No free songs found')
|
||||||
@@ -67,11 +63,9 @@ class BandcampIE(InfoExtractor):
|
|||||||
r'var TralbumData = {(.*?)id: (?P<id>\d*?)$',
|
r'var TralbumData = {(.*?)id: (?P<id>\d*?)$',
|
||||||
webpage, re.MULTILINE | re.DOTALL).group('id')
|
webpage, re.MULTILINE | re.DOTALL).group('id')
|
||||||
|
|
||||||
download_webpage = self._download_webpage(download_link, video_id,
|
download_webpage = self._download_webpage(download_link, video_id, 'Downloading free downloads page')
|
||||||
'Downloading free downloads page')
|
# We get the dictionary of the track from some javascript code
|
||||||
# We get the dictionary of the track from some javascrip code
|
info = re.search(r'items: (.*?),$', download_webpage, re.MULTILINE).group(1)
|
||||||
info = re.search(r'items: (.*?),$',
|
|
||||||
download_webpage, re.MULTILINE).group(1)
|
|
||||||
info = json.loads(info)[0]
|
info = json.loads(info)[0]
|
||||||
# We pick mp3-320 for now, until format selection can be easily implemented.
|
# We pick mp3-320 for now, until format selection can be easily implemented.
|
||||||
mp3_info = info['downloads']['mp3-320']
|
mp3_info = info['downloads']['mp3-320']
|
||||||
@@ -100,9 +94,9 @@ class BandcampIE(InfoExtractor):
|
|||||||
|
|
||||||
class BandcampAlbumIE(InfoExtractor):
|
class BandcampAlbumIE(InfoExtractor):
|
||||||
IE_NAME = 'Bandcamp:album'
|
IE_NAME = 'Bandcamp:album'
|
||||||
_VALID_URL = r'http://.*?\.bandcamp\.com/album/(?P<title>.*)'
|
_VALID_URL = r'https?://(?:(?P<subdomain>[^.]+)\.)?bandcamp\.com(?:/album/(?P<title>[^?#]+))'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://blazo.bandcamp.com/album/jazz-format-mixtape-vol-1',
|
'url': 'http://blazo.bandcamp.com/album/jazz-format-mixtape-vol-1',
|
||||||
'playlist': [
|
'playlist': [
|
||||||
{
|
{
|
||||||
@@ -123,13 +117,21 @@ class BandcampAlbumIE(InfoExtractor):
|
|||||||
'params': {
|
'params': {
|
||||||
'playlistend': 2
|
'playlistend': 2
|
||||||
},
|
},
|
||||||
'skip': 'Bancamp imposes download limits. See test_playlists:test_bandcamp_album for the playlist test'
|
'skip': 'Bandcamp imposes download limits. See test_playlists:test_bandcamp_album for the playlist test'
|
||||||
}
|
}, {
|
||||||
|
'url': 'http://nightbringer.bandcamp.com/album/hierophany-of-the-open-grave',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'Hierophany of the Open Grave',
|
||||||
|
},
|
||||||
|
'playlist_mincount': 9,
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
playlist_id = mobj.group('subdomain')
|
||||||
title = mobj.group('title')
|
title = mobj.group('title')
|
||||||
webpage = self._download_webpage(url, title)
|
display_id = title or playlist_id
|
||||||
|
webpage = self._download_webpage(url, display_id)
|
||||||
tracks_paths = re.findall(r'<a href="(.*?)" itemprop="url">', webpage)
|
tracks_paths = re.findall(r'<a href="(.*?)" itemprop="url">', webpage)
|
||||||
if not tracks_paths:
|
if not tracks_paths:
|
||||||
raise ExtractorError('The page doesn\'t contain any tracks')
|
raise ExtractorError('The page doesn\'t contain any tracks')
|
||||||
@@ -139,6 +141,8 @@ class BandcampAlbumIE(InfoExtractor):
|
|||||||
title = self._search_regex(r'album_title : "(.*?)"', webpage, 'title')
|
title = self._search_regex(r'album_title : "(.*?)"', webpage, 'title')
|
||||||
return {
|
return {
|
||||||
'_type': 'playlist',
|
'_type': 'playlist',
|
||||||
|
'id': playlist_id,
|
||||||
|
'display_id': display_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'entries': entries,
|
'entries': entries,
|
||||||
}
|
}
|
||||||
|
|||||||
57
youtube_dl/extractor/beeg.py
Normal file
57
youtube_dl/extractor/beeg.py
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class BeegIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?beeg\.com/(?P<id>\d+)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://beeg.com/5416503',
|
||||||
|
'md5': '634526ae978711f6b748fe0dd6c11f57',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '5416503',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Sultry Striptease',
|
||||||
|
'description': 'md5:6db3c6177972822aaba18652ff59c773',
|
||||||
|
'categories': list, # NSFW
|
||||||
|
'thumbnail': 're:https?://.*\.jpg$',
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
video_url = self._html_search_regex(
|
||||||
|
r"'480p'\s*:\s*'([^']+)'", webpage, 'video URL')
|
||||||
|
|
||||||
|
title = self._html_search_regex(
|
||||||
|
r'<title>([^<]+)\s*-\s*beeg\.?</title>', webpage, 'title')
|
||||||
|
|
||||||
|
description = self._html_search_regex(
|
||||||
|
r'<meta name="description" content="([^"]*)"',
|
||||||
|
webpage, 'description', fatal=False)
|
||||||
|
thumbnail = self._html_search_regex(
|
||||||
|
r'\'previewer.url\'\s*:\s*"([^"]*)"',
|
||||||
|
webpage, 'thumbnail', fatal=False)
|
||||||
|
|
||||||
|
categories_str = self._html_search_regex(
|
||||||
|
r'<meta name="keywords" content="([^"]+)"', webpage, 'categories', fatal=False)
|
||||||
|
categories = (
|
||||||
|
None if categories_str is None
|
||||||
|
else categories_str.split(','))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'categories': categories,
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
||||||
106
youtube_dl/extractor/bilibili.py
Normal file
106
youtube_dl/extractor/bilibili.py
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
compat_parse_qs,
|
||||||
|
ExtractorError,
|
||||||
|
int_or_none,
|
||||||
|
unified_strdate,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class BiliBiliIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'http://www\.bilibili\.(?:tv|com)/video/av(?P<id>[0-9]+)/'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.bilibili.tv/video/av1074402/',
|
||||||
|
'md5': '2c301e4dab317596e837c3e7633e7d86',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1074402',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': '【金坷垃】金泡沫',
|
||||||
|
'duration': 308,
|
||||||
|
'upload_date': '20140420',
|
||||||
|
'thumbnail': 're:^https?://.+\.jpg',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
video_code = self._search_regex(
|
||||||
|
r'(?s)<div itemprop="video".*?>(.*?)</div>', webpage, 'video code')
|
||||||
|
|
||||||
|
title = self._html_search_meta(
|
||||||
|
'media:title', video_code, 'title', fatal=True)
|
||||||
|
duration_str = self._html_search_meta(
|
||||||
|
'duration', video_code, 'duration')
|
||||||
|
if duration_str is None:
|
||||||
|
duration = None
|
||||||
|
else:
|
||||||
|
duration_mobj = re.match(
|
||||||
|
r'^T(?:(?P<hours>[0-9]+)H)?(?P<minutes>[0-9]+)M(?P<seconds>[0-9]+)S$',
|
||||||
|
duration_str)
|
||||||
|
duration = (
|
||||||
|
int_or_none(duration_mobj.group('hours'), default=0) * 3600 +
|
||||||
|
int(duration_mobj.group('minutes')) * 60 +
|
||||||
|
int(duration_mobj.group('seconds')))
|
||||||
|
upload_date = unified_strdate(self._html_search_meta(
|
||||||
|
'uploadDate', video_code, fatal=False))
|
||||||
|
thumbnail = self._html_search_meta(
|
||||||
|
'thumbnailUrl', video_code, 'thumbnail', fatal=False)
|
||||||
|
|
||||||
|
player_params = compat_parse_qs(self._html_search_regex(
|
||||||
|
r'<iframe .*?class="player" src="https://secure\.bilibili\.(?:tv|com)/secure,([^"]+)"',
|
||||||
|
webpage, 'player params'))
|
||||||
|
|
||||||
|
if 'cid' in player_params:
|
||||||
|
cid = player_params['cid'][0]
|
||||||
|
|
||||||
|
lq_doc = self._download_xml(
|
||||||
|
'http://interface.bilibili.cn/v_cdn_play?cid=%s' % cid,
|
||||||
|
video_id,
|
||||||
|
note='Downloading LQ video info'
|
||||||
|
)
|
||||||
|
lq_durl = lq_doc.find('.//durl')
|
||||||
|
formats = [{
|
||||||
|
'format_id': 'lq',
|
||||||
|
'quality': 1,
|
||||||
|
'url': lq_durl.find('./url').text,
|
||||||
|
'filesize': int_or_none(
|
||||||
|
lq_durl.find('./size'), get_attr='text'),
|
||||||
|
}]
|
||||||
|
|
||||||
|
hq_doc = self._download_xml(
|
||||||
|
'http://interface.bilibili.cn/playurl?cid=%s' % cid,
|
||||||
|
video_id,
|
||||||
|
note='Downloading HQ video info',
|
||||||
|
fatal=False,
|
||||||
|
)
|
||||||
|
if hq_doc is not False:
|
||||||
|
hq_durl = hq_doc.find('.//durl')
|
||||||
|
formats.append({
|
||||||
|
'format_id': 'hq',
|
||||||
|
'quality': 2,
|
||||||
|
'ext': 'flv',
|
||||||
|
'url': hq_durl.find('./url').text,
|
||||||
|
'filesize': int_or_none(
|
||||||
|
hq_durl.find('./size'), get_attr='text'),
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
raise ExtractorError('Unsupported player parameters: %r' % (player_params,))
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'formats': formats,
|
||||||
|
'duration': duration,
|
||||||
|
'upload_date': upload_date,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
}
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import datetime
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import remove_start
|
||||||
remove_start,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class BlinkxIE(InfoExtractor):
|
class BlinkxIE(InfoExtractor):
|
||||||
@@ -16,18 +13,21 @@ class BlinkxIE(InfoExtractor):
|
|||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.blinkx.com/ce/8aQUy7GVFYgFzpKhT0oqsilwOGFRVXk3R1ZGWWdGenBLaFQwb3FzaWx3OGFRVXk3R1ZGWWdGenB',
|
'url': 'http://www.blinkx.com/ce/8aQUy7GVFYgFzpKhT0oqsilwOGFRVXk3R1ZGWWdGenBLaFQwb3FzaWx3OGFRVXk3R1ZGWWdGenB',
|
||||||
'file': '8aQUy7GV.mp4',
|
|
||||||
'md5': '2e9a07364af40163a908edbf10bb2492',
|
'md5': '2e9a07364af40163a908edbf10bb2492',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
"title": "Police Car Rolls Away",
|
'id': '8aQUy7GV',
|
||||||
"uploader": "stupidvideos.com",
|
'ext': 'mp4',
|
||||||
"upload_date": "20131215",
|
'title': 'Police Car Rolls Away',
|
||||||
"description": "A police car gently rolls away from a fight. Maybe it felt weird being around a confrontation and just had to get out of there!",
|
'uploader': 'stupidvideos.com',
|
||||||
"duration": 14.886,
|
'upload_date': '20131215',
|
||||||
"thumbnails": [{
|
'timestamp': 1387068000,
|
||||||
"width": 100,
|
'description': 'A police car gently rolls away from a fight. Maybe it felt weird being around a confrontation and just had to get out of there!',
|
||||||
"height": 76,
|
'duration': 14.886,
|
||||||
"url": "http://cdn.blinkx.com/stream/b/41/StupidVideos/20131215/1873969261/1873969261_tn_0.jpg",
|
'thumbnails': [{
|
||||||
|
'width': 100,
|
||||||
|
'height': 76,
|
||||||
|
'resolution': '100x76',
|
||||||
|
'url': 'http://cdn.blinkx.com/stream/b/41/StupidVideos/20131215/1873969261/1873969261_tn_0.jpg',
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -37,13 +37,10 @@ class BlinkxIE(InfoExtractor):
|
|||||||
video_id = m.group('id')
|
video_id = m.group('id')
|
||||||
display_id = video_id[:8]
|
display_id = video_id[:8]
|
||||||
|
|
||||||
api_url = (u'https://apib4.blinkx.com/api.php?action=play_video&' +
|
api_url = ('https://apib4.blinkx.com/api.php?action=play_video&' +
|
||||||
'video=%s' % video_id)
|
'video=%s' % video_id)
|
||||||
data_json = self._download_webpage(api_url, display_id)
|
data_json = self._download_webpage(api_url, display_id)
|
||||||
data = json.loads(data_json)['api']['results'][0]
|
data = json.loads(data_json)['api']['results'][0]
|
||||||
dt = datetime.datetime.fromtimestamp(data['pubdate_epoch'])
|
|
||||||
pload_date = dt.strftime('%Y%m%d')
|
|
||||||
|
|
||||||
duration = None
|
duration = None
|
||||||
thumbnails = []
|
thumbnails = []
|
||||||
formats = []
|
formats = []
|
||||||
@@ -55,19 +52,16 @@ class BlinkxIE(InfoExtractor):
|
|||||||
'height': int(m['h']),
|
'height': int(m['h']),
|
||||||
})
|
})
|
||||||
elif m['type'] == 'original':
|
elif m['type'] == 'original':
|
||||||
duration = m['d']
|
duration = float(m['d'])
|
||||||
elif m['type'] == 'youtube':
|
elif m['type'] == 'youtube':
|
||||||
yt_id = m['link']
|
yt_id = m['link']
|
||||||
self.to_screen(u'Youtube video detected: %s' % yt_id)
|
self.to_screen('Youtube video detected: %s' % yt_id)
|
||||||
return self.url_result(yt_id, 'Youtube', video_id=yt_id)
|
return self.url_result(yt_id, 'Youtube', video_id=yt_id)
|
||||||
elif m['type'] in ('flv', 'mp4'):
|
elif m['type'] in ('flv', 'mp4'):
|
||||||
vcodec = remove_start(m['vcodec'], 'ff')
|
vcodec = remove_start(m['vcodec'], 'ff')
|
||||||
acodec = remove_start(m['acodec'], 'ff')
|
acodec = remove_start(m['acodec'], 'ff')
|
||||||
tbr = (int(m['vbr']) + int(m['abr'])) // 1000
|
tbr = (int(m['vbr']) + int(m['abr'])) // 1000
|
||||||
format_id = (u'%s-%sk-%s' %
|
format_id = '%s-%sk-%s' % (vcodec, tbr, m['w'])
|
||||||
(vcodec,
|
|
||||||
tbr,
|
|
||||||
m['w']))
|
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': format_id,
|
'format_id': format_id,
|
||||||
'url': m['link'],
|
'url': m['link'],
|
||||||
@@ -88,7 +82,7 @@ class BlinkxIE(InfoExtractor):
|
|||||||
'title': data['title'],
|
'title': data['title'],
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'uploader': data['channel_name'],
|
'uploader': data['channel_name'],
|
||||||
'upload_date': pload_date,
|
'timestamp': data['pubdate_epoch'],
|
||||||
'description': data.get('description'),
|
'description': data.get('description'),
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
|
|||||||
@@ -1,102 +1,139 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import datetime
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from .subtitles import SubtitlesInfoExtractor
|
from .subtitles import SubtitlesInfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_str,
|
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
|
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
|
parse_iso8601,
|
||||||
|
compat_urlparse,
|
||||||
|
clean_html,
|
||||||
|
compat_str,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BlipTVIE(SubtitlesInfoExtractor):
|
class BlipTVIE(SubtitlesInfoExtractor):
|
||||||
"""Information extractor for blip.tv"""
|
_VALID_URL = r'https?://(?:\w+\.)?blip\.tv/(?:(?:.+-|rss/flash/)(?P<id>\d+)|((?:play/|api\.swf#)(?P<lookup_id>[\da-zA-Z+_]+)))'
|
||||||
|
|
||||||
_VALID_URL = r'https?://(?:\w+\.)?blip\.tv/((.+/)|(play/)|(api\.swf#))(?P<presumptive_id>.+)$'
|
_TESTS = [
|
||||||
|
{
|
||||||
_TESTS = [{
|
'url': 'http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352',
|
||||||
'url': 'http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352',
|
'md5': 'c6934ad0b6acf2bd920720ec888eb812',
|
||||||
'md5': 'c6934ad0b6acf2bd920720ec888eb812',
|
'info_dict': {
|
||||||
'info_dict': {
|
'id': '5779306',
|
||||||
'id': '5779306',
|
'ext': 'mov',
|
||||||
'ext': 'mov',
|
'title': 'CBR EXCLUSIVE: "Gotham City Imposters" Bats VS Jokerz Short 3',
|
||||||
'upload_date': '20111205',
|
'description': 'md5:9bc31f227219cde65e47eeec8d2dc596',
|
||||||
'description': 'md5:9bc31f227219cde65e47eeec8d2dc596',
|
'timestamp': 1323138843,
|
||||||
'uploader': 'Comic Book Resources - CBR TV',
|
'upload_date': '20111206',
|
||||||
'title': 'CBR EXCLUSIVE: "Gotham City Imposters" Bats VS Jokerz Short 3',
|
'uploader': 'cbr',
|
||||||
|
'uploader_id': '679425',
|
||||||
|
'duration': 81,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
# https://github.com/rg3/youtube-dl/pull/2274
|
||||||
|
'note': 'Video with subtitles',
|
||||||
|
'url': 'http://blip.tv/play/h6Uag5OEVgI.html',
|
||||||
|
'md5': '309f9d25b820b086ca163ffac8031806',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '6586561',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Red vs. Blue Season 11 Episode 1',
|
||||||
|
'description': 'One-Zero-One',
|
||||||
|
'timestamp': 1371261608,
|
||||||
|
'upload_date': '20130615',
|
||||||
|
'uploader': 'redvsblue',
|
||||||
|
'uploader_id': '792887',
|
||||||
|
'duration': 279,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=967465
|
||||||
|
'url': 'http://a.blip.tv/api.swf#h6Uag5KbVwI',
|
||||||
|
'md5': '314e87b1ebe7a48fcbfdd51b791ce5a6',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '6573122',
|
||||||
|
'ext': 'mov',
|
||||||
|
'upload_date': '20130520',
|
||||||
|
'description': 'Two hapless space marines argue over what to do when they realize they have an astronomically huge problem on their hands.',
|
||||||
|
'title': 'Red vs. Blue Season 11 Trailer',
|
||||||
|
'timestamp': 1369029609,
|
||||||
|
'uploader': 'redvsblue',
|
||||||
|
'uploader_id': '792887',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, {
|
]
|
||||||
# https://github.com/rg3/youtube-dl/pull/2274
|
|
||||||
'note': 'Video with subtitles',
|
|
||||||
'url': 'http://blip.tv/play/h6Uag5OEVgI.html',
|
|
||||||
'md5': '309f9d25b820b086ca163ffac8031806',
|
|
||||||
'info_dict': {
|
|
||||||
'id': '6586561',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'uploader': 'Red vs. Blue',
|
|
||||||
'description': 'One-Zero-One',
|
|
||||||
'upload_date': '20130614',
|
|
||||||
'title': 'Red vs. Blue Season 11 Episode 1',
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
presumptive_id = mobj.group('presumptive_id')
|
lookup_id = mobj.group('lookup_id')
|
||||||
|
|
||||||
# See https://github.com/rg3/youtube-dl/issues/857
|
# See https://github.com/rg3/youtube-dl/issues/857
|
||||||
embed_mobj = re.match(r'https?://(?:\w+\.)?blip\.tv/(?:play/|api\.swf#)([a-zA-Z0-9]+)', url)
|
if lookup_id:
|
||||||
if embed_mobj:
|
info_page = self._download_webpage(
|
||||||
info_url = 'http://blip.tv/play/%s.x?p=1' % embed_mobj.group(1)
|
'http://blip.tv/play/%s.x?p=1' % lookup_id, lookup_id, 'Resolving lookup id')
|
||||||
info_page = self._download_webpage(info_url, embed_mobj.group(1))
|
video_id = self._search_regex(r'data-episode-id="([0-9]+)', info_page, 'video_id')
|
||||||
video_id = self._search_regex(
|
|
||||||
r'data-episode-id="([0-9]+)', info_page, 'video_id')
|
|
||||||
return self.url_result('http://blip.tv/a/a-' + video_id, 'BlipTV')
|
|
||||||
|
|
||||||
cchar = '&' if '?' in url else '?'
|
|
||||||
json_url = url + cchar + 'skin=json&version=2&no_wrap=1'
|
|
||||||
request = compat_urllib_request.Request(json_url)
|
|
||||||
request.add_header('User-Agent', 'iTunes/10.6.1')
|
|
||||||
|
|
||||||
json_data = self._download_json(request, video_id=presumptive_id)
|
|
||||||
|
|
||||||
if 'Post' in json_data:
|
|
||||||
data = json_data['Post']
|
|
||||||
else:
|
else:
|
||||||
data = json_data
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
rss = self._download_xml('http://blip.tv/rss/flash/%s' % video_id, video_id, 'Downloading video RSS')
|
||||||
|
|
||||||
|
def blip(s):
|
||||||
|
return '{http://blip.tv/dtd/blip/1.0}%s' % s
|
||||||
|
|
||||||
|
def media(s):
|
||||||
|
return '{http://search.yahoo.com/mrss/}%s' % s
|
||||||
|
|
||||||
|
def itunes(s):
|
||||||
|
return '{http://www.itunes.com/dtds/podcast-1.0.dtd}%s' % s
|
||||||
|
|
||||||
|
item = rss.find('channel/item')
|
||||||
|
|
||||||
|
video_id = item.find(blip('item_id')).text
|
||||||
|
title = item.find('./title').text
|
||||||
|
description = clean_html(compat_str(item.find(blip('puredescription')).text))
|
||||||
|
timestamp = parse_iso8601(item.find(blip('datestamp')).text)
|
||||||
|
uploader = item.find(blip('user')).text
|
||||||
|
uploader_id = item.find(blip('userid')).text
|
||||||
|
duration = int(item.find(blip('runtime')).text)
|
||||||
|
media_thumbnail = item.find(media('thumbnail'))
|
||||||
|
thumbnail = media_thumbnail.get('url') if media_thumbnail is not None else item.find(itunes('image')).text
|
||||||
|
categories = [category.text for category in item.findall('category')]
|
||||||
|
|
||||||
video_id = compat_str(data['item_id'])
|
|
||||||
upload_date = datetime.datetime.strptime(data['datestamp'], '%m-%d-%y %H:%M%p').strftime('%Y%m%d')
|
|
||||||
subtitles = {}
|
|
||||||
formats = []
|
formats = []
|
||||||
if 'additionalMedia' in data:
|
subtitles = {}
|
||||||
for f in data['additionalMedia']:
|
|
||||||
if f.get('file_type_srt') == 1:
|
media_group = item.find(media('group'))
|
||||||
LANGS = {
|
for media_content in media_group.findall(media('content')):
|
||||||
'english': 'en',
|
url = media_content.get('url')
|
||||||
}
|
role = media_content.get(blip('role'))
|
||||||
lang = f['role'].rpartition('-')[-1].strip().lower()
|
msg = self._download_webpage(
|
||||||
langcode = LANGS.get(lang, lang)
|
url + '?showplayer=20140425131715&referrer=http://blip.tv&mask=7&skin=flashvars&view=url',
|
||||||
subtitles[langcode] = f['url']
|
video_id, 'Resolving URL for %s' % role)
|
||||||
continue
|
real_url = compat_urlparse.parse_qs(msg)['message'][0]
|
||||||
if not int(f['media_width']): # filter m3u8
|
|
||||||
continue
|
media_type = media_content.get('type')
|
||||||
|
if media_type == 'text/srt' or url.endswith('.srt'):
|
||||||
|
LANGS = {
|
||||||
|
'english': 'en',
|
||||||
|
}
|
||||||
|
lang = role.rpartition('-')[-1].strip().lower()
|
||||||
|
langcode = LANGS.get(lang, lang)
|
||||||
|
subtitles[langcode] = url
|
||||||
|
elif media_type.startswith('video/'):
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': f['url'],
|
'url': real_url,
|
||||||
'format_id': f['role'],
|
'format_id': role,
|
||||||
'width': int(f['media_width']),
|
'format_note': media_type,
|
||||||
'height': int(f['media_height']),
|
'vcodec': media_content.get(blip('vcodec')),
|
||||||
|
'acodec': media_content.get(blip('acodec')),
|
||||||
|
'filesize': media_content.get('filesize'),
|
||||||
|
'width': int(media_content.get('width')),
|
||||||
|
'height': int(media_content.get('height')),
|
||||||
})
|
})
|
||||||
else:
|
|
||||||
formats.append({
|
|
||||||
'url': data['media']['url'],
|
|
||||||
'width': int(data['media']['width']),
|
|
||||||
'height': int(data['media']['height']),
|
|
||||||
})
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
# subtitles
|
# subtitles
|
||||||
@@ -107,12 +144,14 @@ class BlipTVIE(SubtitlesInfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'uploader': data['display_name'],
|
'title': title,
|
||||||
'upload_date': upload_date,
|
'description': description,
|
||||||
'title': data['title'],
|
'timestamp': timestamp,
|
||||||
'thumbnail': data['thumbnailUrl'],
|
'uploader': uploader,
|
||||||
'description': data['description'],
|
'uploader_id': uploader_id,
|
||||||
'user_agent': 'iTunes/10.6.1',
|
'duration': duration,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'categories': categories,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': video_subtitles,
|
'subtitles': video_subtitles,
|
||||||
}
|
}
|
||||||
@@ -126,7 +165,7 @@ class BlipTVIE(SubtitlesInfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class BlipTVUserIE(InfoExtractor):
|
class BlipTVUserIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?blip\.tv/)|bliptvuser:)([^/]+)/*$'
|
_VALID_URL = r'(?:(?:(?:https?://)?(?:\w+\.)?blip\.tv/)|bliptvuser:)(?!api\.swf)([^/]+)/*$'
|
||||||
_PAGE_SIZE = 12
|
_PAGE_SIZE = 12
|
||||||
IE_NAME = 'blip.tv:user'
|
IE_NAME = 'blip.tv:user'
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class BloombergIE(InfoExtractor):
|
|||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.bloomberg.com/video/shah-s-presentation-on-foreign-exchange-strategies-qurhIVlJSB6hzkVi229d8g.html',
|
'url': 'http://www.bloomberg.com/video/shah-s-presentation-on-foreign-exchange-strategies-qurhIVlJSB6hzkVi229d8g.html',
|
||||||
'md5': '7bf08858ff7c203c870e8a6190e221e5',
|
# The md5 checksum changes
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'qurhIVlJSB6hzkVi229d8g',
|
'id': 'qurhIVlJSB6hzkVi229d8g',
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
@@ -31,8 +31,7 @@ class BloombergIE(InfoExtractor):
|
|||||||
return {
|
return {
|
||||||
'id': name.split('-')[-1],
|
'id': name.split('-')[-1],
|
||||||
'title': title,
|
'title': title,
|
||||||
'url': f4m_url,
|
'formats': self._extract_f4m_formats(f4m_url, name),
|
||||||
'ext': 'flv',
|
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,39 +4,76 @@ from __future__ import unicode_literals
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import ExtractorError
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
int_or_none,
|
||||||
|
parse_duration,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class BRIE(InfoExtractor):
|
class BRIE(InfoExtractor):
|
||||||
IE_DESC = "Bayerischer Rundfunk Mediathek"
|
IE_DESC = 'Bayerischer Rundfunk Mediathek'
|
||||||
_VALID_URL = r"^https?://(?:www\.)?br\.de/mediathek/video/(?:sendungen/)?(?:[a-z0-9\-/]+/)?(?P<id>[a-z0-9\-]+)\.html$"
|
_VALID_URL = r'https?://(?:www\.)?br\.de/(?:[a-z0-9\-_]+/)+(?P<id>[a-z0-9\-_]+)\.html'
|
||||||
_BASE_URL = "http://www.br.de"
|
_BASE_URL = 'http://www.br.de'
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
"url": "http://www.br.de/mediathek/video/anselm-gruen-114.html",
|
'url': 'http://www.br.de/mediathek/video/sendungen/heimatsound/heimatsound-festival-2014-trailer-100.html',
|
||||||
"md5": "c4f83cf0f023ba5875aba0bf46860df2",
|
'md5': '93556dd2bcb2948d9259f8670c516d59',
|
||||||
"info_dict": {
|
'info_dict': {
|
||||||
"id": "2c8d81c5-6fb7-4a74-88d4-e768e5856532",
|
'id': '25e279aa-1ffd-40fd-9955-5325bd48a53a',
|
||||||
"ext": "mp4",
|
'ext': 'mp4',
|
||||||
"title": "Feiern und Verzichten",
|
'title': 'Wenn das Traditions-Theater wackelt',
|
||||||
"description": "Anselm Grün: Feiern und Verzichten",
|
'description': 'Heimatsound-Festival 2014: Wenn das Traditions-Theater wackelt',
|
||||||
"uploader": "BR/Birgit Baier",
|
'duration': 34,
|
||||||
"upload_date": "20140301"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "http://www.br.de/mediathek/video/sendungen/unter-unserem-himmel/unter-unserem-himmel-alpen-ueber-den-pass-100.html",
|
'url': 'http://www.br.de/mediathek/video/sendungen/unter-unserem-himmel/unter-unserem-himmel-alpen-ueber-den-pass-100.html',
|
||||||
"md5": "ab451b09d861dbed7d7cc9ab0be19ebe",
|
'md5': 'ab451b09d861dbed7d7cc9ab0be19ebe',
|
||||||
"info_dict": {
|
'info_dict': {
|
||||||
"id": "2c060e69-3a27-4e13-b0f0-668fac17d812",
|
'id': '2c060e69-3a27-4e13-b0f0-668fac17d812',
|
||||||
"ext": "mp4",
|
'ext': 'mp4',
|
||||||
"title": "Über den Pass",
|
'title': 'Über den Pass',
|
||||||
"description": "Die Eroberung der Alpen: Über den Pass",
|
'description': 'Die Eroberung der Alpen: Über den Pass',
|
||||||
"uploader": None,
|
'duration': 2588,
|
||||||
"upload_date": None
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.br.de/nachrichten/schaeuble-haushaltsentwurf-bundestag-100.html',
|
||||||
|
'md5': '3db0df1a9a9cd9fa0c70e6ea8aa8e820',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'c6aae3de-2cf9-43f2-957f-f17fef9afaab',
|
||||||
|
'ext': 'aac',
|
||||||
|
'title': '"Keine neuen Schulden im nächsten Jahr"',
|
||||||
|
'description': 'Haushaltsentwurf: "Keine neuen Schulden im nächsten Jahr"',
|
||||||
|
'duration': 64,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.br.de/radio/bayern1/service/team/videos/team-video-erdelt100.html',
|
||||||
|
'md5': 'dbab0aef2e047060ea7a21fc1ce1078a',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '6ba73750-d405-45d3-861d-1ce8c524e059',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Umweltbewusster Häuslebauer',
|
||||||
|
'description': 'Uwe Erdelt: Umweltbewusster Häuslebauer',
|
||||||
|
'duration': 116,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.br.de/fernsehen/br-alpha/sendungen/kant-fuer-anfaenger/kritik-der-reinen-vernunft/kant-kritik-01-metaphysik100.html',
|
||||||
|
'md5': '23bca295f1650d698f94fc570977dae3',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'd982c9ce-8648-4753-b358-98abb8aec43d',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Folge 1 - Metaphysik',
|
||||||
|
'description': 'Kant für Anfänger: Folge 1 - Metaphysik',
|
||||||
|
'duration': 893,
|
||||||
|
'uploader': 'Eva Maria Steimle',
|
||||||
|
'upload_date': '20140117',
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@@ -44,56 +81,64 @@ class BRIE(InfoExtractor):
|
|||||||
display_id = mobj.group('id')
|
display_id = mobj.group('id')
|
||||||
page = self._download_webpage(url, display_id)
|
page = self._download_webpage(url, display_id)
|
||||||
xml_url = self._search_regex(
|
xml_url = self._search_regex(
|
||||||
r"return BRavFramework\.register\(BRavFramework\('avPlayer_(?:[a-f0-9-]{36})'\)\.setup\({dataURL:'(/mediathek/video/[a-z0-9/~_.-]+)'}\)\);", page, "XMLURL")
|
r"return BRavFramework\.register\(BRavFramework\('avPlayer_(?:[a-f0-9-]{36})'\)\.setup\({dataURL:'(/(?:[a-z0-9\-]+/)+[a-z0-9/~_.-]+)'}\)\);", page, 'XMLURL')
|
||||||
xml = self._download_xml(self._BASE_URL + xml_url, None)
|
xml = self._download_xml(self._BASE_URL + xml_url, None)
|
||||||
|
|
||||||
videos = []
|
medias = []
|
||||||
for xml_video in xml.findall("video"):
|
|
||||||
video = {
|
|
||||||
"id": xml_video.get("externalId"),
|
|
||||||
"title": xml_video.find("title").text,
|
|
||||||
"formats": self._extract_formats(xml_video.find("assets")),
|
|
||||||
"thumbnails": self._extract_thumbnails(xml_video.find("teaserImage/variants")),
|
|
||||||
"description": " ".join(xml_video.find("shareTitle").text.splitlines()),
|
|
||||||
"webpage_url": xml_video.find("permalink").text
|
|
||||||
}
|
|
||||||
if xml_video.find("author").text:
|
|
||||||
video["uploader"] = xml_video.find("author").text
|
|
||||||
if xml_video.find("broadcastDate").text:
|
|
||||||
video["upload_date"] = "".join(reversed(xml_video.find("broadcastDate").text.split(".")))
|
|
||||||
videos.append(video)
|
|
||||||
|
|
||||||
if len(videos) > 1:
|
for xml_media in xml.findall('video') + xml.findall('audio'):
|
||||||
|
media = {
|
||||||
|
'id': xml_media.get('externalId'),
|
||||||
|
'title': xml_media.find('title').text,
|
||||||
|
'duration': parse_duration(xml_media.find('duration').text),
|
||||||
|
'formats': self._extract_formats(xml_media.find('assets')),
|
||||||
|
'thumbnails': self._extract_thumbnails(xml_media.find('teaserImage/variants')),
|
||||||
|
'description': ' '.join(xml_media.find('shareTitle').text.splitlines()),
|
||||||
|
'webpage_url': xml_media.find('permalink').text
|
||||||
|
}
|
||||||
|
if xml_media.find('author').text:
|
||||||
|
media['uploader'] = xml_media.find('author').text
|
||||||
|
if xml_media.find('broadcastDate').text:
|
||||||
|
media['upload_date'] = ''.join(reversed(xml_media.find('broadcastDate').text.split('.')))
|
||||||
|
medias.append(media)
|
||||||
|
|
||||||
|
if len(medias) > 1:
|
||||||
self._downloader.report_warning(
|
self._downloader.report_warning(
|
||||||
'found multiple videos; please '
|
'found multiple medias; please '
|
||||||
'report this with the video URL to http://yt-dl.org/bug')
|
'report this with the video URL to http://yt-dl.org/bug')
|
||||||
if not videos:
|
if not medias:
|
||||||
raise ExtractorError('No video entries found')
|
raise ExtractorError('No media entries found')
|
||||||
return videos[0]
|
return medias[0]
|
||||||
|
|
||||||
def _extract_formats(self, assets):
|
def _extract_formats(self, assets):
|
||||||
|
|
||||||
|
def text_or_none(asset, tag):
|
||||||
|
elem = asset.find(tag)
|
||||||
|
return None if elem is None else elem.text
|
||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
"url": asset.find("downloadUrl").text,
|
'url': text_or_none(asset, 'downloadUrl'),
|
||||||
"ext": asset.find("mediaType").text,
|
'ext': text_or_none(asset, 'mediaType'),
|
||||||
"format_id": asset.get("type"),
|
'format_id': asset.get('type'),
|
||||||
"width": int(asset.find("frameWidth").text),
|
'width': int_or_none(text_or_none(asset, 'frameWidth')),
|
||||||
"height": int(asset.find("frameHeight").text),
|
'height': int_or_none(text_or_none(asset, 'frameHeight')),
|
||||||
"tbr": int(asset.find("bitrateVideo").text),
|
'tbr': int_or_none(text_or_none(asset, 'bitrateVideo')),
|
||||||
"abr": int(asset.find("bitrateAudio").text),
|
'abr': int_or_none(text_or_none(asset, 'bitrateAudio')),
|
||||||
"vcodec": asset.find("codecVideo").text,
|
'vcodec': text_or_none(asset, 'codecVideo'),
|
||||||
"container": asset.find("mediaType").text,
|
'acodec': text_or_none(asset, 'codecAudio'),
|
||||||
"filesize": int(asset.find("size").text),
|
'container': text_or_none(asset, 'mediaType'),
|
||||||
} for asset in assets.findall("asset")
|
'filesize': int_or_none(text_or_none(asset, 'size')),
|
||||||
if asset.find("downloadUrl") is not None]
|
} for asset in assets.findall('asset')
|
||||||
|
if asset.find('downloadUrl') is not None]
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
return formats
|
return formats
|
||||||
|
|
||||||
def _extract_thumbnails(self, variants):
|
def _extract_thumbnails(self, variants):
|
||||||
thumbnails = [{
|
thumbnails = [{
|
||||||
"url": self._BASE_URL + variant.find("url").text,
|
'url': self._BASE_URL + variant.find('url').text,
|
||||||
"width": int(variant.find("width").text),
|
'width': int_or_none(variant.find('width').text),
|
||||||
"height": int(variant.find("height").text),
|
'height': int_or_none(variant.find('height').text),
|
||||||
} for variant in variants.findall("variant")]
|
} for variant in variants.findall('variant')]
|
||||||
thumbnails.sort(key=lambda x: x["width"] * x["height"], reverse=True)
|
thumbnails.sort(key=lambda x: x['width'] * x['height'], reverse=True)
|
||||||
return thumbnails
|
return thumbnails
|
||||||
|
|||||||
@@ -27,9 +27,10 @@ class BreakIE(InfoExtractor):
|
|||||||
webpage, 'info json', flags=re.DOTALL)
|
webpage, 'info json', flags=re.DOTALL)
|
||||||
info = json.loads(info_json)
|
info = json.loads(info_json)
|
||||||
video_url = info['videoUri']
|
video_url = info['videoUri']
|
||||||
m_youtube = re.search(r'(https?://www\.youtube\.com/watch\?v=.*)', video_url)
|
youtube_id = info.get('youtubeId')
|
||||||
if m_youtube is not None:
|
if youtube_id:
|
||||||
return self.url_result(m_youtube.group(1), 'Youtube')
|
return self.url_result(youtube_id, 'Youtube')
|
||||||
|
|
||||||
final_url = video_url + '?' + info['AuthToken']
|
final_url = video_url + '?' + info['AuthToken']
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ from ..utils import (
|
|||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
compat_parse_qs,
|
compat_parse_qs,
|
||||||
|
|
||||||
|
determine_ext,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
unsmuggle_url,
|
unsmuggle_url,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
@@ -29,10 +30,11 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
{
|
{
|
||||||
# From http://www.8tv.cat/8aldia/videos/xavier-sala-i-martin-aquesta-tarda-a-8-al-dia/
|
# From http://www.8tv.cat/8aldia/videos/xavier-sala-i-martin-aquesta-tarda-a-8-al-dia/
|
||||||
'url': 'http://c.brightcove.com/services/viewer/htmlFederated?playerID=1654948606001&flashID=myExperience&%40videoPlayer=2371591881001',
|
'url': 'http://c.brightcove.com/services/viewer/htmlFederated?playerID=1654948606001&flashID=myExperience&%40videoPlayer=2371591881001',
|
||||||
'file': '2371591881001.mp4',
|
|
||||||
'md5': '5423e113865d26e40624dce2e4b45d95',
|
'md5': '5423e113865d26e40624dce2e4b45d95',
|
||||||
'note': 'Test Brightcove downloads and detection in GenericIE',
|
'note': 'Test Brightcove downloads and detection in GenericIE',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': '2371591881001',
|
||||||
|
'ext': 'mp4',
|
||||||
'title': 'Xavier Sala i Martín: “Un banc que no presta és un banc zombi que no serveix per a res”',
|
'title': 'Xavier Sala i Martín: “Un banc que no presta és un banc zombi que no serveix per a res”',
|
||||||
'uploader': '8TV',
|
'uploader': '8TV',
|
||||||
'description': 'md5:a950cc4285c43e44d763d036710cd9cd',
|
'description': 'md5:a950cc4285c43e44d763d036710cd9cd',
|
||||||
@@ -41,8 +43,9 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
{
|
{
|
||||||
# From http://medianetwork.oracle.com/video/player/1785452137001
|
# From http://medianetwork.oracle.com/video/player/1785452137001
|
||||||
'url': 'http://c.brightcove.com/services/viewer/htmlFederated?playerID=1217746023001&flashID=myPlayer&%40videoPlayer=1785452137001',
|
'url': 'http://c.brightcove.com/services/viewer/htmlFederated?playerID=1217746023001&flashID=myPlayer&%40videoPlayer=1785452137001',
|
||||||
'file': '1785452137001.flv',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': '1785452137001',
|
||||||
|
'ext': 'flv',
|
||||||
'title': 'JVMLS 2012: Arrays 2.0 - Opportunities and Challenges',
|
'title': 'JVMLS 2012: Arrays 2.0 - Opportunities and Challenges',
|
||||||
'description': 'John Rose speaks at the JVM Language Summit, August 1, 2012.',
|
'description': 'John Rose speaks at the JVM Language Summit, August 1, 2012.',
|
||||||
'uploader': 'Oracle',
|
'uploader': 'Oracle',
|
||||||
@@ -70,7 +73,20 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
'description': 'md5:363109c02998fee92ec02211bd8000df',
|
'description': 'md5:363109c02998fee92ec02211bd8000df',
|
||||||
'uploader': 'National Ballet of Canada',
|
'uploader': 'National Ballet of Canada',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
# test flv videos served by akamaihd.net
|
||||||
|
# From http://www.redbull.com/en/bike/stories/1331655643987/replay-uci-dh-world-cup-2014-from-fort-william
|
||||||
|
'url': 'http://c.brightcove.com/services/viewer/htmlFederated?%40videoPlayer=ref%3ABC2996102916001&linkBaseURL=http%3A%2F%2Fwww.redbull.com%2Fen%2Fbike%2Fvideos%2F1331655630249%2Freplay-uci-fort-william-2014-dh&playerKey=AQ%7E%7E%2CAAAApYJ7UqE%7E%2Cxqr_zXk0I-zzNndy8NlHogrCb5QdyZRf&playerID=1398061561001#__youtubedl_smuggle=%7B%22Referer%22%3A+%22http%3A%2F%2Fwww.redbull.com%2Fen%2Fbike%2Fstories%2F1331655643987%2Freplay-uci-dh-world-cup-2014-from-fort-william%22%7D',
|
||||||
|
# The md5 checksum changes on each download
|
||||||
|
'info_dict': {
|
||||||
|
'id': '2996102916001',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'UCI MTB World Cup 2014: Fort William, UK - Downhill Finals',
|
||||||
|
'uploader': 'Red Bull TV',
|
||||||
|
'description': 'UCI MTB World Cup 2014: Fort William, UK - Downhill Finals',
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -87,7 +103,7 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
object_str = object_str.replace('<--', '<!--')
|
object_str = object_str.replace('<--', '<!--')
|
||||||
object_str = fix_xml_ampersands(object_str)
|
object_str = fix_xml_ampersands(object_str)
|
||||||
|
|
||||||
object_doc = xml.etree.ElementTree.fromstring(object_str)
|
object_doc = xml.etree.ElementTree.fromstring(object_str.encode('utf-8'))
|
||||||
|
|
||||||
fv_el = find_xpath_attr(object_doc, './param', 'name', 'flashVars')
|
fv_el = find_xpath_attr(object_doc, './param', 'name', 'flashVars')
|
||||||
if fv_el is not None:
|
if fv_el is not None:
|
||||||
@@ -138,9 +154,15 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
def _extract_brightcove_urls(cls, webpage):
|
def _extract_brightcove_urls(cls, webpage):
|
||||||
"""Return a list of all Brightcove URLs from the webpage """
|
"""Return a list of all Brightcove URLs from the webpage """
|
||||||
|
|
||||||
url_m = re.search(r'<meta\s+property="og:video"\s+content="(http://c.brightcove.com/[^"]+)"', webpage)
|
url_m = re.search(
|
||||||
|
r'<meta\s+property="og:video"\s+content="(https?://(?:secure|c)\.brightcove.com/[^"]+)"',
|
||||||
|
webpage)
|
||||||
if url_m:
|
if url_m:
|
||||||
return [unescapeHTML(url_m.group(1))]
|
url = unescapeHTML(url_m.group(1))
|
||||||
|
# Some sites don't add it, we can't download with this url, for example:
|
||||||
|
# http://www.ktvu.com/videos/news/raw-video-caltrain-releases-video-of-man-almost/vCTZdY/
|
||||||
|
if 'playerKey' in url or 'videoId' in url:
|
||||||
|
return [url]
|
||||||
|
|
||||||
matches = re.findall(
|
matches = re.findall(
|
||||||
r'''(?sx)<object
|
r'''(?sx)<object
|
||||||
@@ -168,9 +190,13 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
referer = smuggled_data.get('Referer', url)
|
referer = smuggled_data.get('Referer', url)
|
||||||
return self._get_video_info(
|
return self._get_video_info(
|
||||||
videoPlayer[0], query_str, query, referer=referer)
|
videoPlayer[0], query_str, query, referer=referer)
|
||||||
else:
|
elif 'playerKey' in query:
|
||||||
player_key = query['playerKey']
|
player_key = query['playerKey']
|
||||||
return self._get_playlist_info(player_key[0])
|
return self._get_playlist_info(player_key[0])
|
||||||
|
else:
|
||||||
|
raise ExtractorError(
|
||||||
|
'Cannot find playerKey= variable. Did you forget quotes in a shell invocation?',
|
||||||
|
expected=True)
|
||||||
|
|
||||||
def _get_video_info(self, video_id, query_str, query, referer=None):
|
def _get_video_info(self, video_id, query_str, query, referer=None):
|
||||||
request_url = self._FEDERATED_URL_TEMPLATE % query_str
|
request_url = self._FEDERATED_URL_TEMPLATE % query_str
|
||||||
@@ -182,8 +208,15 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
req.add_header('Referer', referer)
|
req.add_header('Referer', referer)
|
||||||
webpage = self._download_webpage(req, video_id)
|
webpage = self._download_webpage(req, video_id)
|
||||||
|
|
||||||
|
error_msg = self._html_search_regex(
|
||||||
|
r"<h1>We're sorry.</h1>\s*<p>(.*?)</p>", webpage,
|
||||||
|
'error message', default=None)
|
||||||
|
if error_msg is not None:
|
||||||
|
raise ExtractorError(
|
||||||
|
'brightcove said: %s' % error_msg, expected=True)
|
||||||
|
|
||||||
self.report_extraction(video_id)
|
self.report_extraction(video_id)
|
||||||
info = self._search_regex(r'var experienceJSON = ({.*?});', webpage, 'json')
|
info = self._search_regex(r'var experienceJSON = ({.*});', webpage, 'json')
|
||||||
info = json.loads(info)['data']
|
info = json.loads(info)['data']
|
||||||
video_info = info['programmedContent']['videoPlayer']['mediaDTO']
|
video_info = info['programmedContent']['videoPlayer']['mediaDTO']
|
||||||
video_info['_youtubedl_adServerURL'] = info.get('adServerURL')
|
video_info['_youtubedl_adServerURL'] = info.get('adServerURL')
|
||||||
@@ -215,12 +248,26 @@ class BrightcoveIE(InfoExtractor):
|
|||||||
|
|
||||||
renditions = video_info.get('renditions')
|
renditions = video_info.get('renditions')
|
||||||
if renditions:
|
if renditions:
|
||||||
renditions = sorted(renditions, key=lambda r: r['size'])
|
formats = []
|
||||||
info['formats'] = [{
|
for rend in renditions:
|
||||||
'url': rend['defaultURL'],
|
url = rend['defaultURL']
|
||||||
'height': rend.get('frameHeight'),
|
if rend['remote']:
|
||||||
'width': rend.get('frameWidth'),
|
# This type of renditions are served through akamaihd.net,
|
||||||
} for rend in renditions]
|
# but they don't use f4m manifests
|
||||||
|
url = url.replace('control/', '') + '?&v=3.3.0&fp=13&r=FEEFJ&g=RTSJIMBMPFPB'
|
||||||
|
ext = 'flv'
|
||||||
|
else:
|
||||||
|
ext = determine_ext(url)
|
||||||
|
size = rend.get('size')
|
||||||
|
formats.append({
|
||||||
|
'url': url,
|
||||||
|
'ext': ext,
|
||||||
|
'height': rend.get('frameHeight'),
|
||||||
|
'width': rend.get('frameWidth'),
|
||||||
|
'filesize': size if size != 0 else None,
|
||||||
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
info['formats'] = formats
|
||||||
elif video_info.get('FLVFullLengthURL') is not None:
|
elif video_info.get('FLVFullLengthURL') is not None:
|
||||||
info.update({
|
info.update({
|
||||||
'url': video_info['FLVFullLengthURL'],
|
'url': video_info['FLVFullLengthURL'],
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import json
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import ExtractorError
|
||||||
ExtractorError,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class BYUtvIE(InfoExtractor):
|
class BYUtvIE(InfoExtractor):
|
||||||
@@ -16,7 +14,7 @@ class BYUtvIE(InfoExtractor):
|
|||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'granite-flats-talking',
|
'id': 'granite-flats-talking',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'description': 'md5:1a7ae3e153359b7cc355ef3963441e5f',
|
'description': 'md5:4e9a7ce60f209a33eca0ac65b4918e1c',
|
||||||
'title': 'Talking',
|
'title': 'Talking',
|
||||||
'thumbnail': 're:^https?://.*promo.*'
|
'thumbnail': 're:^https?://.*promo.*'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,39 +2,46 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class C56IE(InfoExtractor):
|
class C56IE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://((www|player)\.)?56\.com/(.+?/)?(v_|(play_album.+-))(?P<textid>.+?)\.(html|swf)'
|
_VALID_URL = r'https?://(?:(?:www|player)\.)?56\.com/(?:.+?/)?(?:v_|(?:play_album.+-))(?P<textid>.+?)\.(?:html|swf)'
|
||||||
IE_NAME = '56.com'
|
IE_NAME = '56.com'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.56.com/u39/v_OTM0NDA3MTY.html',
|
'url': 'http://www.56.com/u39/v_OTM0NDA3MTY.html',
|
||||||
'file': '93440716.flv',
|
|
||||||
'md5': 'e59995ac63d0457783ea05f93f12a866',
|
'md5': 'e59995ac63d0457783ea05f93f12a866',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': '93440716',
|
||||||
|
'ext': 'flv',
|
||||||
'title': '网事知多少 第32期:车怒',
|
'title': '网事知多少 第32期:车怒',
|
||||||
|
'duration': 283.813,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url, flags=re.VERBOSE)
|
mobj = re.match(self._VALID_URL, url, flags=re.VERBOSE)
|
||||||
text_id = mobj.group('textid')
|
text_id = mobj.group('textid')
|
||||||
info_page = self._download_webpage('http://vxml.56.com/json/%s/' % text_id,
|
|
||||||
text_id, 'Downloading video info')
|
page = self._download_json(
|
||||||
info = json.loads(info_page)['info']
|
'http://vxml.56.com/json/%s/' % text_id, text_id, 'Downloading video info')
|
||||||
formats = [{
|
|
||||||
'format_id': f['type'],
|
info = page['info']
|
||||||
'filesize': int(f['filesize']),
|
|
||||||
'url': f['url']
|
formats = [
|
||||||
} for f in info['rfiles']]
|
{
|
||||||
|
'format_id': f['type'],
|
||||||
|
'filesize': int(f['filesize']),
|
||||||
|
'url': f['url']
|
||||||
|
} for f in info['rfiles']
|
||||||
|
]
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': info['vid'],
|
'id': info['vid'],
|
||||||
'title': info['Subject'],
|
'title': info['Subject'],
|
||||||
|
'duration': int(info['duration']) / 1000.0,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnail': info.get('bimg') or info.get('img'),
|
'thumbnail': info.get('bimg') or info.get('img'),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +1,72 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import unified_strdate
|
from ..utils import (
|
||||||
|
unified_strdate,
|
||||||
|
url_basename,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class CanalplusIE(InfoExtractor):
|
class CanalplusIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(www\.canalplus\.fr/.*?/(?P<path>.*)|player\.canalplus\.fr/#/(?P<id>\d+))'
|
_VALID_URL = r'https?://(?:www\.canalplus\.fr/.*?/(?P<path>.*)|player\.canalplus\.fr/#/(?P<id>[0-9]+))'
|
||||||
_VIDEO_INFO_TEMPLATE = 'http://service.canal-plus.com/video/rest/getVideosLiees/cplus/%s'
|
_VIDEO_INFO_TEMPLATE = 'http://service.canal-plus.com/video/rest/getVideosLiees/cplus/%s'
|
||||||
IE_NAME = u'canalplus.fr'
|
IE_NAME = 'canalplus.fr'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.canalplus.fr/c-infos-documentaires/pid1830-c-zapping.html?vid=922470',
|
'url': 'http://www.canalplus.fr/c-infos-documentaires/pid1830-c-zapping.html?vid=922470',
|
||||||
u'file': u'922470.flv',
|
'md5': '3db39fb48b9685438ecf33a1078023e4',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Zapping - 26/08/13',
|
'id': '922470',
|
||||||
u'description': u'Le meilleur de toutes les chaînes, tous les jours.\nEmission du 26 août 2013',
|
'ext': 'flv',
|
||||||
u'upload_date': u'20130826',
|
'title': 'Zapping - 26/08/13',
|
||||||
},
|
'description': 'Le meilleur de toutes les chaînes, tous les jours.\nEmission du 26 août 2013',
|
||||||
u'params': {
|
'upload_date': '20130826',
|
||||||
u'skip_download': True,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.groupdict().get('id')
|
video_id = mobj.groupdict().get('id')
|
||||||
|
|
||||||
|
# Beware, some subclasses do not define an id group
|
||||||
|
display_id = url_basename(mobj.group('path'))
|
||||||
|
|
||||||
if video_id is None:
|
if video_id is None:
|
||||||
webpage = self._download_webpage(url, mobj.group('path'))
|
webpage = self._download_webpage(url, display_id)
|
||||||
video_id = self._search_regex(r'<canal:player videoId="(\d+)"', webpage, u'video id')
|
video_id = self._search_regex(r'<canal:player videoId="(\d+)"', webpage, 'video id')
|
||||||
|
|
||||||
info_url = self._VIDEO_INFO_TEMPLATE % video_id
|
info_url = self._VIDEO_INFO_TEMPLATE % video_id
|
||||||
doc = self._download_xml(info_url,video_id,
|
doc = self._download_xml(info_url, video_id, 'Downloading video XML')
|
||||||
u'Downloading video info')
|
|
||||||
|
|
||||||
self.report_extraction(video_id)
|
|
||||||
video_info = [video for video in doc if video.find('ID').text == video_id][0]
|
video_info = [video for video in doc if video.find('ID').text == video_id][0]
|
||||||
infos = video_info.find('INFOS')
|
|
||||||
media = video_info.find('MEDIA')
|
media = video_info.find('MEDIA')
|
||||||
formats = [media.find('VIDEOS/%s' % format)
|
infos = video_info.find('INFOS')
|
||||||
for format in ['BAS_DEBIT', 'HAUT_DEBIT', 'HD']]
|
|
||||||
video_url = [format.text for format in formats if format is not None][-1]
|
|
||||||
|
|
||||||
return {'id': video_id,
|
preferences = ['MOBILE', 'BAS_DEBIT', 'HAUT_DEBIT', 'HD', 'HLS', 'HDS']
|
||||||
'title': u'%s - %s' % (infos.find('TITRAGE/TITRE').text,
|
|
||||||
infos.find('TITRAGE/SOUS_TITRE').text),
|
formats = [
|
||||||
'url': video_url,
|
{
|
||||||
'ext': 'flv',
|
'url': fmt.text + '?hdcore=2.11.3' if fmt.tag == 'HDS' else fmt.text,
|
||||||
'upload_date': unified_strdate(infos.find('PUBLICATION/DATE').text),
|
'format_id': fmt.tag,
|
||||||
'thumbnail': media.find('IMAGES/GRAND').text,
|
'ext': 'mp4' if fmt.tag == 'HLS' else 'flv',
|
||||||
'description': infos.find('DESCRIPTION').text,
|
'preference': preferences.index(fmt.tag) if fmt.tag in preferences else -1,
|
||||||
'view_count': int(infos.find('NB_VUES').text),
|
} for fmt in media.find('VIDEOS') if fmt.text
|
||||||
}
|
]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'display_id': display_id,
|
||||||
|
'title': '%s - %s' % (infos.find('TITRAGE/TITRE').text,
|
||||||
|
infos.find('TITRAGE/SOUS_TITRE').text),
|
||||||
|
'upload_date': unified_strdate(infos.find('PUBLICATION/DATE').text),
|
||||||
|
'thumbnail': media.find('IMAGES/GRAND').text,
|
||||||
|
'description': infos.find('DESCRIPTION').text,
|
||||||
|
'view_count': int(infos.find('NB_VUES').text),
|
||||||
|
'like_count': int(infos.find('NB_LIKES').text),
|
||||||
|
'comment_count': int(infos.find('NB_COMMENTS').text),
|
||||||
|
'formats': formats,
|
||||||
|
}
|
||||||
@@ -1,24 +1,42 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
class CBSIE(InfoExtractor):
|
class CBSIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?cbs\.com/shows/[^/]+/video/(?P<id>[^/]+)/.*'
|
_VALID_URL = r'https?://(?:www\.)?cbs\.com/shows/[^/]+/(?:video|artist)/(?P<id>[^/]+)/.*'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
u'url': u'http://www.cbs.com/shows/garth-brooks/video/_u7W953k6la293J7EPTd9oHkSPs6Xn6_/connect-chat-feat-garth-brooks/',
|
'url': 'http://www.cbs.com/shows/garth-brooks/video/_u7W953k6la293J7EPTd9oHkSPs6Xn6_/connect-chat-feat-garth-brooks/',
|
||||||
u'file': u'4JUVEwq3wUT7.flv',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '4JUVEwq3wUT7',
|
||||||
u'title': u'Connect Chat feat. Garth Brooks',
|
'ext': 'flv',
|
||||||
u'description': u'Connect with country music singer Garth Brooks, as he chats with fans on Wednesday November 27, 2013. Be sure to tune in to Garth Brooks: Live from Las Vegas, Friday November 29, at 9/8c on CBS!',
|
'title': 'Connect Chat feat. Garth Brooks',
|
||||||
u'duration': 1495,
|
'description': 'Connect with country music singer Garth Brooks, as he chats with fans on Wednesday November 27, 2013. Be sure to tune in to Garth Brooks: Live from Las Vegas, Friday November 29, at 9/8c on CBS!',
|
||||||
|
'duration': 1495,
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
# rtmp download
|
# rtmp download
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
}
|
'_skip': 'Blocked outside the US',
|
||||||
|
}, {
|
||||||
|
'url': 'http://www.cbs.com/shows/liveonletterman/artist/221752/st-vincent/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'WWF_5KqY3PK1',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Live on Letterman - St. Vincent',
|
||||||
|
'description': 'Live On Letterman: St. Vincent in concert from New York\'s Ed Sullivan Theater on Tuesday, July 16, 2014.',
|
||||||
|
'duration': 3221,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# rtmp download
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
'_skip': 'Blocked outside the US',
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
@@ -26,5 +44,5 @@ class CBSIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
real_id = self._search_regex(
|
real_id = self._search_regex(
|
||||||
r"video\.settings\.pid\s*=\s*'([^']+)';",
|
r"video\.settings\.pid\s*=\s*'([^']+)';",
|
||||||
webpage, u'real video ID')
|
webpage, 'real video ID')
|
||||||
return self.url_result(u'theplatform:%s' % real_id)
|
return self.url_result(u'theplatform:%s' % real_id)
|
||||||
|
|||||||
87
youtube_dl/extractor/cbsnews.py
Normal file
87
youtube_dl/extractor/cbsnews.py
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class CBSNewsIE(InfoExtractor):
|
||||||
|
IE_DESC = 'CBS News'
|
||||||
|
_VALID_URL = r'http://(?:www\.)?cbsnews\.com/(?:[^/]+/)+(?P<id>[\da-z_-]+)'
|
||||||
|
|
||||||
|
_TESTS = [
|
||||||
|
{
|
||||||
|
'url': 'http://www.cbsnews.com/news/tesla-and-spacex-elon-musks-industrial-empire/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'tesla-and-spacex-elon-musks-industrial-empire',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Tesla and SpaceX: Elon Musk\'s industrial empire',
|
||||||
|
'thumbnail': 'http://beta.img.cbsnews.com/i/2014/03/30/60147937-2f53-4565-ad64-1bdd6eb64679/60-0330-pelley-640x360.jpg',
|
||||||
|
'duration': 791,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# rtmp download
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'http://www.cbsnews.com/videos/fort-hood-shooting-army-downplays-mental-illness-as-cause-of-attack/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'fort-hood-shooting-army-downplays-mental-illness-as-cause-of-attack',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Fort Hood shooting: Army downplays mental illness as cause of attack',
|
||||||
|
'thumbnail': 'http://cbsnews2.cbsistatic.com/hub/i/r/2014/04/04/0c9fbc66-576b-41ca-8069-02d122060dd2/thumbnail/140x90/6dad7a502f88875ceac38202984b6d58/en-0404-werner-replace-640x360.jpg',
|
||||||
|
'duration': 205,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# rtmp download
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
video_info = json.loads(self._html_search_regex(
|
||||||
|
r'(?:<ul class="media-list items" id="media-related-items"><li data-video-info|<div id="cbsNewsVideoPlayer" data-video-player-options)=\'({.+?})\'',
|
||||||
|
webpage, 'video JSON info'))
|
||||||
|
|
||||||
|
item = video_info['item'] if 'item' in video_info else video_info
|
||||||
|
title = item.get('articleTitle') or item.get('hed')
|
||||||
|
duration = item.get('duration')
|
||||||
|
thumbnail = item.get('mediaImage') or item.get('thumbnail')
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
for format_id in ['RtmpMobileLow', 'RtmpMobileHigh', 'Hls', 'RtmpDesktop']:
|
||||||
|
uri = item.get('media' + format_id + 'URI')
|
||||||
|
if not uri:
|
||||||
|
continue
|
||||||
|
fmt = {
|
||||||
|
'url': uri,
|
||||||
|
'format_id': format_id,
|
||||||
|
}
|
||||||
|
if uri.startswith('rtmp'):
|
||||||
|
fmt.update({
|
||||||
|
'app': 'ondemand?auth=cbs',
|
||||||
|
'play_path': 'mp4:' + uri.split('<break>')[-1],
|
||||||
|
'player_url': 'http://www.cbsnews.com/[[IMPORT]]/vidtech.cbsinteractive.com/player/3_3_0/CBSI_PLAYER_HD.swf',
|
||||||
|
'page_url': 'http://www.cbsnews.com',
|
||||||
|
'ext': 'flv',
|
||||||
|
})
|
||||||
|
elif uri.endswith('.m3u8'):
|
||||||
|
fmt['ext'] = 'mp4'
|
||||||
|
formats.append(fmt)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'duration': duration,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
||||||
@@ -42,7 +42,7 @@ class ChilloutzoneIE(InfoExtractor):
|
|||||||
'id': '85523671',
|
'id': '85523671',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'The Sunday Times - Icons',
|
'title': 'The Sunday Times - Icons',
|
||||||
'description': 'md5:3e1c0dc6047498d6728dcdaad0891762',
|
'description': 'md5:a5f7ff82e2f7a9ed77473fe666954e84',
|
||||||
'uploader': 'Us',
|
'uploader': 'Us',
|
||||||
'uploader_id': 'usfilms',
|
'uploader_id': 'usfilms',
|
||||||
'upload_date': '20140131'
|
'upload_date': '20140131'
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
int_or_none,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -13,9 +15,10 @@ class CinemassacreIE(InfoExtractor):
|
|||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
'url': 'http://cinemassacre.com/2012/11/10/avgn-the-movie-trailer/',
|
'url': 'http://cinemassacre.com/2012/11/10/avgn-the-movie-trailer/',
|
||||||
'file': '19911.mp4',
|
'md5': 'fde81fbafaee331785f58cd6c0d46190',
|
||||||
'md5': '782f8504ca95a0eba8fc9177c373eec7',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': '19911',
|
||||||
|
'ext': 'mp4',
|
||||||
'upload_date': '20121110',
|
'upload_date': '20121110',
|
||||||
'title': '“Angry Video Game Nerd: The Movie” – Trailer',
|
'title': '“Angry Video Game Nerd: The Movie” – Trailer',
|
||||||
'description': 'md5:fb87405fcb42a331742a0dce2708560b',
|
'description': 'md5:fb87405fcb42a331742a0dce2708560b',
|
||||||
@@ -23,9 +26,10 @@ class CinemassacreIE(InfoExtractor):
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'url': 'http://cinemassacre.com/2013/10/02/the-mummys-hand-1940',
|
'url': 'http://cinemassacre.com/2013/10/02/the-mummys-hand-1940',
|
||||||
'file': '521be8ef82b16.mp4',
|
'md5': 'd72f10cd39eac4215048f62ab477a511',
|
||||||
'md5': 'dec39ee5118f8d9cc067f45f9cbe3a35',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': '521be8ef82b16',
|
||||||
|
'ext': 'mp4',
|
||||||
'upload_date': '20131002',
|
'upload_date': '20131002',
|
||||||
'title': 'The Mummy’s Hand (1940)',
|
'title': 'The Mummy’s Hand (1940)',
|
||||||
},
|
},
|
||||||
@@ -50,29 +54,40 @@ class CinemassacreIE(InfoExtractor):
|
|||||||
r'<div class="entry-content">(?P<description>.+?)</div>',
|
r'<div class="entry-content">(?P<description>.+?)</div>',
|
||||||
webpage, 'description', flags=re.DOTALL, fatal=False)
|
webpage, 'description', flags=re.DOTALL, fatal=False)
|
||||||
|
|
||||||
playerdata = self._download_webpage(playerdata_url, video_id)
|
playerdata = self._download_webpage(playerdata_url, video_id, 'Downloading player webpage')
|
||||||
|
video_thumbnail = self._search_regex(
|
||||||
|
r'image: \'(?P<thumbnail>[^\']+)\'', playerdata, 'thumbnail', fatal=False)
|
||||||
|
sd_url = self._search_regex(r'file: \'([^\']+)\', label: \'SD\'', playerdata, 'sd_file')
|
||||||
|
videolist_url = self._search_regex(r'file: \'([^\']+\.smil)\'}', playerdata, 'videolist_url')
|
||||||
|
|
||||||
sd_url = self._html_search_regex(r'file: \'([^\']+)\', label: \'SD\'', playerdata, 'sd_file')
|
videolist = self._download_xml(videolist_url, video_id, 'Downloading videolist XML')
|
||||||
hd_url = self._html_search_regex(
|
|
||||||
r'file: \'([^\']+)\', label: \'HD\'', playerdata, 'hd_file',
|
|
||||||
default=None)
|
|
||||||
video_thumbnail = self._html_search_regex(r'image: \'(?P<thumbnail>[^\']+)\'', playerdata, 'thumbnail', fatal=False)
|
|
||||||
|
|
||||||
formats = [{
|
formats = []
|
||||||
'url': sd_url,
|
baseurl = sd_url[:sd_url.rfind('/')+1]
|
||||||
'ext': 'mp4',
|
for video in videolist.findall('.//video'):
|
||||||
'format': 'sd',
|
src = video.get('src')
|
||||||
'format_id': 'sd',
|
if not src:
|
||||||
'quality': 1,
|
continue
|
||||||
}]
|
file_ = src.partition(':')[-1]
|
||||||
if hd_url:
|
width = int_or_none(video.get('width'))
|
||||||
formats.append({
|
height = int_or_none(video.get('height'))
|
||||||
'url': hd_url,
|
bitrate = int_or_none(video.get('system-bitrate'))
|
||||||
'ext': 'mp4',
|
format = {
|
||||||
'format': 'hd',
|
'url': baseurl + file_,
|
||||||
'format_id': 'hd',
|
'format_id': src.rpartition('.')[0].rpartition('_')[-1],
|
||||||
'quality': 2,
|
}
|
||||||
})
|
if width or height:
|
||||||
|
format.update({
|
||||||
|
'tbr': bitrate // 1000 if bitrate else None,
|
||||||
|
'width': width,
|
||||||
|
'height': height,
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
format.update({
|
||||||
|
'abr': bitrate // 1000 if bitrate else None,
|
||||||
|
'vcodec': 'none',
|
||||||
|
})
|
||||||
|
formats.append(format)
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
58
youtube_dl/extractor/clubic.py
Normal file
58
youtube_dl/extractor/clubic.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
clean_html,
|
||||||
|
qualities,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ClubicIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'http://(?:www\.)?clubic\.com/video/[^/]+/video.*-(?P<id>[0-9]+)\.html'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.clubic.com/video/clubic-week/video-clubic-week-2-0-le-fbi-se-lance-dans-la-photo-d-identite-448474.html',
|
||||||
|
'md5': '1592b694ba586036efac1776b0b43cd3',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '448474',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Clubic Week 2.0 : le FBI se lance dans la photo d\u0092identité',
|
||||||
|
'description': 're:Gueule de bois chez Nokia. Le constructeur a indiqué cette.*',
|
||||||
|
'thumbnail': 're:^http://img\.clubic\.com/.*\.jpg$',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
player_url = 'http://player.m6web.fr/v1/player/clubic/%s.html' % video_id
|
||||||
|
player_page = self._download_webpage(player_url, video_id)
|
||||||
|
|
||||||
|
config_json = self._search_regex(
|
||||||
|
r'(?m)M6\.Player\.config\s*=\s*(\{.+?\});$', player_page,
|
||||||
|
'configuration')
|
||||||
|
config = json.loads(config_json)
|
||||||
|
|
||||||
|
video_info = config['videoInfo']
|
||||||
|
sources = config['sources']
|
||||||
|
quality_order = qualities(['sd', 'hq'])
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'format_id': src['streamQuality'],
|
||||||
|
'url': src['src'],
|
||||||
|
'quality': quality_order(src['streamQuality']),
|
||||||
|
} for src in sources]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': video_info['title'],
|
||||||
|
'formats': formats,
|
||||||
|
'description': clean_html(video_info.get('description')),
|
||||||
|
'thumbnail': config.get('poster'),
|
||||||
|
}
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
from .mtv import MTVIE
|
from .mtv import MTVIE
|
||||||
|
|
||||||
|
|
||||||
class CMTIE(MTVIE):
|
class CMTIE(MTVIE):
|
||||||
IE_NAME = u'cmt.com'
|
IE_NAME = 'cmt.com'
|
||||||
_VALID_URL = r'https?://www\.cmt\.com/videos/.+?/(?P<videoid>[^/]+)\.jhtml'
|
_VALID_URL = r'https?://www\.cmt\.com/videos/.+?/(?P<videoid>[^/]+)\.jhtml'
|
||||||
_FEED_URL = 'http://www.cmt.com/sitewide/apps/player/embed/rss/'
|
_FEED_URL = 'http://www.cmt.com/sitewide/apps/player/embed/rss/'
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [{
|
||||||
{
|
'url': 'http://www.cmt.com/videos/garth-brooks/989124/the-call-featuring-trisha-yearwood.jhtml#artist=30061',
|
||||||
u'url': u'http://www.cmt.com/videos/garth-brooks/989124/the-call-featuring-trisha-yearwood.jhtml#artist=30061',
|
'md5': 'e6b7ef3c4c45bbfae88061799bbba6c2',
|
||||||
u'md5': u'e6b7ef3c4c45bbfae88061799bbba6c2',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '989124',
|
||||||
u'id': u'989124',
|
'ext': 'mp4',
|
||||||
u'ext': u'mp4',
|
'title': 'Garth Brooks - "The Call (featuring Trisha Yearwood)"',
|
||||||
u'title': u'Garth Brooks - "The Call (featuring Trisha Yearwood)"',
|
'description': 'Blame It All On My Roots',
|
||||||
u'description': u'Blame It All On My Roots',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
]
|
}]
|
||||||
|
|||||||
79
youtube_dl/extractor/cnet.py
Normal file
79
youtube_dl/extractor/cnet.py
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
int_or_none,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CNETIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?cnet\.com/videos/(?P<id>[^/]+)/'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.cnet.com/videos/hands-on-with-microsofts-windows-8-1-update/',
|
||||||
|
'md5': '041233212a0d06b179c87cbcca1577b8',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '56f4ea68-bd21-4852-b08c-4de5b8354c60',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Hands-on with Microsoft Windows 8.1 Update',
|
||||||
|
'description': 'The new update to the Windows 8 OS brings improved performance for mouse and keyboard users.',
|
||||||
|
'thumbnail': 're:^http://.*/flmswindows8.jpg$',
|
||||||
|
'uploader_id': 'sarah.mitroff@cbsinteractive.com',
|
||||||
|
'uploader': 'Sarah Mitroff',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
display_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
data_json = self._html_search_regex(
|
||||||
|
r"<div class=\"cnetVideoPlayer\"\s+.*?data-cnet-video-options='([^']+)'",
|
||||||
|
webpage, 'data json')
|
||||||
|
data = json.loads(data_json)
|
||||||
|
vdata = data['video']
|
||||||
|
if not vdata:
|
||||||
|
vdata = data['videos'][0]
|
||||||
|
if not vdata:
|
||||||
|
raise ExtractorError('Cannot find video data')
|
||||||
|
|
||||||
|
video_id = vdata['id']
|
||||||
|
title = vdata.get('headline')
|
||||||
|
if title is None:
|
||||||
|
title = vdata.get('title')
|
||||||
|
if title is None:
|
||||||
|
raise ExtractorError('Cannot find title!')
|
||||||
|
description = vdata.get('dek')
|
||||||
|
thumbnail = vdata.get('image', {}).get('path')
|
||||||
|
author = vdata.get('author')
|
||||||
|
if author:
|
||||||
|
uploader = '%s %s' % (author['firstName'], author['lastName'])
|
||||||
|
uploader_id = author.get('email')
|
||||||
|
else:
|
||||||
|
uploader = None
|
||||||
|
uploader_id = None
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'format_id': '%s-%s-%s' % (
|
||||||
|
f['type'], f['format'],
|
||||||
|
int_or_none(f.get('bitrate'), 1000, default='')),
|
||||||
|
'url': f['uri'],
|
||||||
|
'tbr': int_or_none(f.get('bitrate'), 1000),
|
||||||
|
} for f in vdata['files']['data']]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'display_id': display_id,
|
||||||
|
'title': title,
|
||||||
|
'formats': formats,
|
||||||
|
'description': description,
|
||||||
|
'uploader': uploader,
|
||||||
|
'uploader_id': uploader_id,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
}
|
||||||
@@ -79,8 +79,11 @@ class CNNIE(InfoExtractor):
|
|||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
thumbnails = sorted([((int(t.attrib['height']),int(t.attrib['width'])), t.text) for t in info.findall('images/image')])
|
thumbnails = [{
|
||||||
thumbs_dict = [{'resolution': res, 'url': t_url} for (res, t_url) in thumbnails]
|
'height': int(t.attrib['height']),
|
||||||
|
'width': int(t.attrib['width']),
|
||||||
|
'url': t.text,
|
||||||
|
} for t in info.findall('images/image')]
|
||||||
|
|
||||||
metas_el = info.find('metas')
|
metas_el = info.find('metas')
|
||||||
upload_date = (
|
upload_date = (
|
||||||
@@ -93,8 +96,7 @@ class CNNIE(InfoExtractor):
|
|||||||
'id': info.attrib['id'],
|
'id': info.attrib['id'],
|
||||||
'title': info.find('headline').text,
|
'title': info.find('headline').text,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'thumbnail': thumbnails[-1][1],
|
'thumbnails': thumbnails,
|
||||||
'thumbnails': thumbs_dict,
|
|
||||||
'description': info.find('description').text,
|
'description': info.find('description').text,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'upload_date': upload_date,
|
'upload_date': upload_date,
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class ComedyCentralIE(MTVServicesInfoExtractor):
|
class ComedyCentralIE(MTVServicesInfoExtractor):
|
||||||
_VALID_URL = r'''(?x)https?://(?:www\.)?(comedycentral|cc)\.com/
|
_VALID_URL = r'''(?x)https?://(?:www\.)?cc\.com/
|
||||||
(video-clips|episodes|cc-studios|video-collections)
|
(video-clips|episodes|cc-studios|video-collections|full-episodes)
|
||||||
/(?P<title>.*)'''
|
/(?P<title>.*)'''
|
||||||
_FEED_URL = 'http://comedycentral.com/feeds/mrss/'
|
_FEED_URL = 'http://comedycentral.com/feeds/mrss/'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://www.comedycentral.com/video-clips/kllhuv/stand-up-greg-fitzsimmons--uncensored---too-good-of-a-mother',
|
'url': 'http://www.cc.com/video-clips/kllhuv/stand-up-greg-fitzsimmons--uncensored---too-good-of-a-mother',
|
||||||
'md5': '4167875aae411f903b751a21f357f1ee',
|
'md5': 'c4f48e9eda1b16dd10add0744344b6d8',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'cef0cbb3-e776-4bc9-b62e-8016deccb354',
|
'id': 'cef0cbb3-e776-4bc9-b62e-8016deccb354',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
@@ -41,16 +41,16 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
_VALID_URL = r'''(?x)^(:(?P<shortname>tds|thedailyshow|cr|colbert|colbertnation|colbertreport)
|
_VALID_URL = r'''(?x)^(:(?P<shortname>tds|thedailyshow|cr|colbert|colbertnation|colbertreport)
|
||||||
|https?://(:www\.)?
|
|https?://(:www\.)?
|
||||||
(?P<showname>thedailyshow|thecolbertreport)\.(?:cc\.)?com/
|
(?P<showname>thedailyshow|thecolbertreport)\.(?:cc\.)?com/
|
||||||
(full-episodes/(?P<episode>.*)|
|
((?:full-)?episodes/(?:[0-9a-z]{6}/)?(?P<episode>.*)|
|
||||||
(?P<clip>
|
(?P<clip>
|
||||||
(?:videos/[^/]+/(?P<videotitle>[^/?#]+))
|
(?:(?:guests/[^/]+|videos|video-playlists|special-editions|news-team/[^/]+)/[^/]+/(?P<videotitle>[^/?#]+))
|
||||||
|(the-colbert-report-(videos|collections)/(?P<clipID>[0-9]+)/[^/]*/(?P<cntitle>.*?))
|
|(the-colbert-report-(videos|collections)/(?P<clipID>[0-9]+)/[^/]*/(?P<cntitle>.*?))
|
||||||
|(watch/(?P<date>[^/]*)/(?P<tdstitle>.*))
|
|(watch/(?P<date>[^/]*)/(?P<tdstitle>.*))
|
||||||
)|
|
)|
|
||||||
(?P<interview>
|
(?P<interview>
|
||||||
extended-interviews/(?P<interID>[0-9a-z]+)/(?:playlist_tds_extended_)?(?P<interview_title>.*?)(/.*?)?)))
|
extended-interviews/(?P<interID>[0-9a-z]+)/(?:playlist_tds_extended_)?(?P<interview_title>.*?)(/.*?)?)))
|
||||||
(?:[?#].*|$)'''
|
(?:[?#].*|$)'''
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://thedailyshow.cc.com/watch/thu-december-13-2012/kristen-stewart',
|
'url': 'http://thedailyshow.cc.com/watch/thu-december-13-2012/kristen-stewart',
|
||||||
'md5': '4e2f5cb088a83cd8cdb7756132f9739d',
|
'md5': '4e2f5cb088a83cd8cdb7756132f9739d',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@@ -59,9 +59,36 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
'upload_date': '20121213',
|
'upload_date': '20121213',
|
||||||
'description': 'Kristen Stewart learns to let loose in "On the Road."',
|
'description': 'Kristen Stewart learns to let loose in "On the Road."',
|
||||||
'uploader': 'thedailyshow',
|
'uploader': 'thedailyshow',
|
||||||
'title': 'thedailyshow-kristen-stewart part 1',
|
'title': 'thedailyshow kristen-stewart part 1',
|
||||||
}
|
}
|
||||||
}
|
}, {
|
||||||
|
'url': 'http://thedailyshow.cc.com/extended-interviews/xm3fnq/andrew-napolitano-extended-interview',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://thecolbertreport.cc.com/videos/29w6fx/-realhumanpraise-for-fox-news',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://thecolbertreport.cc.com/videos/gh6urb/neil-degrasse-tyson-pt--1?xrs=eml_col_031114',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://thedailyshow.cc.com/guests/michael-lewis/3efna8/exclusive---michael-lewis-extended-interview-pt--3',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://thedailyshow.cc.com/episodes/sy7yv0/april-8--2014---denis-leary',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://thecolbertreport.cc.com/episodes/8ase07/april-8--2014---jane-goodall',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://thedailyshow.cc.com/video-playlists/npde3s/the-daily-show-19088-highlights',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://thedailyshow.cc.com/special-editions/2l8fdb/special-edition---a-look-back-at-food',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://thedailyshow.cc.com/news-team/michael-che/7wnfel/we-need-to-talk-about-israel',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
_available_formats = ['3500', '2200', '1700', '1200', '750', '400']
|
_available_formats = ['3500', '2200', '1700', '1200', '750', '400']
|
||||||
|
|
||||||
@@ -130,7 +157,7 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
raise ExtractorError('Invalid redirected URL: ' + url)
|
raise ExtractorError('Invalid redirected URL: ' + url)
|
||||||
if mobj.group('episode') == '':
|
if mobj.group('episode') == '':
|
||||||
raise ExtractorError('Redirected URL is still not specific: ' + url)
|
raise ExtractorError('Redirected URL is still not specific: ' + url)
|
||||||
epTitle = mobj.group('episode').rpartition('/')[-1]
|
epTitle = (mobj.group('episode') or mobj.group('videotitle')).rpartition('/')[-1]
|
||||||
|
|
||||||
mMovieParams = re.findall('(?:<param name="movie" value="|var url = ")(http://media.mtvnservices.com/([^"]*(?:episode|video).*?:.*?))"', webpage)
|
mMovieParams = re.findall('(?:<param name="movie" value="|var url = ")(http://media.mtvnservices.com/([^"]*(?:episode|video).*?:.*?))"', webpage)
|
||||||
if len(mMovieParams) == 0:
|
if len(mMovieParams) == 0:
|
||||||
@@ -165,7 +192,7 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
content = itemEl.find('.//{http://search.yahoo.com/mrss/}content')
|
content = itemEl.find('.//{http://search.yahoo.com/mrss/}content')
|
||||||
duration = float_or_none(content.attrib.get('duration'))
|
duration = float_or_none(content.attrib.get('duration'))
|
||||||
mediagen_url = content.attrib['url']
|
mediagen_url = content.attrib['url']
|
||||||
guid = itemEl.find('.//guid').text.rpartition(':')[-1]
|
guid = itemEl.find('./guid').text.rpartition(':')[-1]
|
||||||
|
|
||||||
cdoc = self._download_xml(
|
cdoc = self._download_xml(
|
||||||
mediagen_url, epTitle,
|
mediagen_url, epTitle,
|
||||||
@@ -185,10 +212,13 @@ class ComedyCentralShowsIE(InfoExtractor):
|
|||||||
'ext': self._video_extensions.get(format, 'mp4'),
|
'ext': self._video_extensions.get(format, 'mp4'),
|
||||||
'height': h,
|
'height': h,
|
||||||
'width': w,
|
'width': w,
|
||||||
|
|
||||||
|
'format_note': 'HTTP 400 at the moment (patches welcome!)',
|
||||||
|
'preference': -100,
|
||||||
})
|
})
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': 'rtmp-%s' % format,
|
'format_id': 'rtmp-%s' % format,
|
||||||
'url': rtmp_video_url,
|
'url': rtmp_video_url.replace('viacomccstrm', 'viacommtvstrm'),
|
||||||
'ext': self._video_extensions.get(format, 'mp4'),
|
'ext': self._video_extensions.get(format, 'mp4'),
|
||||||
'height': h,
|
'height': h,
|
||||||
'width': w,
|
'width': w,
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
|
import netrc
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
import netrc
|
import time
|
||||||
import xml.etree.ElementTree
|
import xml.etree.ElementTree
|
||||||
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
@@ -17,6 +20,7 @@ from ..utils import (
|
|||||||
clean_html,
|
clean_html,
|
||||||
compiled_regex_type,
|
compiled_regex_type,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
int_or_none,
|
||||||
RegexNotFoundError,
|
RegexNotFoundError,
|
||||||
sanitize_filename,
|
sanitize_filename,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
@@ -68,6 +72,7 @@ class InfoExtractor(object):
|
|||||||
* vcodec Name of the video codec in use
|
* vcodec Name of the video codec in use
|
||||||
* container Name of the container format
|
* container Name of the container format
|
||||||
* filesize The number of bytes, if known in advance
|
* filesize The number of bytes, if known in advance
|
||||||
|
* filesize_approx An estimate for the number of bytes
|
||||||
* player_url SWF Player URL (used for rtmpdump).
|
* player_url SWF Player URL (used for rtmpdump).
|
||||||
* protocol The protocol that will be used for the actual
|
* protocol The protocol that will be used for the actual
|
||||||
download, lower-case.
|
download, lower-case.
|
||||||
@@ -81,6 +86,12 @@ class InfoExtractor(object):
|
|||||||
format, irrespective of the file format.
|
format, irrespective of the file format.
|
||||||
-1 for default (order by other properties),
|
-1 for default (order by other properties),
|
||||||
-2 or smaller for less than default.
|
-2 or smaller for less than default.
|
||||||
|
* http_referer HTTP Referer header value to set.
|
||||||
|
* http_method HTTP method to use for the download.
|
||||||
|
* http_headers A dictionary of additional HTTP headers
|
||||||
|
to add to the request.
|
||||||
|
* http_post_data Additional data to send with a POST
|
||||||
|
request.
|
||||||
url: Final video URL.
|
url: Final video URL.
|
||||||
ext: Video filename extension.
|
ext: Video filename extension.
|
||||||
format: The video format, defaults to ext (used for --get-format)
|
format: The video format, defaults to ext (used for --get-format)
|
||||||
@@ -92,8 +103,12 @@ class InfoExtractor(object):
|
|||||||
unique, but available before title. Typically, id is
|
unique, but available before title. Typically, id is
|
||||||
something like "4234987", title "Dancing naked mole rats",
|
something like "4234987", title "Dancing naked mole rats",
|
||||||
and display_id "dancing-naked-mole-rats"
|
and display_id "dancing-naked-mole-rats"
|
||||||
thumbnails: A list of dictionaries (with the entries "resolution" and
|
thumbnails: A list of dictionaries, with the following entries:
|
||||||
"url") for the varying thumbnails
|
* "url"
|
||||||
|
* "width" (optional, int)
|
||||||
|
* "height" (optional, int)
|
||||||
|
* "resolution" (optional, string "{width}x{height"},
|
||||||
|
deprecated)
|
||||||
thumbnail: Full URL to a video thumbnail image.
|
thumbnail: Full URL to a video thumbnail image.
|
||||||
description: One-line video description.
|
description: One-line video description.
|
||||||
uploader: Full name of the video uploader.
|
uploader: Full name of the video uploader.
|
||||||
@@ -101,7 +116,7 @@ class InfoExtractor(object):
|
|||||||
upload_date: Video upload date (YYYYMMDD).
|
upload_date: Video upload date (YYYYMMDD).
|
||||||
If not explicitly set, calculated from timestamp.
|
If not explicitly set, calculated from timestamp.
|
||||||
uploader_id: Nickname or id of the video uploader.
|
uploader_id: Nickname or id of the video uploader.
|
||||||
location: Physical location of the video.
|
location: Physical location where the video was filmed.
|
||||||
subtitles: The subtitle file contents as a dictionary in the format
|
subtitles: The subtitle file contents as a dictionary in the format
|
||||||
{language: subtitles}.
|
{language: subtitles}.
|
||||||
duration: Length of the video in seconds, as an integer.
|
duration: Length of the video in seconds, as an integer.
|
||||||
@@ -113,6 +128,8 @@ class InfoExtractor(object):
|
|||||||
webpage_url: The url to the video webpage, if given to youtube-dl it
|
webpage_url: The url to the video webpage, if given to youtube-dl it
|
||||||
should allow to get the same result again. (It will be set
|
should allow to get the same result again. (It will be set
|
||||||
by YoutubeDL if it's missing)
|
by YoutubeDL if it's missing)
|
||||||
|
categories: A list of categories that the video falls in, for example
|
||||||
|
["Sports", "Berlin"]
|
||||||
|
|
||||||
Unless mentioned otherwise, the fields should be Unicode strings.
|
Unless mentioned otherwise, the fields should be Unicode strings.
|
||||||
|
|
||||||
@@ -187,17 +204,17 @@ class InfoExtractor(object):
|
|||||||
self.report_download_webpage(video_id)
|
self.report_download_webpage(video_id)
|
||||||
elif note is not False:
|
elif note is not False:
|
||||||
if video_id is None:
|
if video_id is None:
|
||||||
self.to_screen(u'%s' % (note,))
|
self.to_screen('%s' % (note,))
|
||||||
else:
|
else:
|
||||||
self.to_screen(u'%s: %s' % (video_id, note))
|
self.to_screen('%s: %s' % (video_id, note))
|
||||||
try:
|
try:
|
||||||
return self._downloader.urlopen(url_or_request)
|
return self._downloader.urlopen(url_or_request)
|
||||||
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
|
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
|
||||||
if errnote is False:
|
if errnote is False:
|
||||||
return False
|
return False
|
||||||
if errnote is None:
|
if errnote is None:
|
||||||
errnote = u'Unable to download webpage'
|
errnote = 'Unable to download webpage'
|
||||||
errmsg = u'%s: %s' % (errnote, compat_str(err))
|
errmsg = '%s: %s' % (errnote, compat_str(err))
|
||||||
if fatal:
|
if fatal:
|
||||||
raise ExtractorError(errmsg, sys.exc_info()[2], cause=err)
|
raise ExtractorError(errmsg, sys.exc_info()[2], cause=err)
|
||||||
else:
|
else:
|
||||||
@@ -234,7 +251,7 @@ class InfoExtractor(object):
|
|||||||
url = url_or_request.get_full_url()
|
url = url_or_request.get_full_url()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
url = url_or_request
|
url = url_or_request
|
||||||
self.to_screen(u'Dumping request to ' + url)
|
self.to_screen('Dumping request to ' + url)
|
||||||
dump = base64.b64encode(webpage_bytes).decode('ascii')
|
dump = base64.b64encode(webpage_bytes).decode('ascii')
|
||||||
self._downloader.to_screen(dump)
|
self._downloader.to_screen(dump)
|
||||||
if self._downloader.params.get('write_pages', False):
|
if self._downloader.params.get('write_pages', False):
|
||||||
@@ -242,16 +259,31 @@ class InfoExtractor(object):
|
|||||||
url = url_or_request.get_full_url()
|
url = url_or_request.get_full_url()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
url = url_or_request
|
url = url_or_request
|
||||||
if len(url) > 200:
|
basen = '%s_%s' % (video_id, url)
|
||||||
h = u'___' + hashlib.md5(url.encode('utf-8')).hexdigest()
|
if len(basen) > 240:
|
||||||
url = url[:200 - len(h)] + h
|
h = '___' + hashlib.md5(basen.encode('utf-8')).hexdigest()
|
||||||
raw_filename = ('%s_%s.dump' % (video_id, url))
|
basen = basen[:240 - len(h)] + h
|
||||||
|
raw_filename = basen + '.dump'
|
||||||
filename = sanitize_filename(raw_filename, restricted=True)
|
filename = sanitize_filename(raw_filename, restricted=True)
|
||||||
self.to_screen(u'Saving request to ' + filename)
|
self.to_screen('Saving request to ' + filename)
|
||||||
with open(filename, 'wb') as outf:
|
with open(filename, 'wb') as outf:
|
||||||
outf.write(webpage_bytes)
|
outf.write(webpage_bytes)
|
||||||
|
|
||||||
content = webpage_bytes.decode(encoding, 'replace')
|
try:
|
||||||
|
content = webpage_bytes.decode(encoding, 'replace')
|
||||||
|
except LookupError:
|
||||||
|
content = webpage_bytes.decode('utf-8', 'replace')
|
||||||
|
|
||||||
|
if ('<title>Access to this site is blocked</title>' in content and
|
||||||
|
'Websense' in content[:512]):
|
||||||
|
msg = 'Access to this webpage has been blocked by Websense filtering software in your network.'
|
||||||
|
blocked_iframe = self._html_search_regex(
|
||||||
|
r'<iframe src="([^"]+)"', content,
|
||||||
|
'Websense information URL', default=None)
|
||||||
|
if blocked_iframe:
|
||||||
|
msg += ' Visit %s for more details' % blocked_iframe
|
||||||
|
raise ExtractorError(msg, expected=True)
|
||||||
|
|
||||||
return (content, urlh)
|
return (content, urlh)
|
||||||
|
|
||||||
def _download_webpage(self, url_or_request, video_id, note=None, errnote=None, fatal=True):
|
def _download_webpage(self, url_or_request, video_id, note=None, errnote=None, fatal=True):
|
||||||
@@ -264,19 +296,26 @@ class InfoExtractor(object):
|
|||||||
return content
|
return content
|
||||||
|
|
||||||
def _download_xml(self, url_or_request, video_id,
|
def _download_xml(self, url_or_request, video_id,
|
||||||
note=u'Downloading XML', errnote=u'Unable to download XML',
|
note='Downloading XML', errnote='Unable to download XML',
|
||||||
transform_source=None):
|
transform_source=None, fatal=True):
|
||||||
"""Return the xml as an xml.etree.ElementTree.Element"""
|
"""Return the xml as an xml.etree.ElementTree.Element"""
|
||||||
xml_string = self._download_webpage(url_or_request, video_id, note, errnote)
|
xml_string = self._download_webpage(
|
||||||
|
url_or_request, video_id, note, errnote, fatal=fatal)
|
||||||
|
if xml_string is False:
|
||||||
|
return xml_string
|
||||||
if transform_source:
|
if transform_source:
|
||||||
xml_string = transform_source(xml_string)
|
xml_string = transform_source(xml_string)
|
||||||
return xml.etree.ElementTree.fromstring(xml_string.encode('utf-8'))
|
return xml.etree.ElementTree.fromstring(xml_string.encode('utf-8'))
|
||||||
|
|
||||||
def _download_json(self, url_or_request, video_id,
|
def _download_json(self, url_or_request, video_id,
|
||||||
note=u'Downloading JSON metadata',
|
note='Downloading JSON metadata',
|
||||||
errnote=u'Unable to download JSON metadata',
|
errnote='Unable to download JSON metadata',
|
||||||
transform_source=None):
|
transform_source=None,
|
||||||
json_string = self._download_webpage(url_or_request, video_id, note, errnote)
|
fatal=True):
|
||||||
|
json_string = self._download_webpage(
|
||||||
|
url_or_request, video_id, note, errnote, fatal=fatal)
|
||||||
|
if (not fatal) and json_string is False:
|
||||||
|
return None
|
||||||
if transform_source:
|
if transform_source:
|
||||||
json_string = transform_source(json_string)
|
json_string = transform_source(json_string)
|
||||||
try:
|
try:
|
||||||
@@ -285,29 +324,29 @@ class InfoExtractor(object):
|
|||||||
raise ExtractorError('Failed to download JSON', cause=ve)
|
raise ExtractorError('Failed to download JSON', cause=ve)
|
||||||
|
|
||||||
def report_warning(self, msg, video_id=None):
|
def report_warning(self, msg, video_id=None):
|
||||||
idstr = u'' if video_id is None else u'%s: ' % video_id
|
idstr = '' if video_id is None else '%s: ' % video_id
|
||||||
self._downloader.report_warning(
|
self._downloader.report_warning(
|
||||||
u'[%s] %s%s' % (self.IE_NAME, idstr, msg))
|
'[%s] %s%s' % (self.IE_NAME, idstr, msg))
|
||||||
|
|
||||||
def to_screen(self, msg):
|
def to_screen(self, msg):
|
||||||
"""Print msg to screen, prefixing it with '[ie_name]'"""
|
"""Print msg to screen, prefixing it with '[ie_name]'"""
|
||||||
self._downloader.to_screen(u'[%s] %s' % (self.IE_NAME, msg))
|
self._downloader.to_screen('[%s] %s' % (self.IE_NAME, msg))
|
||||||
|
|
||||||
def report_extraction(self, id_or_name):
|
def report_extraction(self, id_or_name):
|
||||||
"""Report information extraction."""
|
"""Report information extraction."""
|
||||||
self.to_screen(u'%s: Extracting information' % id_or_name)
|
self.to_screen('%s: Extracting information' % id_or_name)
|
||||||
|
|
||||||
def report_download_webpage(self, video_id):
|
def report_download_webpage(self, video_id):
|
||||||
"""Report webpage download."""
|
"""Report webpage download."""
|
||||||
self.to_screen(u'%s: Downloading webpage' % video_id)
|
self.to_screen('%s: Downloading webpage' % video_id)
|
||||||
|
|
||||||
def report_age_confirmation(self):
|
def report_age_confirmation(self):
|
||||||
"""Report attempt to confirm age."""
|
"""Report attempt to confirm age."""
|
||||||
self.to_screen(u'Confirming age')
|
self.to_screen('Confirming age')
|
||||||
|
|
||||||
def report_login(self):
|
def report_login(self):
|
||||||
"""Report attempt to log in."""
|
"""Report attempt to log in."""
|
||||||
self.to_screen(u'Logging in')
|
self.to_screen('Logging in')
|
||||||
|
|
||||||
#Methods for following #608
|
#Methods for following #608
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -343,10 +382,11 @@ class InfoExtractor(object):
|
|||||||
else:
|
else:
|
||||||
for p in pattern:
|
for p in pattern:
|
||||||
mobj = re.search(p, string, flags)
|
mobj = re.search(p, string, flags)
|
||||||
if mobj: break
|
if mobj:
|
||||||
|
break
|
||||||
|
|
||||||
if os.name != 'nt' and sys.stderr.isatty():
|
if os.name != 'nt' and sys.stderr.isatty():
|
||||||
_name = u'\033[0;34m%s\033[0m' % name
|
_name = '\033[0;34m%s\033[0m' % name
|
||||||
else:
|
else:
|
||||||
_name = name
|
_name = name
|
||||||
|
|
||||||
@@ -356,10 +396,10 @@ class InfoExtractor(object):
|
|||||||
elif default is not _NO_DEFAULT:
|
elif default is not _NO_DEFAULT:
|
||||||
return default
|
return default
|
||||||
elif fatal:
|
elif fatal:
|
||||||
raise RegexNotFoundError(u'Unable to extract %s' % _name)
|
raise RegexNotFoundError('Unable to extract %s' % _name)
|
||||||
else:
|
else:
|
||||||
self._downloader.report_warning(u'unable to extract %s; '
|
self._downloader.report_warning('unable to extract %s; '
|
||||||
u'please report this issue on http://yt-dl.org/bug' % _name)
|
'please report this issue on http://yt-dl.org/bug' % _name)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _html_search_regex(self, pattern, string, name, default=_NO_DEFAULT, fatal=True, flags=0):
|
def _html_search_regex(self, pattern, string, name, default=_NO_DEFAULT, fatal=True, flags=0):
|
||||||
@@ -398,10 +438,26 @@ class InfoExtractor(object):
|
|||||||
else:
|
else:
|
||||||
raise netrc.NetrcParseError('No authenticators for %s' % self._NETRC_MACHINE)
|
raise netrc.NetrcParseError('No authenticators for %s' % self._NETRC_MACHINE)
|
||||||
except (IOError, netrc.NetrcParseError) as err:
|
except (IOError, netrc.NetrcParseError) as err:
|
||||||
self._downloader.report_warning(u'parsing .netrc: %s' % compat_str(err))
|
self._downloader.report_warning('parsing .netrc: %s' % compat_str(err))
|
||||||
|
|
||||||
return (username, password)
|
return (username, password)
|
||||||
|
|
||||||
|
def _get_tfa_info(self):
|
||||||
|
"""
|
||||||
|
Get the two-factor authentication info
|
||||||
|
TODO - asking the user will be required for sms/phone verify
|
||||||
|
currently just uses the command line option
|
||||||
|
If there's no info available, return None
|
||||||
|
"""
|
||||||
|
if self._downloader is None:
|
||||||
|
return None
|
||||||
|
downloader_params = self._downloader.params
|
||||||
|
|
||||||
|
if downloader_params.get('twofactor', None) is not None:
|
||||||
|
return downloader_params['twofactor']
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
# Helper functions for extracting OpenGraph info
|
# Helper functions for extracting OpenGraph info
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _og_regexes(prop):
|
def _og_regexes(prop):
|
||||||
@@ -422,7 +478,7 @@ class InfoExtractor(object):
|
|||||||
return unescapeHTML(escaped)
|
return unescapeHTML(escaped)
|
||||||
|
|
||||||
def _og_search_thumbnail(self, html, **kargs):
|
def _og_search_thumbnail(self, html, **kargs):
|
||||||
return self._og_search_property('image', html, u'thumbnail url', fatal=False, **kargs)
|
return self._og_search_property('image', html, 'thumbnail url', fatal=False, **kargs)
|
||||||
|
|
||||||
def _og_search_description(self, html, **kargs):
|
def _og_search_description(self, html, **kargs):
|
||||||
return self._og_search_property('description', html, fatal=False, **kargs)
|
return self._og_search_property('description', html, fatal=False, **kargs)
|
||||||
@@ -431,18 +487,22 @@ class InfoExtractor(object):
|
|||||||
return self._og_search_property('title', html, **kargs)
|
return self._og_search_property('title', html, **kargs)
|
||||||
|
|
||||||
def _og_search_video_url(self, html, name='video url', secure=True, **kargs):
|
def _og_search_video_url(self, html, name='video url', secure=True, **kargs):
|
||||||
regexes = self._og_regexes('video')
|
regexes = self._og_regexes('video') + self._og_regexes('video:url')
|
||||||
if secure: regexes = self._og_regexes('video:secure_url') + regexes
|
if secure:
|
||||||
|
regexes = self._og_regexes('video:secure_url') + regexes
|
||||||
return self._html_search_regex(regexes, html, name, **kargs)
|
return self._html_search_regex(regexes, html, name, **kargs)
|
||||||
|
|
||||||
def _html_search_meta(self, name, html, display_name=None, fatal=False):
|
def _og_search_url(self, html, **kargs):
|
||||||
|
return self._og_search_property('url', html, **kargs)
|
||||||
|
|
||||||
|
def _html_search_meta(self, name, html, display_name=None, fatal=False, **kwargs):
|
||||||
if display_name is None:
|
if display_name is None:
|
||||||
display_name = name
|
display_name = name
|
||||||
return self._html_search_regex(
|
return self._html_search_regex(
|
||||||
r'''(?ix)<meta
|
r'''(?ix)<meta
|
||||||
(?=[^>]+(?:itemprop|name|property)=["\']%s["\'])
|
(?=[^>]+(?:itemprop|name|property)=["\']?%s["\']?)
|
||||||
[^>]+content=["\']([^"\']+)["\']''' % re.escape(name),
|
[^>]+content=["\']([^"\']+)["\']''' % re.escape(name),
|
||||||
html, display_name, fatal=fatal)
|
html, display_name, fatal=fatal, **kwargs)
|
||||||
|
|
||||||
def _dc_search_uploader(self, html):
|
def _dc_search_uploader(self, html):
|
||||||
return self._html_search_meta('dc.creator', html, 'uploader')
|
return self._html_search_meta('dc.creator', html, 'uploader')
|
||||||
@@ -477,7 +537,7 @@ class InfoExtractor(object):
|
|||||||
|
|
||||||
def _sort_formats(self, formats):
|
def _sort_formats(self, formats):
|
||||||
if not formats:
|
if not formats:
|
||||||
raise ExtractorError(u'No video formats found')
|
raise ExtractorError('No video formats found')
|
||||||
|
|
||||||
def _formats_key(f):
|
def _formats_key(f):
|
||||||
# TODO remove the following workaround
|
# TODO remove the following workaround
|
||||||
@@ -497,9 +557,9 @@ class InfoExtractor(object):
|
|||||||
|
|
||||||
if f.get('vcodec') == 'none': # audio only
|
if f.get('vcodec') == 'none': # audio only
|
||||||
if self._downloader.params.get('prefer_free_formats'):
|
if self._downloader.params.get('prefer_free_formats'):
|
||||||
ORDER = [u'aac', u'mp3', u'm4a', u'webm', u'ogg', u'opus']
|
ORDER = ['aac', 'mp3', 'm4a', 'webm', 'ogg', 'opus']
|
||||||
else:
|
else:
|
||||||
ORDER = [u'webm', u'opus', u'ogg', u'mp3', u'aac', u'm4a']
|
ORDER = ['webm', 'opus', 'ogg', 'mp3', 'aac', 'm4a']
|
||||||
ext_preference = 0
|
ext_preference = 0
|
||||||
try:
|
try:
|
||||||
audio_ext_preference = ORDER.index(f['ext'])
|
audio_ext_preference = ORDER.index(f['ext'])
|
||||||
@@ -507,9 +567,9 @@ class InfoExtractor(object):
|
|||||||
audio_ext_preference = -1
|
audio_ext_preference = -1
|
||||||
else:
|
else:
|
||||||
if self._downloader.params.get('prefer_free_formats'):
|
if self._downloader.params.get('prefer_free_formats'):
|
||||||
ORDER = [u'flv', u'mp4', u'webm']
|
ORDER = ['flv', 'mp4', 'webm']
|
||||||
else:
|
else:
|
||||||
ORDER = [u'webm', u'flv', u'mp4']
|
ORDER = ['webm', 'flv', 'mp4']
|
||||||
try:
|
try:
|
||||||
ext_preference = ORDER.index(f['ext'])
|
ext_preference = ORDER.index(f['ext'])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@@ -527,10 +587,112 @@ class InfoExtractor(object):
|
|||||||
f.get('abr') if f.get('abr') is not None else -1,
|
f.get('abr') if f.get('abr') is not None else -1,
|
||||||
audio_ext_preference,
|
audio_ext_preference,
|
||||||
f.get('filesize') if f.get('filesize') is not None else -1,
|
f.get('filesize') if f.get('filesize') is not None else -1,
|
||||||
|
f.get('filesize_approx') if f.get('filesize_approx') is not None else -1,
|
||||||
f.get('format_id'),
|
f.get('format_id'),
|
||||||
)
|
)
|
||||||
formats.sort(key=_formats_key)
|
formats.sort(key=_formats_key)
|
||||||
|
|
||||||
|
def http_scheme(self):
|
||||||
|
""" Either "https:" or "https:", depending on the user's preferences """
|
||||||
|
return (
|
||||||
|
'http:'
|
||||||
|
if self._downloader.params.get('prefer_insecure', False)
|
||||||
|
else 'https:')
|
||||||
|
|
||||||
|
def _proto_relative_url(self, url, scheme=None):
|
||||||
|
if url is None:
|
||||||
|
return url
|
||||||
|
if url.startswith('//'):
|
||||||
|
if scheme is None:
|
||||||
|
scheme = self.http_scheme()
|
||||||
|
return scheme + url
|
||||||
|
else:
|
||||||
|
return url
|
||||||
|
|
||||||
|
def _sleep(self, timeout, video_id, msg_template=None):
|
||||||
|
if msg_template is None:
|
||||||
|
msg_template = '%(video_id)s: Waiting for %(timeout)s seconds'
|
||||||
|
msg = msg_template % {'video_id': video_id, 'timeout': timeout}
|
||||||
|
self.to_screen(msg)
|
||||||
|
time.sleep(timeout)
|
||||||
|
|
||||||
|
def _extract_f4m_formats(self, manifest_url, video_id):
|
||||||
|
manifest = self._download_xml(
|
||||||
|
manifest_url, video_id, 'Downloading f4m manifest',
|
||||||
|
'Unable to download f4m manifest')
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
media_nodes = manifest.findall('{http://ns.adobe.com/f4m/1.0}media')
|
||||||
|
for i, media_el in enumerate(media_nodes):
|
||||||
|
tbr = int_or_none(media_el.attrib.get('bitrate'))
|
||||||
|
format_id = 'f4m-%d' % (i if tbr is None else tbr)
|
||||||
|
formats.append({
|
||||||
|
'format_id': format_id,
|
||||||
|
'url': manifest_url,
|
||||||
|
'ext': 'flv',
|
||||||
|
'tbr': tbr,
|
||||||
|
'width': int_or_none(media_el.attrib.get('width')),
|
||||||
|
'height': int_or_none(media_el.attrib.get('height')),
|
||||||
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return formats
|
||||||
|
|
||||||
|
def _extract_m3u8_formats(self, m3u8_url, video_id, ext=None):
|
||||||
|
formats = [{
|
||||||
|
'format_id': 'm3u8-meta',
|
||||||
|
'url': m3u8_url,
|
||||||
|
'ext': ext,
|
||||||
|
'protocol': 'm3u8',
|
||||||
|
'preference': -1,
|
||||||
|
'resolution': 'multiple',
|
||||||
|
'format_note': 'Quality selection URL',
|
||||||
|
}]
|
||||||
|
|
||||||
|
m3u8_doc = self._download_webpage(m3u8_url, video_id)
|
||||||
|
last_info = None
|
||||||
|
kv_rex = re.compile(
|
||||||
|
r'(?P<key>[a-zA-Z_-]+)=(?P<val>"[^"]+"|[^",]+)(?:,|$)')
|
||||||
|
for line in m3u8_doc.splitlines():
|
||||||
|
if line.startswith('#EXT-X-STREAM-INF:'):
|
||||||
|
last_info = {}
|
||||||
|
for m in kv_rex.finditer(line):
|
||||||
|
v = m.group('val')
|
||||||
|
if v.startswith('"'):
|
||||||
|
v = v[1:-1]
|
||||||
|
last_info[m.group('key')] = v
|
||||||
|
elif line.startswith('#') or not line.strip():
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
if last_info is None:
|
||||||
|
formats.append({'url': line})
|
||||||
|
continue
|
||||||
|
tbr = int_or_none(last_info.get('BANDWIDTH'), scale=1000)
|
||||||
|
|
||||||
|
f = {
|
||||||
|
'format_id': 'm3u8-%d' % (tbr if tbr else len(formats)),
|
||||||
|
'url': line.strip(),
|
||||||
|
'tbr': tbr,
|
||||||
|
'ext': ext,
|
||||||
|
}
|
||||||
|
codecs = last_info.get('CODECS')
|
||||||
|
if codecs:
|
||||||
|
# TODO: looks like video codec is not always necessarily goes first
|
||||||
|
va_codecs = codecs.split(',')
|
||||||
|
if va_codecs[0]:
|
||||||
|
f['vcodec'] = va_codecs[0].partition('.')[0]
|
||||||
|
if len(va_codecs) > 1 and va_codecs[1]:
|
||||||
|
f['acodec'] = va_codecs[1].partition('.')[0]
|
||||||
|
resolution = last_info.get('RESOLUTION')
|
||||||
|
if resolution:
|
||||||
|
width_str, height_str = resolution.split('x')
|
||||||
|
f['width'] = int(width_str)
|
||||||
|
f['height'] = int(height_str)
|
||||||
|
formats.append(f)
|
||||||
|
last_info = {}
|
||||||
|
self._sort_formats(formats)
|
||||||
|
return formats
|
||||||
|
|
||||||
|
|
||||||
class SearchInfoExtractor(InfoExtractor):
|
class SearchInfoExtractor(InfoExtractor):
|
||||||
"""
|
"""
|
||||||
@@ -550,7 +712,7 @@ class SearchInfoExtractor(InfoExtractor):
|
|||||||
def _real_extract(self, query):
|
def _real_extract(self, query):
|
||||||
mobj = re.match(self._make_valid_url(), query)
|
mobj = re.match(self._make_valid_url(), query)
|
||||||
if mobj is None:
|
if mobj is None:
|
||||||
raise ExtractorError(u'Invalid search query "%s"' % query)
|
raise ExtractorError('Invalid search query "%s"' % query)
|
||||||
|
|
||||||
prefix = mobj.group('prefix')
|
prefix = mobj.group('prefix')
|
||||||
query = mobj.group('query')
|
query = mobj.group('query')
|
||||||
@@ -561,9 +723,9 @@ class SearchInfoExtractor(InfoExtractor):
|
|||||||
else:
|
else:
|
||||||
n = int(prefix)
|
n = int(prefix)
|
||||||
if n <= 0:
|
if n <= 0:
|
||||||
raise ExtractorError(u'invalid download number %s for query "%s"' % (n, query))
|
raise ExtractorError('invalid download number %s for query "%s"' % (n, query))
|
||||||
elif n > self._MAX_RESULTS:
|
elif n > self._MAX_RESULTS:
|
||||||
self._downloader.report_warning(u'%s returns max %i results (you requested %i)' % (self._SEARCH_KEY, self._MAX_RESULTS, n))
|
self._downloader.report_warning('%s returns max %i results (you requested %i)' % (self._SEARCH_KEY, self._MAX_RESULTS, n))
|
||||||
n = self._MAX_RESULTS
|
n = self._MAX_RESULTS
|
||||||
return self._get_n_results(query, n)
|
return self._get_n_results(query, n)
|
||||||
|
|
||||||
|
|||||||
@@ -28,16 +28,18 @@ class CondeNastIE(InfoExtractor):
|
|||||||
'glamour': 'Glamour',
|
'glamour': 'Glamour',
|
||||||
'wmagazine': 'W Magazine',
|
'wmagazine': 'W Magazine',
|
||||||
'vanityfair': 'Vanity Fair',
|
'vanityfair': 'Vanity Fair',
|
||||||
|
'cnevids': 'Condé Nast',
|
||||||
}
|
}
|
||||||
|
|
||||||
_VALID_URL = r'http://(video|www)\.(?P<site>%s)\.com/(?P<type>watch|series|video)/(?P<id>.+)' % '|'.join(_SITES.keys())
|
_VALID_URL = r'http://(video|www|player)\.(?P<site>%s)\.com/(?P<type>watch|series|video|embed)/(?P<id>[^/?#]+)' % '|'.join(_SITES.keys())
|
||||||
IE_DESC = 'Condé Nast media group: %s' % ', '.join(sorted(_SITES.values()))
|
IE_DESC = 'Condé Nast media group: %s' % ', '.join(sorted(_SITES.values()))
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://video.wired.com/watch/3d-printed-speakers-lit-with-led',
|
'url': 'http://video.wired.com/watch/3d-printed-speakers-lit-with-led',
|
||||||
'file': '5171b343c2b4c00dd0c1ccb3.mp4',
|
|
||||||
'md5': '1921f713ed48aabd715691f774c451f7',
|
'md5': '1921f713ed48aabd715691f774c451f7',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': '5171b343c2b4c00dd0c1ccb3',
|
||||||
|
'ext': 'mp4',
|
||||||
'title': '3D Printed Speakers Lit With LED',
|
'title': '3D Printed Speakers Lit With LED',
|
||||||
'description': 'Check out these beautiful 3D printed LED speakers. You can\'t actually buy them, but LumiGeek is working on a board that will let you make you\'re own.',
|
'description': 'Check out these beautiful 3D printed LED speakers. You can\'t actually buy them, but LumiGeek is working on a board that will let you make you\'re own.',
|
||||||
}
|
}
|
||||||
@@ -55,12 +57,16 @@ class CondeNastIE(InfoExtractor):
|
|||||||
entries = [self.url_result(build_url(path), 'CondeNast') for path in paths]
|
entries = [self.url_result(build_url(path), 'CondeNast') for path in paths]
|
||||||
return self.playlist_result(entries, playlist_title=title)
|
return self.playlist_result(entries, playlist_title=title)
|
||||||
|
|
||||||
def _extract_video(self, webpage):
|
def _extract_video(self, webpage, url_type):
|
||||||
description = self._html_search_regex([r'<div class="cne-video-description">(.+?)</div>',
|
if url_type != 'embed':
|
||||||
r'<div class="video-post-content">(.+?)</div>',
|
description = self._html_search_regex(
|
||||||
],
|
[
|
||||||
webpage, 'description',
|
r'<div class="cne-video-description">(.+?)</div>',
|
||||||
fatal=False, flags=re.DOTALL)
|
r'<div class="video-post-content">(.+?)</div>',
|
||||||
|
],
|
||||||
|
webpage, 'description', fatal=False, flags=re.DOTALL)
|
||||||
|
else:
|
||||||
|
description = None
|
||||||
params = self._search_regex(r'var params = {(.+?)}[;,]', webpage,
|
params = self._search_regex(r'var params = {(.+?)}[;,]', webpage,
|
||||||
'player params', flags=re.DOTALL)
|
'player params', flags=re.DOTALL)
|
||||||
video_id = self._search_regex(r'videoId: [\'"](.+?)[\'"]', params, 'video id')
|
video_id = self._search_regex(r'videoId: [\'"](.+?)[\'"]', params, 'video id')
|
||||||
@@ -99,12 +105,12 @@ class CondeNastIE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
site = mobj.group('site')
|
site = mobj.group('site')
|
||||||
url_type = mobj.group('type')
|
url_type = mobj.group('type')
|
||||||
id = mobj.group('id')
|
item_id = mobj.group('id')
|
||||||
|
|
||||||
self.to_screen(u'Extracting from %s with the Condé Nast extractor' % self._SITES[site])
|
self.to_screen('Extracting from %s with the Condé Nast extractor' % self._SITES[site])
|
||||||
webpage = self._download_webpage(url, id)
|
webpage = self._download_webpage(url, item_id)
|
||||||
|
|
||||||
if url_type == 'series':
|
if url_type == 'series':
|
||||||
return self._extract_series(url, webpage)
|
return self._extract_series(url, webpage)
|
||||||
else:
|
else:
|
||||||
return self._extract_video(webpage)
|
return self._extract_video(webpage, url_type)
|
||||||
|
|||||||
65
youtube_dl/extractor/cracked.py
Normal file
65
youtube_dl/extractor/cracked.py
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
parse_iso8601,
|
||||||
|
str_to_int,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CrackedIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?cracked\.com/video_(?P<id>\d+)_[\da-z-]+\.html'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.cracked.com/video_19006_4-plot-holes-you-didnt-notice-in-your-favorite-movies.html',
|
||||||
|
'md5': '4b29a5eeec292cd5eca6388c7558db9e',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '19006',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': '4 Plot Holes You Didn\'t Notice in Your Favorite Movies',
|
||||||
|
'description': 'md5:3b909e752661db86007d10e5ec2df769',
|
||||||
|
'timestamp': 1405659600,
|
||||||
|
'upload_date': '20140718',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
video_url = self._html_search_regex(
|
||||||
|
[r'var\s+CK_vidSrc\s*=\s*"([^"]+)"', r'<video\s+src="([^"]+)"'], webpage, 'video URL')
|
||||||
|
|
||||||
|
title = self._og_search_title(webpage)
|
||||||
|
description = self._og_search_description(webpage)
|
||||||
|
|
||||||
|
timestamp = self._html_search_regex(r'<time datetime="([^"]+)"', webpage, 'upload date', fatal=False)
|
||||||
|
if timestamp:
|
||||||
|
timestamp = parse_iso8601(timestamp[:-6])
|
||||||
|
|
||||||
|
view_count = str_to_int(self._html_search_regex(
|
||||||
|
r'<span class="views" id="viewCounts">([\d,\.]+) Views</span>', webpage, 'view count', fatal=False))
|
||||||
|
comment_count = str_to_int(self._html_search_regex(
|
||||||
|
r'<span id="commentCounts">([\d,\.]+)</span>', webpage, 'comment count', fatal=False))
|
||||||
|
|
||||||
|
m = re.search(r'_(?P<width>\d+)X(?P<height>\d+)\.mp4$', video_url)
|
||||||
|
if m:
|
||||||
|
width = int(m.group('width'))
|
||||||
|
height = int(m.group('height'))
|
||||||
|
else:
|
||||||
|
width = height = None
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url':video_url,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'timestamp': timestamp,
|
||||||
|
'view_count': view_count,
|
||||||
|
'comment_count': comment_count,
|
||||||
|
'height': height,
|
||||||
|
'width': width,
|
||||||
|
}
|
||||||
@@ -1,40 +1,43 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import determine_ext
|
|
||||||
|
|
||||||
class CriterionIE(InfoExtractor):
|
class CriterionIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://www\.criterion\.com/films/(\d*)-.+'
|
_VALID_URL = r'https?://www\.criterion\.com/films/(?P<id>[0-9]+)-.+'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.criterion.com/films/184-le-samourai',
|
'url': 'http://www.criterion.com/films/184-le-samourai',
|
||||||
u'file': u'184.mp4',
|
'md5': 'bc51beba55685509883a9a7830919ec3',
|
||||||
u'md5': u'bc51beba55685509883a9a7830919ec3',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '184',
|
||||||
u"title": u"Le Samouraï",
|
'ext': 'mp4',
|
||||||
u"description" : u'md5:a2b4b116326558149bef81f76dcbb93f',
|
'title': 'Le Samouraï',
|
||||||
|
'description': 'md5:a2b4b116326558149bef81f76dcbb93f',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group(1)
|
video_id = mobj.group('id')
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
final_url = self._search_regex(r'so.addVariable\("videoURL", "(.+?)"\)\;',
|
final_url = self._search_regex(
|
||||||
webpage, 'video url')
|
r'so.addVariable\("videoURL", "(.+?)"\)\;', webpage, 'video url')
|
||||||
title = self._html_search_regex(r'<meta content="(.+?)" property="og:title" />',
|
title = self._og_search_title(webpage)
|
||||||
webpage, 'video title')
|
description = self._html_search_regex(
|
||||||
description = self._html_search_regex(r'<meta name="description" content="(.+?)" />',
|
r'<meta name="description" content="(.+?)" />',
|
||||||
webpage, 'video description')
|
webpage, 'video description')
|
||||||
thumbnail = self._search_regex(r'so.addVariable\("thumbnailURL", "(.+?)"\)\;',
|
thumbnail = self._search_regex(
|
||||||
webpage, 'thumbnail url')
|
r'so.addVariable\("thumbnailURL", "(.+?)"\)\;',
|
||||||
|
webpage, 'thumbnail url')
|
||||||
|
|
||||||
return {'id': video_id,
|
return {
|
||||||
'url' : final_url,
|
'id': video_id,
|
||||||
'title': title,
|
'url': final_url,
|
||||||
'ext': determine_ext(final_url),
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import re
|
|||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
import zlib
|
import zlib
|
||||||
|
import xml.etree.ElementTree
|
||||||
|
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
from math import pow, sqrt, floor
|
from math import pow, sqrt, floor
|
||||||
@@ -17,6 +18,7 @@ from ..utils import (
|
|||||||
intlist_to_bytes,
|
intlist_to_bytes,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
clean_html,
|
clean_html,
|
||||||
|
urlencode_postdata,
|
||||||
)
|
)
|
||||||
from ..aes import (
|
from ..aes import (
|
||||||
aes_cbc_decrypt,
|
aes_cbc_decrypt,
|
||||||
@@ -51,6 +53,26 @@ class CrunchyrollIE(InfoExtractor):
|
|||||||
'1080': ('80', '108'),
|
'1080': ('80', '108'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _login(self):
|
||||||
|
(username, password) = self._get_login_info()
|
||||||
|
if username is None:
|
||||||
|
return
|
||||||
|
self.report_login()
|
||||||
|
login_url = 'https://www.crunchyroll.com/?a=formhandler'
|
||||||
|
data = urlencode_postdata({
|
||||||
|
'formname': 'RpcApiUser_Login',
|
||||||
|
'name': username,
|
||||||
|
'password': password,
|
||||||
|
})
|
||||||
|
login_request = compat_urllib_request.Request(login_url, data)
|
||||||
|
login_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
|
self._download_webpage(login_request, None, False, 'Wrong login info')
|
||||||
|
|
||||||
|
|
||||||
|
def _real_initialize(self):
|
||||||
|
self._login()
|
||||||
|
|
||||||
|
|
||||||
def _decrypt_subtitles(self, data, iv, id):
|
def _decrypt_subtitles(self, data, iv, id):
|
||||||
data = bytes_to_intlist(data)
|
data = bytes_to_intlist(data)
|
||||||
iv = bytes_to_intlist(iv)
|
iv = bytes_to_intlist(iv)
|
||||||
@@ -97,6 +119,75 @@ class CrunchyrollIE(InfoExtractor):
|
|||||||
output += '%d\n%s --> %s\n%s\n\n' % (i, start, end, text)
|
output += '%d\n%s --> %s\n%s\n\n' % (i, start, end, text)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
def _convert_subtitles_to_ass(self, subtitles):
|
||||||
|
output = ''
|
||||||
|
|
||||||
|
def ass_bool(strvalue):
|
||||||
|
assvalue = '0'
|
||||||
|
if strvalue == '1':
|
||||||
|
assvalue = '-1'
|
||||||
|
return assvalue
|
||||||
|
|
||||||
|
sub_root = xml.etree.ElementTree.fromstring(subtitles)
|
||||||
|
if not sub_root:
|
||||||
|
return output
|
||||||
|
|
||||||
|
output = '[Script Info]\n'
|
||||||
|
output += 'Title: %s\n' % sub_root.attrib["title"]
|
||||||
|
output += 'ScriptType: v4.00+\n'
|
||||||
|
output += 'WrapStyle: %s\n' % sub_root.attrib["wrap_style"]
|
||||||
|
output += 'PlayResX: %s\n' % sub_root.attrib["play_res_x"]
|
||||||
|
output += 'PlayResY: %s\n' % sub_root.attrib["play_res_y"]
|
||||||
|
output += """ScaledBorderAndShadow: yes
|
||||||
|
|
||||||
|
[V4+ Styles]
|
||||||
|
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
||||||
|
"""
|
||||||
|
for style in sub_root.findall('./styles/style'):
|
||||||
|
output += 'Style: ' + style.attrib["name"]
|
||||||
|
output += ',' + style.attrib["font_name"]
|
||||||
|
output += ',' + style.attrib["font_size"]
|
||||||
|
output += ',' + style.attrib["primary_colour"]
|
||||||
|
output += ',' + style.attrib["secondary_colour"]
|
||||||
|
output += ',' + style.attrib["outline_colour"]
|
||||||
|
output += ',' + style.attrib["back_colour"]
|
||||||
|
output += ',' + ass_bool(style.attrib["bold"])
|
||||||
|
output += ',' + ass_bool(style.attrib["italic"])
|
||||||
|
output += ',' + ass_bool(style.attrib["underline"])
|
||||||
|
output += ',' + ass_bool(style.attrib["strikeout"])
|
||||||
|
output += ',' + style.attrib["scale_x"]
|
||||||
|
output += ',' + style.attrib["scale_y"]
|
||||||
|
output += ',' + style.attrib["spacing"]
|
||||||
|
output += ',' + style.attrib["angle"]
|
||||||
|
output += ',' + style.attrib["border_style"]
|
||||||
|
output += ',' + style.attrib["outline"]
|
||||||
|
output += ',' + style.attrib["shadow"]
|
||||||
|
output += ',' + style.attrib["alignment"]
|
||||||
|
output += ',' + style.attrib["margin_l"]
|
||||||
|
output += ',' + style.attrib["margin_r"]
|
||||||
|
output += ',' + style.attrib["margin_v"]
|
||||||
|
output += ',' + style.attrib["encoding"]
|
||||||
|
output += '\n'
|
||||||
|
|
||||||
|
output += """
|
||||||
|
[Events]
|
||||||
|
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
||||||
|
"""
|
||||||
|
for event in sub_root.findall('./events/event'):
|
||||||
|
output += 'Dialogue: 0'
|
||||||
|
output += ',' + event.attrib["start"]
|
||||||
|
output += ',' + event.attrib["end"]
|
||||||
|
output += ',' + event.attrib["style"]
|
||||||
|
output += ',' + event.attrib["name"]
|
||||||
|
output += ',' + event.attrib["margin_l"]
|
||||||
|
output += ',' + event.attrib["margin_r"]
|
||||||
|
output += ',' + event.attrib["margin_v"]
|
||||||
|
output += ',' + event.attrib["effect"]
|
||||||
|
output += ',' + event.attrib["text"]
|
||||||
|
output += '\n'
|
||||||
|
|
||||||
|
return output
|
||||||
|
|
||||||
def _real_extract(self,url):
|
def _real_extract(self,url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('video_id')
|
video_id = mobj.group('video_id')
|
||||||
@@ -158,6 +249,7 @@ class CrunchyrollIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
|
sub_format = self._downloader.params.get('subtitlesformat', 'srt')
|
||||||
for sub_id, sub_name in re.findall(r'\?ssid=([0-9]+)" title="([^"]+)', webpage):
|
for sub_id, sub_name in re.findall(r'\?ssid=([0-9]+)" title="([^"]+)', webpage):
|
||||||
sub_page = self._download_webpage('http://www.crunchyroll.com/xml/?req=RpcApiSubtitle_GetXml&subtitle_script_id='+sub_id,\
|
sub_page = self._download_webpage('http://www.crunchyroll.com/xml/?req=RpcApiSubtitle_GetXml&subtitle_script_id='+sub_id,\
|
||||||
video_id, note='Downloading subtitles for '+sub_name)
|
video_id, note='Downloading subtitles for '+sub_name)
|
||||||
@@ -174,7 +266,10 @@ class CrunchyrollIE(InfoExtractor):
|
|||||||
lang_code = self._search_regex(r'lang_code=["\']([^"\']+)', subtitle, 'subtitle_lang_code', fatal=False)
|
lang_code = self._search_regex(r'lang_code=["\']([^"\']+)', subtitle, 'subtitle_lang_code', fatal=False)
|
||||||
if not lang_code:
|
if not lang_code:
|
||||||
continue
|
continue
|
||||||
subtitles[lang_code] = self._convert_subtitles_to_srt(subtitle)
|
if sub_format == 'ass':
|
||||||
|
subtitles[lang_code] = self._convert_subtitles_to_ass(subtitle)
|
||||||
|
else:
|
||||||
|
subtitles[lang_code] = self._convert_subtitles_to_srt(subtitle)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import re
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
int_or_none,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
find_xpath_attr,
|
find_xpath_attr,
|
||||||
)
|
)
|
||||||
@@ -33,6 +34,13 @@ class CSpanIE(InfoExtractor):
|
|||||||
'title': 'International Health Care Models',
|
'title': 'International Health Care Models',
|
||||||
'description': 'md5:7a985a2d595dba00af3d9c9f0783c967',
|
'description': 'md5:7a985a2d595dba00af3d9c9f0783c967',
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
'url': 'http://www.c-span.org/video/?318608-1/gm-ignition-switch-recall',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '342759',
|
||||||
|
'title': 'General Motors Ignition Switch Recall',
|
||||||
|
},
|
||||||
|
'playlist_duration_sum': 14855,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@@ -54,18 +62,29 @@ class CSpanIE(InfoExtractor):
|
|||||||
info_url = 'http://c-spanvideo.org/videoLibrary/assets/player/ajax-player.php?os=android&html5=program&id=' + video_id
|
info_url = 'http://c-spanvideo.org/videoLibrary/assets/player/ajax-player.php?os=android&html5=program&id=' + video_id
|
||||||
data = self._download_json(info_url, video_id)
|
data = self._download_json(info_url, video_id)
|
||||||
|
|
||||||
url = unescapeHTML(data['video']['files'][0]['path']['#text'])
|
doc = self._download_xml(
|
||||||
|
'http://www.c-span.org/common/services/flashXml.php?programid=' + video_id,
|
||||||
doc = self._download_xml('http://www.c-span.org/common/services/flashXml.php?programid=' + video_id,
|
|
||||||
video_id)
|
video_id)
|
||||||
|
|
||||||
def find_string(s):
|
title = find_xpath_attr(doc, './/string', 'name', 'title').text
|
||||||
return find_xpath_attr(doc, './/string', 'name', s).text
|
thumbnail = find_xpath_attr(doc, './/string', 'name', 'poster').text
|
||||||
|
|
||||||
|
files = data['video']['files']
|
||||||
|
|
||||||
|
entries = [{
|
||||||
|
'id': '%s_%d' % (video_id, partnum + 1),
|
||||||
|
'title': (
|
||||||
|
title if len(files) == 1 else
|
||||||
|
'%s part %d' % (title, partnum + 1)),
|
||||||
|
'url': unescapeHTML(f['path']['#text']),
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'duration': int_or_none(f.get('length', {}).get('#text')),
|
||||||
|
} for partnum, f in enumerate(files)]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'entries': entries,
|
||||||
|
'title': title,
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': find_string('title'),
|
|
||||||
'url': url,
|
|
||||||
'description': description,
|
|
||||||
'thumbnail': find_string('poster'),
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
import itertools
|
import itertools
|
||||||
@@ -8,13 +11,11 @@ from .subtitles import SubtitlesInfoExtractor
|
|||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
compat_str,
|
compat_str,
|
||||||
get_element_by_attribute,
|
|
||||||
get_element_by_id,
|
|
||||||
orderedSet,
|
orderedSet,
|
||||||
str_to_int,
|
str_to_int,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
unescapeHTML,
|
||||||
)
|
)
|
||||||
|
|
||||||
class DailymotionBaseInfoExtractor(InfoExtractor):
|
class DailymotionBaseInfoExtractor(InfoExtractor):
|
||||||
@@ -30,51 +31,53 @@ class DailymotionIE(DailymotionBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
"""Information Extractor for Dailymotion"""
|
"""Information Extractor for Dailymotion"""
|
||||||
|
|
||||||
_VALID_URL = r'(?i)(?:https?://)?(?:(www|touch)\.)?dailymotion\.[a-z]{2,3}/(?:(embed|#)/)?video/(?P<id>[^/?_]+)'
|
_VALID_URL = r'(?i)(?:https?://)?(?:(www|touch)\.)?dailymotion\.[a-z]{2,3}/(?:(embed|#)/)?video/(?P<id>[^/?_]+)'
|
||||||
IE_NAME = u'dailymotion'
|
IE_NAME = 'dailymotion'
|
||||||
|
|
||||||
_FORMATS = [
|
_FORMATS = [
|
||||||
(u'stream_h264_ld_url', u'ld'),
|
('stream_h264_ld_url', 'ld'),
|
||||||
(u'stream_h264_url', u'standard'),
|
('stream_h264_url', 'standard'),
|
||||||
(u'stream_h264_hq_url', u'hq'),
|
('stream_h264_hq_url', 'hq'),
|
||||||
(u'stream_h264_hd_url', u'hd'),
|
('stream_h264_hd_url', 'hd'),
|
||||||
(u'stream_h264_hd1080_url', u'hd180'),
|
('stream_h264_hd1080_url', 'hd180'),
|
||||||
]
|
]
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
u'url': u'http://www.dailymotion.com/video/x33vw9_tutoriel-de-youtubeur-dl-des-video_tech',
|
'url': 'http://www.dailymotion.com/video/x33vw9_tutoriel-de-youtubeur-dl-des-video_tech',
|
||||||
u'file': u'x33vw9.mp4',
|
'md5': '392c4b85a60a90dc4792da41ce3144eb',
|
||||||
u'md5': u'392c4b85a60a90dc4792da41ce3144eb',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': 'x33vw9',
|
||||||
u"uploader": u"Amphora Alex and Van .",
|
'ext': 'mp4',
|
||||||
u"title": u"Tutoriel de Youtubeur\"DL DES VIDEO DE YOUTUBE\""
|
'uploader': 'Amphora Alex and Van .',
|
||||||
|
'title': 'Tutoriel de Youtubeur"DL DES VIDEO DE YOUTUBE"',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
# Vevo video
|
# Vevo video
|
||||||
{
|
{
|
||||||
u'url': u'http://www.dailymotion.com/video/x149uew_katy-perry-roar-official_musi',
|
'url': 'http://www.dailymotion.com/video/x149uew_katy-perry-roar-official_musi',
|
||||||
u'file': u'USUV71301934.mp4',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'title': 'Roar (Official)',
|
||||||
u'title': u'Roar (Official)',
|
'id': 'USUV71301934',
|
||||||
u'uploader': u'Katy Perry',
|
'ext': 'mp4',
|
||||||
u'upload_date': u'20130905',
|
'uploader': 'Katy Perry',
|
||||||
|
'upload_date': '20130905',
|
||||||
},
|
},
|
||||||
u'params': {
|
'params': {
|
||||||
u'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
u'skip': u'VEVO is only available in some countries',
|
'skip': 'VEVO is only available in some countries',
|
||||||
},
|
},
|
||||||
# age-restricted video
|
# age-restricted video
|
||||||
{
|
{
|
||||||
u'url': u'http://www.dailymotion.com/video/xyh2zz_leanna-decker-cyber-girl-of-the-year-desires-nude-playboy-plus_redband',
|
'url': 'http://www.dailymotion.com/video/xyh2zz_leanna-decker-cyber-girl-of-the-year-desires-nude-playboy-plus_redband',
|
||||||
u'file': u'xyh2zz.mp4',
|
'md5': '0d667a7b9cebecc3c89ee93099c4159d',
|
||||||
u'md5': u'0d667a7b9cebecc3c89ee93099c4159d',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': 'xyh2zz',
|
||||||
u'title': 'Leanna Decker - Cyber Girl Of The Year Desires Nude [Playboy Plus]',
|
'ext': 'mp4',
|
||||||
u'uploader': 'HotWaves1012',
|
'title': 'Leanna Decker - Cyber Girl Of The Year Desires Nude [Playboy Plus]',
|
||||||
u'age_limit': 18,
|
'uploader': 'HotWaves1012',
|
||||||
|
'age_limit': 18,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -99,8 +102,8 @@ class DailymotionIE(DailymotionBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
webpage)
|
webpage)
|
||||||
if m_vevo is not None:
|
if m_vevo is not None:
|
||||||
vevo_id = m_vevo.group('id')
|
vevo_id = m_vevo.group('id')
|
||||||
self.to_screen(u'Vevo video detected: %s' % vevo_id)
|
self.to_screen('Vevo video detected: %s' % vevo_id)
|
||||||
return self.url_result(u'vevo:%s' % vevo_id, ie='Vevo')
|
return self.url_result('vevo:%s' % vevo_id, ie='Vevo')
|
||||||
|
|
||||||
age_limit = self._rta_search(webpage)
|
age_limit = self._rta_search(webpage)
|
||||||
|
|
||||||
@@ -111,7 +114,7 @@ class DailymotionIE(DailymotionBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
|
|
||||||
embed_url = 'http://www.dailymotion.com/embed/video/%s' % video_id
|
embed_url = 'http://www.dailymotion.com/embed/video/%s' % video_id
|
||||||
embed_page = self._download_webpage(embed_url, video_id,
|
embed_page = self._download_webpage(embed_url, video_id,
|
||||||
u'Downloading embed page')
|
'Downloading embed page')
|
||||||
info = self._search_regex(r'var info = ({.*?}),$', embed_page,
|
info = self._search_regex(r'var info = ({.*?}),$', embed_page,
|
||||||
'video info', flags=re.MULTILINE)
|
'video info', flags=re.MULTILINE)
|
||||||
info = json.loads(info)
|
info = json.loads(info)
|
||||||
@@ -136,7 +139,7 @@ class DailymotionIE(DailymotionBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
'height': height,
|
'height': height,
|
||||||
})
|
})
|
||||||
if not formats:
|
if not formats:
|
||||||
raise ExtractorError(u'Unable to extract video URL')
|
raise ExtractorError('Unable to extract video URL')
|
||||||
|
|
||||||
# subtitles
|
# subtitles
|
||||||
video_subtitles = self.extract_subtitles(video_id, webpage)
|
video_subtitles = self.extract_subtitles(video_id, webpage)
|
||||||
@@ -145,14 +148,14 @@ class DailymotionIE(DailymotionBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
return
|
return
|
||||||
|
|
||||||
view_count = self._search_regex(
|
view_count = self._search_regex(
|
||||||
r'video_views_count[^>]+>\s+([\d\.,]+)', webpage, u'view count', fatal=False)
|
r'video_views_count[^>]+>\s+([\d\.,]+)', webpage, 'view count', fatal=False)
|
||||||
if view_count is not None:
|
if view_count is not None:
|
||||||
view_count = str_to_int(view_count)
|
view_count = str_to_int(view_count)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'uploader': info['owner_screenname'],
|
'uploader': info['owner.screenname'],
|
||||||
'upload_date': video_upload_date,
|
'upload_date': video_upload_date,
|
||||||
'title': self._og_search_title(webpage),
|
'title': self._og_search_title(webpage),
|
||||||
'subtitles': video_subtitles,
|
'subtitles': video_subtitles,
|
||||||
@@ -167,33 +170,39 @@ class DailymotionIE(DailymotionBaseInfoExtractor, SubtitlesInfoExtractor):
|
|||||||
'https://api.dailymotion.com/video/%s/subtitles?fields=id,language,url' % video_id,
|
'https://api.dailymotion.com/video/%s/subtitles?fields=id,language,url' % video_id,
|
||||||
video_id, note=False)
|
video_id, note=False)
|
||||||
except ExtractorError as err:
|
except ExtractorError as err:
|
||||||
self._downloader.report_warning(u'unable to download video subtitles: %s' % compat_str(err))
|
self._downloader.report_warning('unable to download video subtitles: %s' % compat_str(err))
|
||||||
return {}
|
return {}
|
||||||
info = json.loads(sub_list)
|
info = json.loads(sub_list)
|
||||||
if (info['total'] > 0):
|
if (info['total'] > 0):
|
||||||
sub_lang_list = dict((l['language'], l['url']) for l in info['list'])
|
sub_lang_list = dict((l['language'], l['url']) for l in info['list'])
|
||||||
return sub_lang_list
|
return sub_lang_list
|
||||||
self._downloader.report_warning(u'video doesn\'t have subtitles')
|
self._downloader.report_warning('video doesn\'t have subtitles')
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
class DailymotionPlaylistIE(DailymotionBaseInfoExtractor):
|
class DailymotionPlaylistIE(DailymotionBaseInfoExtractor):
|
||||||
IE_NAME = u'dailymotion:playlist'
|
IE_NAME = 'dailymotion:playlist'
|
||||||
_VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/playlist/(?P<id>.+?)/'
|
_VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/playlist/(?P<id>.+?)/'
|
||||||
_MORE_PAGES_INDICATOR = r'<div class="next">.*?<a.*?href="/playlist/.+?".*?>.*?</a>.*?</div>'
|
_MORE_PAGES_INDICATOR = r'(?s)<div class="pages[^"]*">.*?<a\s+class="[^"]*?icon-arrow_right[^"]*?"'
|
||||||
_PAGE_TEMPLATE = 'https://www.dailymotion.com/playlist/%s/%s'
|
_PAGE_TEMPLATE = 'https://www.dailymotion.com/playlist/%s/%s'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'http://www.dailymotion.com/playlist/xv4bw_nqtv_sport/1#video=xl8v3q',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'SPORT',
|
||||||
|
},
|
||||||
|
'playlist_mincount': 20,
|
||||||
|
}]
|
||||||
|
|
||||||
def _extract_entries(self, id):
|
def _extract_entries(self, id):
|
||||||
video_ids = []
|
video_ids = []
|
||||||
for pagenum in itertools.count(1):
|
for pagenum in itertools.count(1):
|
||||||
request = self._build_request(self._PAGE_TEMPLATE % (id, pagenum))
|
request = self._build_request(self._PAGE_TEMPLATE % (id, pagenum))
|
||||||
webpage = self._download_webpage(request,
|
webpage = self._download_webpage(request,
|
||||||
id, u'Downloading page %s' % pagenum)
|
id, 'Downloading page %s' % pagenum)
|
||||||
|
|
||||||
playlist_el = get_element_by_attribute(u'class', u'row video_list', webpage)
|
video_ids.extend(re.findall(r'data-xid="(.+?)"', webpage))
|
||||||
video_ids.extend(re.findall(r'data-id="(.+?)"', playlist_el))
|
|
||||||
|
|
||||||
if re.search(self._MORE_PAGES_INDICATOR, webpage, re.DOTALL) is None:
|
if re.search(self._MORE_PAGES_INDICATOR, webpage) is None:
|
||||||
break
|
break
|
||||||
return [self.url_result('http://www.dailymotion.com/video/%s' % video_id, 'Dailymotion')
|
return [self.url_result('http://www.dailymotion.com/video/%s' % video_id, 'Dailymotion')
|
||||||
for video_id in orderedSet(video_ids)]
|
for video_id in orderedSet(video_ids)]
|
||||||
@@ -203,26 +212,34 @@ class DailymotionPlaylistIE(DailymotionBaseInfoExtractor):
|
|||||||
playlist_id = mobj.group('id')
|
playlist_id = mobj.group('id')
|
||||||
webpage = self._download_webpage(url, playlist_id)
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
|
|
||||||
return {'_type': 'playlist',
|
return {
|
||||||
'id': playlist_id,
|
'_type': 'playlist',
|
||||||
'title': get_element_by_id(u'playlist_name', webpage),
|
'id': playlist_id,
|
||||||
'entries': self._extract_entries(playlist_id),
|
'title': self._og_search_title(webpage),
|
||||||
}
|
'entries': self._extract_entries(playlist_id),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class DailymotionUserIE(DailymotionPlaylistIE):
|
class DailymotionUserIE(DailymotionPlaylistIE):
|
||||||
IE_NAME = u'dailymotion:user'
|
IE_NAME = 'dailymotion:user'
|
||||||
_VALID_URL = r'(?:https?://)?(?:www\.)?dailymotion\.[a-z]{2,3}/user/(?P<user>[^/]+)'
|
_VALID_URL = r'https?://(?:www\.)?dailymotion\.[a-z]{2,3}/user/(?P<user>[^/]+)'
|
||||||
_MORE_PAGES_INDICATOR = r'<div class="next">.*?<a.*?href="/user/.+?".*?>.*?</a>.*?</div>'
|
|
||||||
_PAGE_TEMPLATE = 'http://www.dailymotion.com/user/%s/%s'
|
_PAGE_TEMPLATE = 'http://www.dailymotion.com/user/%s/%s'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.dailymotion.com/user/nqtv',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'nqtv',
|
||||||
|
'title': 'Rémi Gaillard',
|
||||||
|
},
|
||||||
|
'playlist_mincount': 100,
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
user = mobj.group('user')
|
user = mobj.group('user')
|
||||||
webpage = self._download_webpage(url, user)
|
webpage = self._download_webpage(url, user)
|
||||||
full_user = self._html_search_regex(
|
full_user = unescapeHTML(self._html_search_regex(
|
||||||
r'<a class="label" href="/%s".*?>(.*?)</' % re.escape(user),
|
r'<a class="nav-image" title="([^"]+)" href="/%s">' % re.escape(user),
|
||||||
webpage, u'user', flags=re.DOTALL)
|
webpage, 'user'))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'playlist',
|
'_type': 'playlist',
|
||||||
|
|||||||
44
youtube_dl/extractor/dfb.py
Normal file
44
youtube_dl/extractor/dfb.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class DFBIE(InfoExtractor):
|
||||||
|
IE_NAME = 'tv.dfb.de'
|
||||||
|
_VALID_URL = r'https?://tv\.dfb\.de/video/[^/]+/(?P<id>\d+)'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://tv.dfb.de/video/highlights-des-empfangs-in-berlin/9070/',
|
||||||
|
# The md5 is different each time
|
||||||
|
'info_dict': {
|
||||||
|
'id': '9070',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Highlights des Empfangs in Berlin',
|
||||||
|
'upload_date': '20140716',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
player_info = self._download_xml(
|
||||||
|
'http://tv.dfb.de/server/hd_video.php?play=%s' % video_id,
|
||||||
|
video_id)
|
||||||
|
video_info = player_info.find('video')
|
||||||
|
|
||||||
|
f4m_info = self._download_xml(self._proto_relative_url(video_info.find('url').text.strip()), video_id)
|
||||||
|
token_el = f4m_info.find('token')
|
||||||
|
manifest_url = token_el.attrib['url'] + '?' + 'hdnea=' + token_el.attrib['auth'] + '&hdcore=3.2.0'
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': video_info.find('title').text,
|
||||||
|
'url': manifest_url,
|
||||||
|
'ext': 'flv',
|
||||||
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
|
'upload_date': ''.join(video_info.find('time_date').text.split('.')[::-1]),
|
||||||
|
}
|
||||||
@@ -7,9 +7,9 @@ from .common import InfoExtractor
|
|||||||
|
|
||||||
|
|
||||||
class DiscoveryIE(InfoExtractor):
|
class DiscoveryIE(InfoExtractor):
|
||||||
_VALID_URL = r'http://dsc\.discovery\.com\/[a-zA-Z0-9\-]*/[a-zA-Z0-9\-]*/videos/(?P<id>[a-zA-Z0-9\-]*)(.htm)?'
|
_VALID_URL = r'http://www\.discovery\.com\/[a-zA-Z0-9\-]*/[a-zA-Z0-9\-]*/videos/(?P<id>[a-zA-Z0-9\-]*)(.htm)?'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://dsc.discovery.com/tv-shows/mythbusters/videos/mission-impossible-outtakes.htm',
|
'url': 'http://www.discovery.com/tv-shows/mythbusters/videos/mission-impossible-outtakes.htm',
|
||||||
'md5': 'e12614f9ee303a6ccef415cb0793eba2',
|
'md5': 'e12614f9ee303a6ccef415cb0793eba2',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '614784',
|
'id': '614784',
|
||||||
|
|||||||
27
youtube_dl/extractor/divxstage.py
Normal file
27
youtube_dl/extractor/divxstage.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .novamov import NovaMovIE
|
||||||
|
|
||||||
|
|
||||||
|
class DivxStageIE(NovaMovIE):
|
||||||
|
IE_NAME = 'divxstage'
|
||||||
|
IE_DESC = 'DivxStage'
|
||||||
|
|
||||||
|
_VALID_URL = NovaMovIE._VALID_URL_TEMPLATE % {'host': 'divxstage\.(?:eu|net|ch|co|at|ag)'}
|
||||||
|
|
||||||
|
_HOST = 'www.divxstage.eu'
|
||||||
|
|
||||||
|
_FILE_DELETED_REGEX = r'>This file no longer exists on our servers.<'
|
||||||
|
_TITLE_REGEX = r'<div class="video_det">\s*<strong>([^<]+)</strong>'
|
||||||
|
_DESCRIPTION_REGEX = r'<div class="video_det">\s*<strong>[^<]+</strong>\s*<p>([^<]+)</p>'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.divxstage.eu/video/57f238e2e5e01',
|
||||||
|
'md5': '63969f6eb26533a1968c4d325be63e72',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '57f238e2e5e01',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'youtubedl test video',
|
||||||
|
'description': 'This is a test video for youtubedl.',
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,39 +1,37 @@
|
|||||||
# coding: utf-8
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import unified_strdate
|
||||||
unified_strdate,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DreiSatIE(InfoExtractor):
|
class DreiSatIE(InfoExtractor):
|
||||||
IE_NAME = '3sat'
|
IE_NAME = '3sat'
|
||||||
_VALID_URL = r'(?:http://)?(?:www\.)?3sat\.de/mediathek/(?:index\.php)?\?(?:(?:mode|display)=[^&]+&)*obj=(?P<id>[0-9]+)$'
|
_VALID_URL = r'(?:http://)?(?:www\.)?3sat\.de/mediathek/(?:index\.php)?\?(?:(?:mode|display)=[^&]+&)*obj=(?P<id>[0-9]+)$'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"url": u"http://www.3sat.de/mediathek/index.php?obj=36983",
|
'url': 'http://www.3sat.de/mediathek/index.php?obj=36983',
|
||||||
u'file': u'36983.mp4',
|
'md5': '9dcfe344732808dbfcc901537973c922',
|
||||||
u'md5': u'9dcfe344732808dbfcc901537973c922',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '36983',
|
||||||
u"title": u"Kaffeeland Schweiz",
|
'ext': 'mp4',
|
||||||
u"description": u"Über 80 Kaffeeröstereien liefern in der Schweiz das Getränk, in das das Land so vernarrt ist: Mehr als 1000 Tassen trinkt ein Schweizer pro Jahr. SCHWEIZWEIT nimmt die Kaffeekultur unter die...",
|
'title': 'Kaffeeland Schweiz',
|
||||||
u"uploader": u"3sat",
|
'description': 'md5:cc4424b18b75ae9948b13929a0814033',
|
||||||
u"upload_date": u"20130622"
|
'uploader': '3sat',
|
||||||
|
'upload_date': '20130622'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
details_url = 'http://www.3sat.de/mediathek/xmlservice/web/beitragsDetails?ak=web&id=%s' % video_id
|
details_url = 'http://www.3sat.de/mediathek/xmlservice/web/beitragsDetails?ak=web&id=%s' % video_id
|
||||||
details_doc = self._download_xml(details_url, video_id, note=u'Downloading video details')
|
details_doc = self._download_xml(details_url, video_id, 'Downloading video details')
|
||||||
|
|
||||||
thumbnail_els = details_doc.findall('.//teaserimage')
|
thumbnail_els = details_doc.findall('.//teaserimage')
|
||||||
thumbnails = [{
|
thumbnails = [{
|
||||||
'width': te.attrib['key'].partition('x')[0],
|
'width': int(te.attrib['key'].partition('x')[0]),
|
||||||
'height': te.attrib['key'].partition('x')[2],
|
'height': int(te.attrib['key'].partition('x')[2]),
|
||||||
'url': te.text,
|
'url': te.text,
|
||||||
} for te in thumbnail_els]
|
} for te in thumbnail_els]
|
||||||
|
|
||||||
|
|||||||
@@ -5,25 +5,28 @@ import os.path
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import compat_urllib_parse_unquote
|
||||||
|
|
||||||
|
|
||||||
class DropboxIE(InfoExtractor):
|
class DropboxIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?dropbox[.]com/s/(?P<id>[a-zA-Z0-9]{15})/(?P<title>[^?#]*)'
|
_VALID_URL = r'https?://(?:www\.)?dropbox[.]com/s/(?P<id>[a-zA-Z0-9]{15})/(?P<title>[^?#]*)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'https://www.dropbox.com/s/0qr9sai2veej4f8/THE_DOCTOR_GAMES.mp4',
|
'url': 'https://www.dropbox.com/s/nelirfsxnmcfbfh/youtube-dl%20test%20video%20%27%C3%A4%22BaW_jenozKc.mp4?dl=0',
|
||||||
'md5': '8ae17c51172fb7f93bdd6a214cc8c896',
|
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '0qr9sai2veej4f8',
|
'id': 'nelirfsxnmcfbfh',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'THE_DOCTOR_GAMES'
|
'title': 'youtube-dl test video \'ä"BaW_jenozKc'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
title = os.path.splitext(mobj.group('title'))[0]
|
fn = compat_urllib_parse_unquote(mobj.group('title'))
|
||||||
video_url = url + '?dl=1'
|
title = os.path.splitext(fn)[0]
|
||||||
|
video_url = (
|
||||||
|
re.sub(r'[?&]dl=0', '', url) +
|
||||||
|
('?' if '?' in url else '&') + 'dl=1')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|||||||
50
youtube_dl/extractor/drtuber.py
Normal file
50
youtube_dl/extractor/drtuber.py
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class DrTuberIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?drtuber\.com/video/(?P<id>\d+)/(?P<title_dash>[\w-]+)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.drtuber.com/video/1740434/hot-perky-blonde-naked-golf',
|
||||||
|
'md5': '93e680cf2536ad0dfb7e74d94a89facd',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1740434',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Hot Perky Blonde Naked Golf',
|
||||||
|
'categories': list, # NSFW
|
||||||
|
'thumbnail': 're:https?://.*\.jpg$',
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
video_url = self._html_search_regex(
|
||||||
|
r'<source src="([^"]+)"', webpage, 'video URL')
|
||||||
|
|
||||||
|
title = self._html_search_regex(
|
||||||
|
r'<title>([^<]+)\s*-\s*Free', webpage, 'title')
|
||||||
|
|
||||||
|
thumbnail = self._html_search_regex(
|
||||||
|
r'poster="([^"]+)"',
|
||||||
|
webpage, 'thumbnail', fatal=False)
|
||||||
|
|
||||||
|
cats_str = self._html_search_regex(
|
||||||
|
r'<meta name="keywords" content="([^"]+)"', webpage, 'categories', fatal=False)
|
||||||
|
categories = None if cats_str is None else cats_str.split(' ')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
|
'title': title,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'categories': categories,
|
||||||
|
'age_limit': self._rta_search(webpage),
|
||||||
|
}
|
||||||
91
youtube_dl/extractor/drtv.py
Normal file
91
youtube_dl/extractor/drtv.py
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .subtitles import SubtitlesInfoExtractor
|
||||||
|
from .common import ExtractorError
|
||||||
|
from ..utils import parse_iso8601
|
||||||
|
|
||||||
|
|
||||||
|
class DRTVIE(SubtitlesInfoExtractor):
|
||||||
|
_VALID_URL = r'http://(?:www\.)?dr\.dk/tv/se/[^/]+/(?P<id>[\da-z-]+)'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.dr.dk/tv/se/partiets-mand/partiets-mand-7-8',
|
||||||
|
'md5': '4a7e1dd65cdb2643500a3f753c942f25',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'partiets-mand-7-8',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Partiets mand (7:8)',
|
||||||
|
'description': 'md5:a684b90a8f9336cd4aab94b7647d7862',
|
||||||
|
'timestamp': 1403047940,
|
||||||
|
'upload_date': '20140617',
|
||||||
|
'duration': 1299.040,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
programcard = self._download_json(
|
||||||
|
'http://www.dr.dk/mu/programcard/expanded/%s' % video_id, video_id, 'Downloading video JSON')
|
||||||
|
|
||||||
|
data = programcard['Data'][0]
|
||||||
|
|
||||||
|
title = data['Title']
|
||||||
|
description = data['Description']
|
||||||
|
timestamp = parse_iso8601(data['CreatedTime'][:-5])
|
||||||
|
|
||||||
|
thumbnail = None
|
||||||
|
duration = None
|
||||||
|
|
||||||
|
restricted_to_denmark = False
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
subtitles = {}
|
||||||
|
|
||||||
|
for asset in data['Assets']:
|
||||||
|
if asset['Kind'] == 'Image':
|
||||||
|
thumbnail = asset['Uri']
|
||||||
|
elif asset['Kind'] == 'VideoResource':
|
||||||
|
duration = asset['DurationInMilliseconds'] / 1000.0
|
||||||
|
restricted_to_denmark = asset['RestrictedToDenmark']
|
||||||
|
for link in asset['Links']:
|
||||||
|
target = link['Target']
|
||||||
|
uri = link['Uri']
|
||||||
|
formats.append({
|
||||||
|
'url': uri + '?hdcore=3.3.0&plugin=aasp-3.3.0.99.43' if target == 'HDS' else uri,
|
||||||
|
'format_id': target,
|
||||||
|
'ext': link['FileFormat'],
|
||||||
|
'preference': -1 if target == 'HDS' else -2,
|
||||||
|
})
|
||||||
|
subtitles_list = asset.get('SubtitlesList')
|
||||||
|
if isinstance(subtitles_list, list):
|
||||||
|
LANGS = {
|
||||||
|
'Danish': 'dk',
|
||||||
|
}
|
||||||
|
for subs in subtitles_list:
|
||||||
|
lang = subs['Language']
|
||||||
|
subtitles[LANGS.get(lang, lang)] = subs['Uri']
|
||||||
|
|
||||||
|
if not formats and restricted_to_denmark:
|
||||||
|
raise ExtractorError(
|
||||||
|
'Unfortunately, DR is not allowed to show this program outside Denmark.', expected=True)
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
if self._downloader.params.get('listsubtitles', False):
|
||||||
|
self._list_available_subtitles(video_id, subtitles)
|
||||||
|
return
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'timestamp': timestamp,
|
||||||
|
'duration': duration,
|
||||||
|
'formats': formats,
|
||||||
|
'subtitles': self.extract_subtitles(video_id, subtitles),
|
||||||
|
}
|
||||||
39
youtube_dl/extractor/dump.py
Normal file
39
youtube_dl/extractor/dump.py
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class DumpIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'^https?://(?:www\.)?dump\.com/(?P<id>[a-zA-Z0-9]+)/'
|
||||||
|
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.dump.com/oneus/',
|
||||||
|
'md5': 'ad71704d1e67dfd9e81e3e8b42d69d99',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'oneus',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': "He's one of us.",
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
m = re.match(self._VALID_URL, url)
|
||||||
|
video_id = m.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
video_url = self._search_regex(
|
||||||
|
r's1.addVariable\("file",\s*"([^"]+)"', webpage, 'video URL')
|
||||||
|
|
||||||
|
thumb = self._og_search_thumbnail(webpage)
|
||||||
|
title = self._search_regex(r'<b>([^"]+)</b>', webpage, 'title')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'url': video_url,
|
||||||
|
'thumbnail': thumb,
|
||||||
|
}
|
||||||
@@ -1,19 +1,21 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import determine_ext
|
|
||||||
|
|
||||||
|
|
||||||
class EbaumsWorldIE(InfoExtractor):
|
class EbaumsWorldIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://www\.ebaumsworld\.com/video/watch/(?P<id>\d+)'
|
_VALID_URL = r'https?://www\.ebaumsworld\.com/video/watch/(?P<id>\d+)'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u'url': u'http://www.ebaumsworld.com/video/watch/83367677/',
|
'url': 'http://www.ebaumsworld.com/video/watch/83367677/',
|
||||||
u'file': u'83367677.mp4',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '83367677',
|
||||||
u'title': u'A Giant Python Opens The Door',
|
'ext': 'mp4',
|
||||||
u'description': u'This is how nightmares start...',
|
'title': 'A Giant Python Opens The Door',
|
||||||
u'uploader': u'jihadpizza',
|
'description': 'This is how nightmares start...',
|
||||||
|
'uploader': 'jihadpizza',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +30,6 @@ class EbaumsWorldIE(InfoExtractor):
|
|||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': config.find('title').text,
|
'title': config.find('title').text,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': determine_ext(video_url),
|
|
||||||
'description': config.find('description').text,
|
'description': config.find('description').text,
|
||||||
'thumbnail': config.find('image').text,
|
'thumbnail': config.find('image').text,
|
||||||
'uploader': config.find('username').text,
|
'uploader': config.find('username').text,
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
compat_str,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -12,86 +15,98 @@ class EightTracksIE(InfoExtractor):
|
|||||||
IE_NAME = '8tracks'
|
IE_NAME = '8tracks'
|
||||||
_VALID_URL = r'https?://8tracks\.com/(?P<user>[^/]+)/(?P<id>[^/#]+)(?:#.*)?$'
|
_VALID_URL = r'https?://8tracks\.com/(?P<user>[^/]+)/(?P<id>[^/#]+)(?:#.*)?$'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
u"name": u"EightTracks",
|
"name": "EightTracks",
|
||||||
u"url": u"http://8tracks.com/ytdl/youtube-dl-test-tracks-a",
|
"url": "http://8tracks.com/ytdl/youtube-dl-test-tracks-a",
|
||||||
u"playlist": [
|
"info_dict": {
|
||||||
|
'id': '1336550',
|
||||||
|
'display_id': 'youtube-dl-test-tracks-a',
|
||||||
|
"description": "test chars: \"'/\\ä↭",
|
||||||
|
"title": "youtube-dl test tracks \"'/\\ä↭<>",
|
||||||
|
},
|
||||||
|
"playlist": [
|
||||||
{
|
{
|
||||||
u"file": u"11885610.m4a",
|
"md5": "96ce57f24389fc8734ce47f4c1abcc55",
|
||||||
u"md5": u"96ce57f24389fc8734ce47f4c1abcc55",
|
"info_dict": {
|
||||||
u"info_dict": {
|
"id": "11885610",
|
||||||
u"title": u"youtue-dl project<>\"' - youtube-dl test track 1 \"'/\\\u00e4\u21ad",
|
"ext": "m4a",
|
||||||
u"uploader_id": u"ytdl"
|
"title": "youtue-dl project<>\"' - youtube-dl test track 1 \"'/\\\u00e4\u21ad",
|
||||||
|
"uploader_id": "ytdl"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u"file": u"11885608.m4a",
|
"md5": "4ab26f05c1f7291ea460a3920be8021f",
|
||||||
u"md5": u"4ab26f05c1f7291ea460a3920be8021f",
|
"info_dict": {
|
||||||
u"info_dict": {
|
"id": "11885608",
|
||||||
u"title": u"youtube-dl project - youtube-dl test track 2 \"'/\\\u00e4\u21ad",
|
"ext": "m4a",
|
||||||
u"uploader_id": u"ytdl"
|
"title": "youtube-dl project - youtube-dl test track 2 \"'/\\\u00e4\u21ad",
|
||||||
|
"uploader_id": "ytdl"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u"file": u"11885679.m4a",
|
"md5": "d30b5b5f74217410f4689605c35d1fd7",
|
||||||
u"md5": u"d30b5b5f74217410f4689605c35d1fd7",
|
"info_dict": {
|
||||||
u"info_dict": {
|
"id": "11885679",
|
||||||
u"title": u"youtube-dl project as well - youtube-dl test track 3 \"'/\\\u00e4\u21ad",
|
"ext": "m4a",
|
||||||
u"uploader_id": u"ytdl"
|
"title": "youtube-dl project as well - youtube-dl test track 3 \"'/\\\u00e4\u21ad",
|
||||||
|
"uploader_id": "ytdl"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u"file": u"11885680.m4a",
|
"md5": "4eb0a669317cd725f6bbd336a29f923a",
|
||||||
u"md5": u"4eb0a669317cd725f6bbd336a29f923a",
|
"info_dict": {
|
||||||
u"info_dict": {
|
"id": "11885680",
|
||||||
u"title": u"youtube-dl project as well - youtube-dl test track 4 \"'/\\\u00e4\u21ad",
|
"ext": "m4a",
|
||||||
u"uploader_id": u"ytdl"
|
"title": "youtube-dl project as well - youtube-dl test track 4 \"'/\\\u00e4\u21ad",
|
||||||
|
"uploader_id": "ytdl"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u"file": u"11885682.m4a",
|
"md5": "1893e872e263a2705558d1d319ad19e8",
|
||||||
u"md5": u"1893e872e263a2705558d1d319ad19e8",
|
"info_dict": {
|
||||||
u"info_dict": {
|
"id": "11885682",
|
||||||
u"title": u"PH - youtube-dl test track 5 \"'/\\\u00e4\u21ad",
|
"ext": "m4a",
|
||||||
u"uploader_id": u"ytdl"
|
"title": "PH - youtube-dl test track 5 \"'/\\\u00e4\u21ad",
|
||||||
|
"uploader_id": "ytdl"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u"file": u"11885683.m4a",
|
"md5": "b673c46f47a216ab1741ae8836af5899",
|
||||||
u"md5": u"b673c46f47a216ab1741ae8836af5899",
|
"info_dict": {
|
||||||
u"info_dict": {
|
"id": "11885683",
|
||||||
u"title": u"PH - youtube-dl test track 6 \"'/\\\u00e4\u21ad",
|
"ext": "m4a",
|
||||||
u"uploader_id": u"ytdl"
|
"title": "PH - youtube-dl test track 6 \"'/\\\u00e4\u21ad",
|
||||||
|
"uploader_id": "ytdl"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u"file": u"11885684.m4a",
|
"md5": "1d74534e95df54986da7f5abf7d842b7",
|
||||||
u"md5": u"1d74534e95df54986da7f5abf7d842b7",
|
"info_dict": {
|
||||||
u"info_dict": {
|
"id": "11885684",
|
||||||
u"title": u"phihag - youtube-dl test track 7 \"'/\\\u00e4\u21ad",
|
"ext": "m4a",
|
||||||
u"uploader_id": u"ytdl"
|
"title": "phihag - youtube-dl test track 7 \"'/\\\u00e4\u21ad",
|
||||||
|
"uploader_id": "ytdl"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u"file": u"11885685.m4a",
|
"md5": "f081f47af8f6ae782ed131d38b9cd1c0",
|
||||||
u"md5": u"f081f47af8f6ae782ed131d38b9cd1c0",
|
"info_dict": {
|
||||||
u"info_dict": {
|
"id": "11885685",
|
||||||
u"title": u"phihag - youtube-dl test track 8 \"'/\\\u00e4\u21ad",
|
"ext": "m4a",
|
||||||
u"uploader_id": u"ytdl"
|
"title": "phihag - youtube-dl test track 8 \"'/\\\u00e4\u21ad",
|
||||||
|
"uploader_id": "ytdl"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
if mobj is None:
|
|
||||||
raise ExtractorError(u'Invalid URL: %s' % url)
|
|
||||||
playlist_id = mobj.group('id')
|
playlist_id = mobj.group('id')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, playlist_id)
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
|
|
||||||
json_like = self._search_regex(r"PAGE.mix = (.*?);\n", webpage, u'trax information', flags=re.DOTALL)
|
json_like = self._search_regex(
|
||||||
|
r"(?s)PAGE.mix = (.*?);\n", webpage, 'trax information')
|
||||||
data = json.loads(json_like)
|
data = json.loads(json_like)
|
||||||
|
|
||||||
session = str(random.randint(0, 1000000000))
|
session = str(random.randint(0, 1000000000))
|
||||||
@@ -99,21 +114,30 @@ class EightTracksIE(InfoExtractor):
|
|||||||
track_count = data['tracks_count']
|
track_count = data['tracks_count']
|
||||||
first_url = 'http://8tracks.com/sets/%s/play?player=sm&mix_id=%s&format=jsonh' % (session, mix_id)
|
first_url = 'http://8tracks.com/sets/%s/play?player=sm&mix_id=%s&format=jsonh' % (session, mix_id)
|
||||||
next_url = first_url
|
next_url = first_url
|
||||||
res = []
|
entries = []
|
||||||
for i in range(track_count):
|
for i in range(track_count):
|
||||||
api_json = self._download_webpage(next_url, playlist_id,
|
api_json = self._download_webpage(
|
||||||
note=u'Downloading song information %s/%s' % (str(i+1), track_count),
|
next_url, playlist_id,
|
||||||
errnote=u'Failed to download song information')
|
note='Downloading song information %d/%d' % (i + 1, track_count),
|
||||||
|
errnote='Failed to download song information')
|
||||||
api_data = json.loads(api_json)
|
api_data = json.loads(api_json)
|
||||||
track_data = api_data[u'set']['track']
|
track_data = api_data['set']['track']
|
||||||
info = {
|
info = {
|
||||||
'id': track_data['id'],
|
'id': compat_str(track_data['id']),
|
||||||
'url': track_data['track_file_stream_url'],
|
'url': track_data['track_file_stream_url'],
|
||||||
'title': track_data['performer'] + u' - ' + track_data['name'],
|
'title': track_data['performer'] + u' - ' + track_data['name'],
|
||||||
'raw_title': track_data['name'],
|
'raw_title': track_data['name'],
|
||||||
'uploader_id': data['user']['login'],
|
'uploader_id': data['user']['login'],
|
||||||
'ext': 'm4a',
|
'ext': 'm4a',
|
||||||
}
|
}
|
||||||
res.append(info)
|
entries.append(info)
|
||||||
next_url = 'http://8tracks.com/sets/%s/next?player=sm&mix_id=%s&format=jsonh&track_id=%s' % (session, mix_id, track_data['id'])
|
next_url = 'http://8tracks.com/sets/%s/next?player=sm&mix_id=%s&format=jsonh&track_id=%s' % (
|
||||||
return res
|
session, mix_id, track_data['id'])
|
||||||
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'entries': entries,
|
||||||
|
'id': compat_str(mix_id),
|
||||||
|
'display_id': playlist_id,
|
||||||
|
'title': data.get('name'),
|
||||||
|
'description': data.get('description'),
|
||||||
|
}
|
||||||
|
|||||||
79
youtube_dl/extractor/ellentv.py
Normal file
79
youtube_dl/extractor/ellentv.py
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
parse_iso8601,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class EllenTVIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?ellentv\.com/videos/(?P<id>[a-z0-9_-]+)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.ellentv.com/videos/0-7jqrsr18/',
|
||||||
|
'md5': 'e4af06f3bf0d5f471921a18db5764642',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '0-7jqrsr18',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'What\'s Wrong with These Photos? A Whole Lot',
|
||||||
|
'timestamp': 1406876400,
|
||||||
|
'upload_date': '20140801',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
timestamp = parse_iso8601(self._search_regex(
|
||||||
|
r'<span class="publish-date"><time datetime="([^"]+)">',
|
||||||
|
webpage, 'timestamp'))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': self._og_search_title(webpage),
|
||||||
|
'url': self._html_search_meta('VideoURL', webpage, 'url'),
|
||||||
|
'timestamp': timestamp,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class EllenTVClipsIE(InfoExtractor):
|
||||||
|
IE_NAME = 'EllenTV:clips'
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?ellentv\.com/episodes/(?P<id>[a-z0-9_-]+)'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.ellentv.com/episodes/meryl-streep-vanessa-hudgens/',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'meryl-streep-vanessa-hudgens',
|
||||||
|
'title': 'Meryl Streep, Vanessa Hudgens',
|
||||||
|
},
|
||||||
|
'playlist_mincount': 9,
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
playlist_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
|
playlist = self._extract_playlist(webpage)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'id': playlist_id,
|
||||||
|
'title': self._og_search_title(webpage),
|
||||||
|
'entries': self._extract_entries(playlist)
|
||||||
|
}
|
||||||
|
|
||||||
|
def _extract_playlist(self, webpage):
|
||||||
|
json_string = self._search_regex(r'playerView.addClips\(\[\{(.*?)\}\]\);', webpage, 'json')
|
||||||
|
try:
|
||||||
|
return json.loads("[{" + json_string + "}]")
|
||||||
|
except ValueError as ve:
|
||||||
|
raise ExtractorError('Failed to download JSON', cause=ve)
|
||||||
|
|
||||||
|
def _extract_entries(self, playlist):
|
||||||
|
return [self.url_result(item['url'], 'EllenTV') for item in playlist]
|
||||||
58
youtube_dl/extractor/empflix.py
Normal file
58
youtube_dl/extractor/empflix.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import fix_xml_ampersands
|
||||||
|
|
||||||
|
|
||||||
|
class EmpflixIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'^https?://www\.empflix\.com/videos/.*?-(?P<id>[0-9]+)\.html'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.empflix.com/videos/Amateur-Finger-Fuck-33051.html',
|
||||||
|
'md5': 'b1bc15b6412d33902d6e5952035fcabc',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '33051',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Amateur Finger Fuck',
|
||||||
|
'description': 'Amateur solo finger fucking.',
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
age_limit = self._rta_search(webpage)
|
||||||
|
|
||||||
|
video_title = self._html_search_regex(
|
||||||
|
r'name="title" value="(?P<title>[^"]*)"', webpage, 'title')
|
||||||
|
video_description = self._html_search_regex(
|
||||||
|
r'name="description" value="([^"]*)"', webpage, 'description', fatal=False)
|
||||||
|
|
||||||
|
cfg_url = self._html_search_regex(
|
||||||
|
r'flashvars\.config = escape\("([^"]+)"',
|
||||||
|
webpage, 'flashvars.config')
|
||||||
|
|
||||||
|
cfg_xml = self._download_xml(
|
||||||
|
cfg_url, video_id, note='Downloading metadata',
|
||||||
|
transform_source=fix_xml_ampersands)
|
||||||
|
|
||||||
|
formats = [
|
||||||
|
{
|
||||||
|
'url': item.find('videoLink').text,
|
||||||
|
'format_id': item.find('res').text,
|
||||||
|
} for item in cfg_xml.findall('./quality/item')
|
||||||
|
]
|
||||||
|
thumbnail = cfg_xml.find('./startThumb').text
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': video_title,
|
||||||
|
'description': video_description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'formats': formats,
|
||||||
|
'age_limit': age_limit,
|
||||||
|
}
|
||||||
58
youtube_dl/extractor/eporner.py
Normal file
58
youtube_dl/extractor/eporner.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
parse_duration,
|
||||||
|
str_to_int,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class EpornerIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?eporner\.com/hd-porn/(?P<id>\d+)/(?P<title_dash>[\w-]+)/?'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.eporner.com/hd-porn/95008/Infamous-Tiffany-Teen-Strip-Tease-Video/',
|
||||||
|
'md5': '3b427ae4b9d60619106de3185c2987cd',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '95008',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Infamous Tiffany Teen Strip Tease Video',
|
||||||
|
'duration': 194,
|
||||||
|
'view_count': int,
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
title = self._html_search_regex(
|
||||||
|
r'<title>(.*?) - EPORNER', webpage, 'title')
|
||||||
|
|
||||||
|
redirect_code = self._html_search_regex(
|
||||||
|
r'<script type="text/javascript" src="/config5/%s/([a-f\d]+)/">' % video_id,
|
||||||
|
webpage, 'redirect_code')
|
||||||
|
redirect_url = 'http://www.eporner.com/config5/%s/%s' % (video_id, redirect_code)
|
||||||
|
player_code = self._download_webpage(
|
||||||
|
redirect_url, video_id, note='Downloading player config')
|
||||||
|
video_url = self._html_search_regex(
|
||||||
|
r'file: "(.*?)",', player_code, 'video_url')
|
||||||
|
|
||||||
|
duration = parse_duration(self._search_regex(
|
||||||
|
r'class="mbtim">([0-9:]+)</div>', webpage, 'duration',
|
||||||
|
fatal=False))
|
||||||
|
view_count = str_to_int(self._search_regex(
|
||||||
|
r'id="cinemaviews">\s*([0-9,]+)\s*<small>views',
|
||||||
|
webpage, 'view count', fatal=False))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url': video_url,
|
||||||
|
'title': title,
|
||||||
|
'duration': duration,
|
||||||
|
'view_count': view_count,
|
||||||
|
'age_limit': self._rta_search(webpage),
|
||||||
|
}
|
||||||
@@ -36,7 +36,7 @@ class EscapistIE(InfoExtractor):
|
|||||||
r'<meta name="description" content="([^"]*)"',
|
r'<meta name="description" content="([^"]*)"',
|
||||||
webpage, 'description', fatal=False)
|
webpage, 'description', fatal=False)
|
||||||
|
|
||||||
playerUrl = self._og_search_video_url(webpage, name=u'player URL')
|
playerUrl = self._og_search_video_url(webpage, name='player URL')
|
||||||
|
|
||||||
title = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'<meta name="title" content="([^"]*)"',
|
r'<meta name="title" content="([^"]*)"',
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ from ..utils import (
|
|||||||
class EveryonesMixtapeIE(InfoExtractor):
|
class EveryonesMixtapeIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?everyonesmixtape\.com/#/mix/(?P<id>[0-9a-zA-Z]+)(?:/(?P<songnr>[0-9]))?$'
|
_VALID_URL = r'https?://(?:www\.)?everyonesmixtape\.com/#/mix/(?P<id>[0-9a-zA-Z]+)(?:/(?P<songnr>[0-9]))?$'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://everyonesmixtape.com/#/mix/m7m0jJAbMQi/5',
|
'url': 'http://everyonesmixtape.com/#/mix/m7m0jJAbMQi/5',
|
||||||
'file': '5bfseWNmlds.mp4',
|
|
||||||
"info_dict": {
|
"info_dict": {
|
||||||
|
'id': '5bfseWNmlds',
|
||||||
|
'ext': 'mp4',
|
||||||
"title": "Passion Pit - \"Sleepyhead\" (Official Music Video)",
|
"title": "Passion Pit - \"Sleepyhead\" (Official Music Video)",
|
||||||
"uploader": "FKR.TV",
|
"uploader": "FKR.TV",
|
||||||
"uploader_id": "frenchkissrecords",
|
"uploader_id": "frenchkissrecords",
|
||||||
@@ -25,7 +26,14 @@ class EveryonesMixtapeIE(InfoExtractor):
|
|||||||
'params': {
|
'params': {
|
||||||
'skip_download': True, # This is simply YouTube
|
'skip_download': True, # This is simply YouTube
|
||||||
}
|
}
|
||||||
}
|
}, {
|
||||||
|
'url': 'http://everyonesmixtape.com/#/mix/m7m0jJAbMQi',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'm7m0jJAbMQi',
|
||||||
|
'title': 'Driving',
|
||||||
|
},
|
||||||
|
'playlist_count': 24
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
|||||||
73
youtube_dl/extractor/expotv.py
Normal file
73
youtube_dl/extractor/expotv.py
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
int_or_none,
|
||||||
|
unified_strdate,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ExpoTVIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://www\.expotv\.com/videos/[^?#]*/(?P<id>[0-9]+)($|[?#])'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://www.expotv.com/videos/reviews/1/24/LinneCardscom/17561',
|
||||||
|
'md5': '2985e6d7a392b2f7a05e0ca350fe41d0',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '17561',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'upload_date': '20060212',
|
||||||
|
'title': 'My Favorite Online Scrapbook Store',
|
||||||
|
'view_count': int,
|
||||||
|
'description': 'You\'ll find most everything you need at this virtual store front.',
|
||||||
|
'uploader': 'Anna T.',
|
||||||
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
player_key = self._search_regex(
|
||||||
|
r'<param name="playerKey" value="([^"]+)"', webpage, 'player key')
|
||||||
|
config_url = 'http://client.expotv.com/video/config/%s/%s' % (
|
||||||
|
video_id, player_key)
|
||||||
|
config = self._download_json(
|
||||||
|
config_url, video_id,
|
||||||
|
note='Downloading video configuration')
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'url': fcfg['file'],
|
||||||
|
'height': int_or_none(fcfg.get('height')),
|
||||||
|
'format_note': fcfg.get('label'),
|
||||||
|
'ext': self._search_regex(
|
||||||
|
r'filename=.*\.([a-z0-9_A-Z]+)&', fcfg['file'],
|
||||||
|
'file extension', default=None),
|
||||||
|
} for fcfg in config['sources']]
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
title = self._og_search_title(webpage)
|
||||||
|
description = self._og_search_description(webpage)
|
||||||
|
thumbnail = config.get('image')
|
||||||
|
view_count = int_or_none(self._search_regex(
|
||||||
|
r'<h5>Plays: ([0-9]+)</h5>', webpage, 'view counts'))
|
||||||
|
uploader = self._search_regex(
|
||||||
|
r'<div class="reviewer">\s*<img alt="([^"]+)"', webpage, 'uploader',
|
||||||
|
fatal=False)
|
||||||
|
upload_date = unified_strdate(self._search_regex(
|
||||||
|
r'<h5>Reviewed on ([0-9/.]+)</h5>', webpage, 'upload date',
|
||||||
|
fatal=False))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'formats': formats,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'view_count': view_count,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'uploader': uploader,
|
||||||
|
'upload_date': upload_date,
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import os
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
@@ -8,18 +9,23 @@ from ..utils import (
|
|||||||
compat_urllib_parse,
|
compat_urllib_parse,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ExtremeTubeIE(InfoExtractor):
|
class ExtremeTubeIE(InfoExtractor):
|
||||||
_VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>extremetube\.com/video/.+?(?P<videoid>[0-9]+))(?:[/?&]|$)'
|
_VALID_URL = r'^(?:https?://)?(?:www\.)?(?P<url>extremetube\.com/.*?video/.+?(?P<videoid>[0-9]+))(?:[/?&]|$)'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
u'url': u'http://www.extremetube.com/video/music-video-14-british-euro-brit-european-cumshots-swallow-652431',
|
'url': 'http://www.extremetube.com/video/music-video-14-british-euro-brit-european-cumshots-swallow-652431',
|
||||||
u'file': u'652431.mp4',
|
'md5': '1fb9228f5e3332ec8c057d6ac36f33e0',
|
||||||
u'md5': u'1fb9228f5e3332ec8c057d6ac36f33e0',
|
'info_dict': {
|
||||||
u'info_dict': {
|
'id': '652431',
|
||||||
u"title": u"Music Video 14 british euro brit european cumshots swallow",
|
'ext': 'mp4',
|
||||||
u"uploader": u"unknown",
|
'title': 'Music Video 14 british euro brit european cumshots swallow',
|
||||||
u"age_limit": 18,
|
'uploader': 'unknown',
|
||||||
|
'age_limit': 18,
|
||||||
}
|
}
|
||||||
}
|
}, {
|
||||||
|
'url': 'http://www.extremetube.com/gay/video/abcde-1234',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
@@ -30,11 +36,14 @@ class ExtremeTubeIE(InfoExtractor):
|
|||||||
req.add_header('Cookie', 'age_verified=1')
|
req.add_header('Cookie', 'age_verified=1')
|
||||||
webpage = self._download_webpage(req, video_id)
|
webpage = self._download_webpage(req, video_id)
|
||||||
|
|
||||||
video_title = self._html_search_regex(r'<h1 [^>]*?title="([^"]+)"[^>]*>\1<', webpage, u'title')
|
video_title = self._html_search_regex(
|
||||||
uploader = self._html_search_regex(r'>Posted by:(?=<)(?:\s|<[^>]*>)*(.+?)\|', webpage, u'uploader', fatal=False)
|
r'<h1 [^>]*?title="([^"]+)"[^>]*>', webpage, 'title')
|
||||||
video_url = compat_urllib_parse.unquote(self._html_search_regex(r'video_url=(.+?)&', webpage, u'video_url'))
|
uploader = self._html_search_regex(
|
||||||
|
r'>Posted by:(?=<)(?:\s|<[^>]*>)*(.+?)\|', webpage, 'uploader',
|
||||||
|
fatal=False)
|
||||||
|
video_url = compat_urllib_parse.unquote(self._html_search_regex(
|
||||||
|
r'video_url=(.+?)&', webpage, 'video_url'))
|
||||||
path = compat_urllib_parse_urlparse(video_url).path
|
path = compat_urllib_parse_urlparse(video_url).path
|
||||||
extension = os.path.splitext(path)[1][1:]
|
|
||||||
format = path.split('/')[5].split('_')[:2]
|
format = path.split('/')[5].split('_')[:2]
|
||||||
format = "-".join(format)
|
format = "-".join(format)
|
||||||
|
|
||||||
@@ -43,7 +52,6 @@ class ExtremeTubeIE(InfoExtractor):
|
|||||||
'title': video_title,
|
'title': video_title,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': extension,
|
|
||||||
'format': format,
|
'format': format,
|
||||||
'format_id': format,
|
'format_id': format,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
|
|||||||
@@ -20,15 +20,15 @@ from ..utils import (
|
|||||||
class FacebookIE(InfoExtractor):
|
class FacebookIE(InfoExtractor):
|
||||||
_VALID_URL = r'''(?x)
|
_VALID_URL = r'''(?x)
|
||||||
https?://(?:\w+\.)?facebook\.com/
|
https?://(?:\w+\.)?facebook\.com/
|
||||||
(?:[^#?]*\#!/)?
|
(?:[^#]*?\#!/)?
|
||||||
(?:video/video\.php|photo\.php|video/embed)\?(?:.*?)
|
(?:video/video\.php|photo\.php|video\.php|video/embed)\?(?:.*?)
|
||||||
(?:v|video_id)=(?P<id>[0-9]+)
|
(?:v|video_id)=(?P<id>[0-9]+)
|
||||||
(?:.*)'''
|
(?:.*)'''
|
||||||
_LOGIN_URL = 'https://www.facebook.com/login.php?next=http%3A%2F%2Ffacebook.com%2Fhome.php&login_attempt=1'
|
_LOGIN_URL = 'https://www.facebook.com/login.php?next=http%3A%2F%2Ffacebook.com%2Fhome.php&login_attempt=1'
|
||||||
_CHECKPOINT_URL = 'https://www.facebook.com/checkpoint/?next=http%3A%2F%2Ffacebook.com%2Fhome.php&_fb_noscript=1'
|
_CHECKPOINT_URL = 'https://www.facebook.com/checkpoint/?next=http%3A%2F%2Ffacebook.com%2Fhome.php&_fb_noscript=1'
|
||||||
_NETRC_MACHINE = 'facebook'
|
_NETRC_MACHINE = 'facebook'
|
||||||
IE_NAME = 'facebook'
|
IE_NAME = 'facebook'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'https://www.facebook.com/photo.php?v=120708114770723',
|
'url': 'https://www.facebook.com/photo.php?v=120708114770723',
|
||||||
'md5': '48975a41ccc4b7a581abd68651c1a5a8',
|
'md5': '48975a41ccc4b7a581abd68651c1a5a8',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@@ -37,7 +37,10 @@ class FacebookIE(InfoExtractor):
|
|||||||
'duration': 279,
|
'duration': 279,
|
||||||
'title': 'PEOPLE ARE AWESOME 2013',
|
'title': 'PEOPLE ARE AWESOME 2013',
|
||||||
}
|
}
|
||||||
}
|
}, {
|
||||||
|
'url': 'https://www.facebook.com/video.php?v=10204634152394104',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
def _login(self):
|
def _login(self):
|
||||||
(useremail, password) = self._get_login_info()
|
(useremail, password) = self._get_login_info()
|
||||||
@@ -76,9 +79,8 @@ class FacebookIE(InfoExtractor):
|
|||||||
|
|
||||||
check_form = {
|
check_form = {
|
||||||
'fb_dtsg': self._search_regex(r'name="fb_dtsg" value="(.+?)"', login_results, 'fb_dtsg'),
|
'fb_dtsg': self._search_regex(r'name="fb_dtsg" value="(.+?)"', login_results, 'fb_dtsg'),
|
||||||
'nh': self._search_regex(r'name="nh" value="(\w*?)"', login_results, 'nh'),
|
'h': self._search_regex(r'name="h" value="(\w*?)"', login_results, 'h'),
|
||||||
'name_action_selected': 'dont_save',
|
'name_action_selected': 'dont_save',
|
||||||
'submit[Continue]': self._search_regex(r'<button[^>]+value="(.*?)"[^>]+name="submit\[Continue\]"', login_results, 'continue'),
|
|
||||||
}
|
}
|
||||||
check_req = compat_urllib_request.Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
|
check_req = compat_urllib_request.Request(self._CHECKPOINT_URL, urlencode_postdata(check_form))
|
||||||
check_req.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
check_req.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
|
|||||||
63
youtube_dl/extractor/fc2.py
Normal file
63
youtube_dl/extractor/fc2.py
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#! -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
compat_urllib_request,
|
||||||
|
compat_urlparse,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class FC2IE(InfoExtractor):
|
||||||
|
_VALID_URL = r'^http://video\.fc2\.com/((?P<lang>[^/]+)/)?content/(?P<id>[^/]+)'
|
||||||
|
IE_NAME = 'fc2'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'http://video.fc2.com/en/content/20121103kUan1KHs',
|
||||||
|
'md5': 'a6ebe8ebe0396518689d963774a54eb7',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '20121103kUan1KHs',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'Boxing again with Puff',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
self._downloader.cookiejar.clear_session_cookies() # must clear
|
||||||
|
|
||||||
|
title = self._og_search_title(webpage)
|
||||||
|
thumbnail = self._og_search_thumbnail(webpage)
|
||||||
|
refer = url.replace('/content/', '/a/content/')
|
||||||
|
|
||||||
|
mimi = hashlib.md5((video_id + '_gGddgPfeaf_gzyr').encode('utf-8')).hexdigest()
|
||||||
|
|
||||||
|
info_url = (
|
||||||
|
"http://video.fc2.com/ginfo.php?mimi={1:s}&href={2:s}&v={0:s}&fversion=WIN%2011%2C6%2C602%2C180&from=2&otag=0&upid={0:s}&tk=null&".
|
||||||
|
format(video_id, mimi, compat_urllib_request.quote(refer, safe='').replace('.','%2E')))
|
||||||
|
|
||||||
|
info_webpage = self._download_webpage(
|
||||||
|
info_url, video_id, note='Downloading info page')
|
||||||
|
info = compat_urlparse.parse_qs(info_webpage)
|
||||||
|
|
||||||
|
if 'err_code' in info:
|
||||||
|
raise ExtractorError('Error code: %s' % info['err_code'][0])
|
||||||
|
|
||||||
|
video_url = info['filepath'][0] + '?mid=' + info['mid'][0]
|
||||||
|
title_info = info.get('title')
|
||||||
|
if title_info:
|
||||||
|
title = title_info[0]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'url': video_url,
|
||||||
|
'ext': 'flv',
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
}
|
||||||
81
youtube_dl/extractor/firedrive.py
Normal file
81
youtube_dl/extractor/firedrive.py
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
compat_urllib_parse,
|
||||||
|
compat_urllib_request,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class FiredriveIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?firedrive\.com/' + \
|
||||||
|
'(?:file|embed)/(?P<id>[0-9a-zA-Z]+)'
|
||||||
|
_FILE_DELETED_REGEX = r'<div class="removed_file_image">'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.firedrive.com/file/FEB892FA160EBD01',
|
||||||
|
'md5': 'd5d4252f80ebeab4dc2d5ceaed1b7970',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'FEB892FA160EBD01',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'bbb_theora_486kbit.flv',
|
||||||
|
'thumbnail': 're:^http://.*\.jpg$',
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
|
url = 'http://firedrive.com/file/%s' % video_id
|
||||||
|
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
if re.search(self._FILE_DELETED_REGEX, webpage) is not None:
|
||||||
|
raise ExtractorError('Video %s does not exist' % video_id,
|
||||||
|
expected=True)
|
||||||
|
|
||||||
|
fields = dict(re.findall(r'''(?x)<input\s+
|
||||||
|
type="hidden"\s+
|
||||||
|
name="([^"]+)"\s+
|
||||||
|
value="([^"]*)"
|
||||||
|
''', webpage))
|
||||||
|
|
||||||
|
post = compat_urllib_parse.urlencode(fields)
|
||||||
|
req = compat_urllib_request.Request(url, post)
|
||||||
|
req.add_header('Content-type', 'application/x-www-form-urlencoded')
|
||||||
|
|
||||||
|
# Apparently, this header is required for confirmation to work.
|
||||||
|
req.add_header('Host', 'www.firedrive.com')
|
||||||
|
|
||||||
|
webpage = self._download_webpage(req, video_id,
|
||||||
|
'Downloading video page')
|
||||||
|
|
||||||
|
title = self._search_regex(r'class="external_title_left">(.+)</div>',
|
||||||
|
webpage, 'title')
|
||||||
|
thumbnail = self._search_regex(r'image:\s?"(//[^\"]+)', webpage,
|
||||||
|
'thumbnail', fatal=False)
|
||||||
|
if thumbnail is not None:
|
||||||
|
thumbnail = 'http:' + thumbnail
|
||||||
|
|
||||||
|
ext = self._search_regex(r'type:\s?\'([^\']+)\',',
|
||||||
|
webpage, 'extension', fatal=False)
|
||||||
|
video_url = self._search_regex(
|
||||||
|
r'file:\s?loadURL\(\'(http[^\']+)\'\),', webpage, 'file url')
|
||||||
|
|
||||||
|
formats = [{
|
||||||
|
'format_id': 'sd',
|
||||||
|
'url': video_url,
|
||||||
|
'ext': ext,
|
||||||
|
}]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
||||||
@@ -6,7 +6,6 @@ from .common import InfoExtractor
|
|||||||
|
|
||||||
|
|
||||||
class FirstpostIE(InfoExtractor):
|
class FirstpostIE(InfoExtractor):
|
||||||
IE_NAME = 'Firstpost.com'
|
|
||||||
_VALID_URL = r'http://(?:www\.)?firstpost\.com/[^/]+/.*-(?P<id>[0-9]+)\.html'
|
_VALID_URL = r'http://(?:www\.)?firstpost\.com/[^/]+/.*-(?P<id>[0-9]+)\.html'
|
||||||
|
|
||||||
_TEST = {
|
_TEST = {
|
||||||
@@ -16,7 +15,7 @@ class FirstpostIE(InfoExtractor):
|
|||||||
'id': '1025403',
|
'id': '1025403',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'India to launch indigenous aircraft carrier INS Vikrant today',
|
'title': 'India to launch indigenous aircraft carrier INS Vikrant today',
|
||||||
'description': 'Its flight deck is over twice the size of a football field, its power unit can light up the entire Kochi city and the cabling is enough to cover the distance between here to Delhi.',
|
'description': 'md5:feef3041cb09724e0bdc02843348f5f4',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,15 +23,30 @@ class FirstpostIE(InfoExtractor):
|
|||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id = mobj.group('id')
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
page = self._download_webpage(url, video_id)
|
||||||
video_url = self._html_search_regex(
|
title = self._html_search_meta('twitter:title', page, 'title')
|
||||||
r'<div.*?name="div_video".*?flashvars="([^"]+)">',
|
description = self._html_search_meta('twitter:description', page, 'title')
|
||||||
webpage, 'video URL')
|
|
||||||
|
data = self._download_xml(
|
||||||
|
'http://www.firstpost.com/getvideoxml-%s.xml' % video_id, video_id,
|
||||||
|
'Downloading video XML')
|
||||||
|
|
||||||
|
item = data.find('./playlist/item')
|
||||||
|
thumbnail = item.find('./image').text
|
||||||
|
|
||||||
|
formats = [
|
||||||
|
{
|
||||||
|
'url': details.find('./file').text,
|
||||||
|
'format_id': details.find('./label').text.strip(),
|
||||||
|
'width': int(details.find('./width').text.strip()),
|
||||||
|
'height': int(details.find('./height').text.strip()),
|
||||||
|
} for details in item.findall('./source/file_details') if details.find('./file').text
|
||||||
|
]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'title': title,
|
||||||
'title': self._og_search_title(webpage),
|
'description': description,
|
||||||
'description': self._og_search_description(webpage),
|
'thumbnail': thumbnail,
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user