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 beautifulsoup4
42 filelock
43 lxml
44 requests
45 ]
46 ++ requests.optional-dependencies.socks
47 ++ lib.optionals (pythonOlder "3.9") [ pytz ];
48
49 # There are no tests; make sure the executable works.
50 checkPhase = ''
51 export PATH=$PATH:$out/bin
52 snscrape --help
53 '';
54
55 pythonImportsCheck = [ "snscrape" ];
56
57 meta = with lib; {
58 description = "Social networking service scraper";
59 homepage = "https://github.com/JustAnotherArchivist/snscrape";
60 license = licenses.gpl3Plus;
61 maintainers = with maintainers; [ ivan ];
62 mainProgram = "snscrape";
63 };
64}