elia-search 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ MIT License\n\nCopyright (c) 2025 ELIA\n
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ recursive-include elia *.py
@@ -0,0 +1,39 @@
1
+ Metadata-Version: 2.4
2
+ Name: elia-search
3
+ Version: 1.0.0
4
+ Summary: Instagram random user search by year
5
+ Author: ELIA
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://pypi.org/project/elia-search/
8
+ Keywords: instagram,search,random,user,year
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: requests>=2.25.0
13
+ Dynamic: license-file
14
+
15
+ # elia-search
16
+
17
+ Instagram random user search by year.
18
+
19
+ ## Install
20
+
21
+ pip install elia-search
22
+
23
+ ## Usage
24
+
25
+ from elia import Search
26
+
27
+ # Single year
28
+ user_id, username = Search(2017)
29
+ print(username)
30
+
31
+ # Year range
32
+ user_id, username = Search(2015, 2018)
33
+ print(username)
34
+
35
+ # Multiple results
36
+ for i in range(10):
37
+ user_id, username = Search(2016)
38
+ if username:
39
+ print(username)
@@ -0,0 +1,25 @@
1
+ # elia-search
2
+
3
+ Instagram random user search by year.
4
+
5
+ ## Install
6
+
7
+ pip install elia-search
8
+
9
+ ## Usage
10
+
11
+ from elia import Search
12
+
13
+ # Single year
14
+ user_id, username = Search(2017)
15
+ print(username)
16
+
17
+ # Year range
18
+ user_id, username = Search(2015, 2018)
19
+ print(username)
20
+
21
+ # Multiple results
22
+ for i in range(10):
23
+ user_id, username = Search(2016)
24
+ if username:
25
+ print(username)
@@ -0,0 +1,7 @@
1
+ """elia - Instagram random user search by year"""
2
+
3
+ from .search import Search, YEAR_RANGES
4
+
5
+ __version__ = "1.0.0"
6
+ __author__ = "ELIA"
7
+ __all__ = ["Search", "YEAR_RANGES"]
@@ -0,0 +1,114 @@
1
+
2
+ import random
3
+ import string
4
+ import requests
5
+
6
+ _session = requests.Session()
7
+
8
+
9
+ YEAR_RANGES = {
10
+ "2010": (1, 1279000),
11
+ "2011": (1279000, 17750000),
12
+ "2012": (17750000, 279760000),
13
+ "2013": (279760000, 900990000),
14
+ "2014": (900990000, 1629010000),
15
+ "2015": (1900000000, 2500000000),
16
+ "2016": (2500000000, 3713668786),
17
+ "2017": (3713668786, 5699785217),
18
+ "2018": (5699785217, 8507940634),
19
+ "2019": (8507940634, 21254029834),
20
+ }
21
+
22
+
23
+ def Search(year1, year2=None, max_tries=50):
24
+ """
25
+ Search Instagram user within a range of years.
26
+
27
+ Args:
28
+ year1: start year (e.g., 2015) - int or str
29
+ year2: end year (e.g., 2018) - optional
30
+ max_tries: number of attempts
31
+
32
+ Returns:
33
+ tuple: (id, username) or (None, None)
34
+ """
35
+ year1 = str(year1)
36
+
37
+ if year2 is None:
38
+ if year1 not in YEAR_RANGES:
39
+ return None, None
40
+ start_id, end_id = YEAR_RANGES[year1]
41
+ else:
42
+ year2 = str(year2)
43
+ if year1 not in YEAR_RANGES or year2 not in YEAR_RANGES:
44
+ return None, None
45
+
46
+ start_id = YEAR_RANGES[year1][0]
47
+ end_id = YEAR_RANGES[year2][1]
48
+
49
+ return _search(start_id, end_id, max_tries)
50
+
51
+
52
+ def _search(start_id, end_id, max_tries=50):
53
+ for attempt in range(max_tries):
54
+ try:
55
+ Id = str(random.randint(start_id, end_id))
56
+
57
+ rnd = str(random.randint(150, 999))
58
+ devices = ["SAMSUNG", "HUAWEI", "LGE/lge", "HTC", "ASUS", "ZTE",
59
+ "ONEPLUS", "XIAOMI", "OPPO", "VIVO", "SONY", "REALME"]
60
+ versions = ["23/6.0", "24/7.0", "25/7.1.1", "26/8.0", "27/8.1", "28/9.0"]
61
+
62
+ user_agent = (
63
+ "Instagram 311.0.0.32.118 Android ("
64
+ + versions[random.randint(0, 5)]
65
+ + "; " + str(random.randint(100, 1300)) + "dpi; "
66
+ + str(random.randint(200, 2000)) + "x" + str(random.randint(200, 2000)) + "; "
67
+ + devices[random.randint(0, 11)]
68
+ + "; SM-T" + rnd + "; SM-T" + rnd + "; qcom; en_US; 545986"
69
+ + str(random.randint(111, 999)) + ")"
70
+ )
71
+
72
+ lsd = "".join(random.choice(string.ascii_letters + string.digits) for _ in range(32))
73
+
74
+ headers = {
75
+ "accept": "*/*",
76
+ "accept-language": "en,en-US;q=0.9",
77
+ "content-type": "application/x-www-form-urlencoded",
78
+ "dnt": "1",
79
+ "origin": "https://www.instagram.com",
80
+ "referer": "https://www.instagram.com/",
81
+ "user-agent": user_agent,
82
+ "x-fb-friendly-name": "PolarisProfilePageContentQuery",
83
+ "x-fb-lsd": lsd,
84
+ }
85
+
86
+ data = {
87
+ "lsd": lsd,
88
+ "fb_api_caller_class": "RelayModern",
89
+ "fb_api_req_friendly_name": "PolarisProfilePageContentQuery",
90
+ "variables": '{"enable_integrity_filters":true,"id":"' + Id + '","__relay_internal__pv__PolarisCannesGuardianExperienceEnabledrelayprovider":true,"__relay_internal__pv__PolarisCASB976ProfileEnabledrelayprovider":false,"__relay_internal__pv__PolarisWebSchoolsEnabledrelayprovider":false,"__relay_internal__pv__PolarisRepostsConsumptionEnabledrelayprovider":false}',
91
+ "server_timestamps": "true",
92
+ "doc_id": "26672929172408668",
93
+ }
94
+
95
+ response = _session.post(
96
+ "https://www.instagram.com/api/graphql",
97
+ headers=headers,
98
+ data=data,
99
+ timeout=15,
100
+ )
101
+
102
+ if response.status_code == 200:
103
+ try:
104
+ json_data = response.json()
105
+ user = json_data.get("data", {}).get("user")
106
+ if user and user.get("username"):
107
+ return Id, user.get("username")
108
+ except:
109
+ pass
110
+
111
+ except Exception:
112
+ pass
113
+
114
+ return None, None
@@ -0,0 +1,39 @@
1
+ Metadata-Version: 2.4
2
+ Name: elia-search
3
+ Version: 1.0.0
4
+ Summary: Instagram random user search by year
5
+ Author: ELIA
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://pypi.org/project/elia-search/
8
+ Keywords: instagram,search,random,user,year
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: requests>=2.25.0
13
+ Dynamic: license-file
14
+
15
+ # elia-search
16
+
17
+ Instagram random user search by year.
18
+
19
+ ## Install
20
+
21
+ pip install elia-search
22
+
23
+ ## Usage
24
+
25
+ from elia import Search
26
+
27
+ # Single year
28
+ user_id, username = Search(2017)
29
+ print(username)
30
+
31
+ # Year range
32
+ user_id, username = Search(2015, 2018)
33
+ print(username)
34
+
35
+ # Multiple results
36
+ for i in range(10):
37
+ user_id, username = Search(2016)
38
+ if username:
39
+ print(username)
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ elia/__init__.py
6
+ elia/search.py
7
+ elia_search.egg-info/PKG-INFO
8
+ elia_search.egg-info/SOURCES.txt
9
+ elia_search.egg-info/dependency_links.txt
10
+ elia_search.egg-info/requires.txt
11
+ elia_search.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests>=2.25.0
@@ -0,0 +1,20 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "elia-search"
7
+ version = "1.0.0"
8
+ description = "Instagram random user search by year"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ authors = [{name = "ELIA"}]
13
+ keywords = ["instagram", "search", "random", "user", "year"]
14
+ dependencies = ["requests>=2.25.0"]
15
+
16
+ [project.urls]
17
+ Homepage = "https://pypi.org/project/elia-search/"
18
+
19
+ [tool.setuptools.packages.find]
20
+ include = ["elia*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+