1{ lib
2, beautifulsoup4
3, buildPythonPackage
4, fetchFromGitHub
5, filelock
6, lxml
7, pythonOlder
8, pytz
9, requests
10, setuptools-scm
11}:
12
13buildPythonPackage rec {
14 pname = "snscrape";
15 version = "0.4.3.20220106";
16 format = "setuptools";
17
18 disabled = pythonOlder "3.8";
19
20 src = fetchFromGitHub {
21 owner = "JustAnotherArchivist";
22 repo = pname;
23 rev = "v${version}";
24 hash = "sha256-gphNT1IYSiAw22sqHlV8Rm4WRP4EWUvP0UkITuepmMc=";
25 };
26
27 SETUPTOOLS_SCM_PRETEND_VERSION = version;
28
29 nativeBuildInputs = [
30 setuptools-scm
31 ];
32
33 propagatedBuildInputs = [
34 beautifulsoup4
35 filelock
36 lxml
37 requests
38 ]
39 ++ requests.optional-dependencies.socks
40 ++ lib.optionals (pythonOlder "3.9") [
41 pytz
42 ];
43
44 # There are no tests; make sure the executable works.
45 checkPhase = ''
46 export PATH=$PATH:$out/bin
47 snscrape --help
48 '';
49
50 pythonImportsCheck = [
51 "snscrape"
52 ];
53
54 meta = with lib; {
55 description = "A social networking service scraper";
56 homepage = "https://github.com/JustAnotherArchivist/snscrape";
57 license = licenses.gpl3Plus;
58 maintainers = with maintainers; [ ivan ];
59 };
60}