1{
2 lib,
3 beautifulsoup4,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 filelock,
8 lxml,
9 pythonOlder,
10 pytz,
11 requests,
12 setuptools-scm,
13}:
14
15buildPythonPackage rec {
16 pname = "snscrape";
17 version = "0.7.0.20230622";
18 pyproject = true;
19
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "JustAnotherArchivist";
24 repo = "snscrape";
25 tag = "v${version}";
26 hash = "sha256-9xAUMr1SWFePEvIz6DFEexk9Txex3u8wPNfMAdxEUCA=";
27 };
28
29 patches = [
30 # Fix find_module deprecation, https://github.com/JustAnotherArchivist/snscrape/pull/1036
31 (fetchpatch {
32 name = "fix-find-module.patch";
33 url = "https://github.com/JustAnotherArchivist/snscrape/commit/7f4717aaaaa8d4c96fa1dbe72ded799a722732ee.patch";
34 hash = "sha256-6O9bZ5GlTPuR0MML/O4DDRBcDX/CJbU54ZE551cfPHo=";
35 })
36 ];
37
38 build-system = [ setuptools-scm ];
39
40 dependencies =
41 [
42 beautifulsoup4
43 filelock
44 lxml
45 requests
46 ]
47 ++ requests.optional-dependencies.socks
48 ++ lib.optionals (pythonOlder "3.9") [ pytz ];
49
50 # There are no tests; make sure the executable works.
51 checkPhase = ''
52 export PATH=$PATH:$out/bin
53 snscrape --help
54 '';
55
56 pythonImportsCheck = [ "snscrape" ];
57
58 meta = with lib; {
59 description = "Social networking service scraper";
60 homepage = "https://github.com/JustAnotherArchivist/snscrape";
61 license = licenses.gpl3Plus;
62 maintainers = with maintainers; [ ivan ];
63 mainProgram = "snscrape";
64 };
65}