1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 poetry-core,
6 defusedxml,
7 requests,
8 httpretty,
9 pytestCheckHook,
10 pythonOlder,
11}:
12
13buildPythonPackage rec {
14 pname = "youtube-transcript-api";
15 version = "1.2.2";
16 pyproject = true;
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "jdepoix";
22 repo = "youtube-transcript-api";
23 tag = "v${version}";
24 hash = "sha256-nr8WeegMv7zSqlzcLSG224O9fRXA6jIlYQN4vV6lW24=";
25 };
26
27 build-system = [ poetry-core ];
28
29 pythonRelaxDeps = [
30 "defusedxml"
31 ];
32
33 dependencies = [
34 defusedxml
35 requests
36 ];
37
38 nativeCheckInputs = [
39 httpretty
40 pytestCheckHook
41 ];
42
43 preCheck = ''
44 export PATH=$out/bin:$PATH
45 '';
46
47 disabledTests = [
48 # network access
49 "test_fetch__create_consent_cookie_if_needed"
50 "test_fetch__with_generic_proxy_reraise_when_blocked"
51 "test_fetch__with_proxy_retry_when_blocked"
52 "test_fetch__with_webshare_proxy_reraise_when_blocked"
53 ];
54
55 pythonImportsCheck = [ "youtube_transcript_api" ];
56
57 meta = with lib; {
58 description = "Python API which allows you to get the transcripts/subtitles for a given YouTube video";
59 mainProgram = "youtube_transcript_api";
60 homepage = "https://github.com/jdepoix/youtube-transcript-api";
61 changelog = "https://github.com/jdepoix/youtube-transcript-api/releases/tag/${src.tag}";
62 license = licenses.mit;
63 maintainers = [ ];
64 };
65}